当前位置: 首页>>代码示例>>Python>>正文


Python KMessageBox.warningYesNoCancel方法代码示例

本文整理汇总了Python中PyKDE4.kdeui.KMessageBox.warningYesNoCancel方法的典型用法代码示例。如果您正苦于以下问题:Python KMessageBox.warningYesNoCancel方法的具体用法?Python KMessageBox.warningYesNoCancel怎么用?Python KMessageBox.warningYesNoCancel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyKDE4.kdeui.KMessageBox的用法示例。


在下文中一共展示了KMessageBox.warningYesNoCancel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __kdeWarning

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import warningYesNoCancel [as 别名]
 def __kdeWarning(parent, title, text, 
                  buttons = QMessageBox.Ok, defaultButton = QMessageBox.NoButton):
     """
     Function to show a modal warning message box.
     
     @param parent parent widget of the message box
     @param title caption of the message box
     @param text text to be shown by the message box
     @param buttons flags indicating which buttons to show 
         (QMessageBox.StandardButtons)
     @param defaultButton flag indicating the default button
         (QMessageBox.StandardButton)
     @return button pressed by the user (QMessageBox.StandardButton)
     """
     if __nrButtons(buttons) == 1:
         KMessageBox.sorry(parent, text, title)
         return buttons
     
     if __nrButtons(buttons) == 2:
         if defaultButton == QMessageBox.NoButton:
             defaultButton = __getLowestFlag(buttons)
         noButton = defaultButton
         noItem = __getGuiItem(noButton)
         yesButton = int(buttons & ~noButton)
         yesItem = __getGuiItem(yesButton)
         res = KMessageBox.warningYesNo(parent, text, title, yesItem, noItem)
         if res == KMessageBox.Yes:
             return yesButton
         else:
             return noButton
     
     if __nrButtons(buttons) == 3:
         if defaultButton == QMessageBox.NoButton:
             defaultButton = __getLowestFlag(buttons)
         yesButton = defaultButton
         yesItem = __getGuiItem(yesButton)
         buttons = buttons & ~yesButton
         noButton = __getLowestFlag(buttons)
         noItem = __getGuiItem(noButton)
         cancelButton = int(buttons & ~noButton)
         cancelItem = __getGuiItem(cancelButton)
         res = KMessageBox.warningYesNoCancel(parent, text, title, 
             yesItem, noItem, cancelItem)
         if res == KMessageBox.Yes:
             return yesButton
         elif res == KMessageBox.No:
             return noButton
         else:
             return cancelButton
     
     raise RuntimeError("More than three buttons are not supported.")
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:53,代码来源:KQMessageBox.py

示例2: queryClose

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import warningYesNoCancel [as 别名]
	def queryClose(self):
		"""
		Gets invoked by Qt if the window is about to be closed
		Returns True if it is allowed to close
		"""
		self.kate.writeConfig(self.autoSaveConfigGroup().config())
		
		if self.editor.document().isModified():
			ret = KMessageBox.warningYesNoCancel(self,
				i18n('Save changes to document?'))
			if ret == KMessageBox.Yes:
				return self.editor.document().documentSave()
			else:
				return ret == KMessageBox.No
		else:
			return True
开发者ID:flying-sheep,项目名称:markdowner,代码行数:18,代码来源:__init__.py

示例3: queryClose

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import warningYesNoCancel [as 别名]
 def queryClose(self):
     """Ask user if document modified and saves if desired."""
     # Many stuff copied from KatePart
     if not self.doc or not self.isModified():
         return True
     res = KMessageBox.warningYesNoCancel(self.app.mainwin, i18n(
         "The document \"%1\" has been modified.\n"
         "Do you want to save your changes or discard them?",
         self.documentName()), i18n("Close Document"),
         KStandardGuiItem.save(), KStandardGuiItem.discard())
     if res == KMessageBox.Yes:
         self.save()
     elif res == KMessageBox.No:
         return True
     else: # cancel
         return False
开发者ID:Alwnikrotikz,项目名称:lilykde,代码行数:18,代码来源:app.py


注:本文中的PyKDE4.kdeui.KMessageBox.warningYesNoCancel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。