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


Python KMessageBox.questionYesNoCancel方法代码示例

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


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

示例1: unpack

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import questionYesNoCancel [as 别名]
 def unpack(self, package):
     """Unpack the given lilypond .sh archive."""
     fileName = os.path.basename(package)
     ver = version(fileName) or 'unknown' # should not happen
     self.prefix = os.path.join(self.installDest.url().path(), ver)
     self.lilypond = os.path.join(self.prefix, "bin", "lilypond")
     if not os.path.exists(self.prefix):
         os.makedirs(self.prefix)
     elif os.path.exists(self.lilypond):
         result = KMessageBox.questionYesNoCancel(self, i18n(
             "LilyPond %1 seems already to be installed in %2.\n\n"
             "Do you want to use it or to remove and re-install?",
             ver, self.prefix), None,
             KGuiItem(i18n("Use existing LilyPond")),
             KGuiItem(i18n("Remove and re-install")))
         if result == KMessageBox.Yes:
             self.info.lilypond.setText(self.lilypond)
             self.enableButtonOk(True)
             KDialog.done(self, KDialog.Accepted)
             return
         elif result == KMessageBox.No:
             shutil.rmtree(self.prefix, True)
         else: # Cancel
             self.progress.reset()
             self.enableButtonOk(True)
             return
     self.status.setText(i18n("Unpacking %1...", fileName))
     self.progress.setRange(0, 0)
     unpack = self.unpackJob = QProcess()
     unpack.setProcessChannelMode(QProcess.MergedChannels)
     unpack.setWorkingDirectory(self.prefix)
     unpack.finished.connect(self.unpackFinished)
     unpack.error.connect(self.unpackError)
     unpack.start("sh", [package, "--batch", "--prefix", self.prefix])
开发者ID:Alwnikrotikz,项目名称:lilykde,代码行数:36,代码来源:download.py

示例2: __kdeQuestion

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import questionYesNoCancel [as 别名]
 def __kdeQuestion(parent, title, text, 
                   buttons = QMessageBox.Ok, defaultButton = QMessageBox.NoButton):
     """
     Function to show a modal critical 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:
         if defaultButton == QMessageBox.NoButton:
             defaultButton = __getLowestFlag(buttons)
         yesButton = defaultButton
         yesItem = __getGuiItem(yesButton)
         KMessageBox.questionYesNo(parent, text, title, yesItem, KGuiItem())
         return yesButton
     
     if __nrButtons(buttons) == 2:
         if defaultButton == QMessageBox.NoButton:
             defaultButton = __getLowestFlag(buttons)
         yesButton = defaultButton
         yesItem = __getGuiItem(yesButton)
         noButton = int(buttons & ~yesButton)
         noItem = __getGuiItem(noButton)
         res = KMessageBox.questionYesNo(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.questionYesNoCancel(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,代码行数:57,代码来源:KQMessageBox.py


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