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


Python KMessageBox.questionYesNo方法代码示例

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


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

示例1: __kdeQuestion

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import questionYesNo [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

示例2: mediaChange

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import questionYesNo [as 别名]
 def mediaChange(self, medium, drive):
     msg = _("Please insert '%s' into the drive '%s'") % (medium,drive)
     #change = QMessageBox.question(None, _("Media Change"), msg, QMessageBox.Ok, QMessageBox.Cancel)
     change = KMessageBox.questionYesNo(None, _("Media Change"), _("Media Change") + "<br>" + msg, KStandardGuiItem.ok(), KStandardGuiItem.cancel())
     if change == KMessageBox.Yes:
         return True
     return False
开发者ID:frontjang,项目名称:gdebi,代码行数:9,代码来源:KDEAptDialogs.py

示例3: init

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import questionYesNo [as 别名]
    def init(self):
        self.translateUI()
        try:
            self.openCache(apt.progress.OpProgress())
        except ExceptionPkgCacheBroken:
            s = _("Software database is broken")
            t = _("It is impossible to install or remove any software. "
                  "Please use the package manager \"Adept\" or run "
                  "\"sudo apt-get install -f\" in a terminal to fix "
                  "this issue at first.")
            KMessageBox.error(self, t, s)
            sys.exit(1)
        self.updateLanguagesList()
        self.updateSystemDefaultListbox()

        if not self._cache.havePackageLists:
            yesText = _("_Update").replace("_", "&")
            noText = _("_Remind Me Later").replace("_", "&")
            yes = KGuiItem(yesText, "dialog-ok")
            no = KGuiItem(noText, "process-stop")
            text = "<big><b>%s</b></big>\n\n%s" % (
              _("No language information available"),
              _("The system does not have information about the "
                "available languages yet. Do you want to perform "
                "a network update to get them now? "))
            text = text.replace("\n", "<br />")
            res = KMessageBox.questionYesNo(self, text, "", yes, no)
            if res == KMessageBox.Yes:
                self.setEnabled(False)
                self.update()
                self.openCache(apt.progress.OpProgress())
                self.updateLanguagesList()
                self.setEnabled(True)
开发者ID:wzssyqa,项目名称:language-selector-im-config,代码行数:35,代码来源:QtLanguageSelector.py

示例4: verifyInstalledLangPacks

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import questionYesNo [as 别名]
    def verifyInstalledLangPacks(self):
        """ called at the start to inform about possible missing
            langpacks (e.g. gnome/kde langpack transition)
        """
        print "verifyInstalledLangPacks"
        missing = self.getMissingLangPacks()

        print "Missing: %s " % missing
        if len(missing) > 0:
            # FIXME: add "details"
            yesText = _("_Install").replace("_", "&")
            noText = _("_Remind Me Later").replace("_", "&")
            yes = KGuiItem(yesText, "dialog-ok")
            no = KGuiItem(noText, "process-stop")
            text = "<big><b>%s</b></big>\n\n%s" % (
                _("The language support is not installed completely"),
                _("Some translations or writing aids available for your "
                  "chosen languages are not installed yet. Do you want "
                  "to install them now?"))
            text = text.replace("\n", "<br />")
            res = KMessageBox.questionYesNo(self, text, "", yes, no)
            if res == KMessageBox.Yes:
                self.setEnabled(False)
                self.commit(missing, [])
                self.updateLanguagesList()
                self.setEnabled(True)
开发者ID:wzssyqa,项目名称:language-selector-im-config,代码行数:28,代码来源:QtLanguageSelector.py

示例5: deleteBackup

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import questionYesNo [as 别名]
    def deleteBackup(self):
	global backupInstance
	boxresult = KMessageBox.questionYesNo(None, "Really delete backup '" + self.backupList.currentText() + "'?")
	if boxresult == KMessageBox.Yes:
	  resulttype, result = backupInstance.deleteBackup( str(self.backupList.currentText()) )
	  if result != "ERROR":
	    KMessageBox.information(None, self.backupList.currentText() + ' deleted.')
	    self.backupList.removeItem(self.backupList.currentIndex())
	  else:
	    KMessageBox.error(None, result[0]['message'])
开发者ID:sarahcitrus,项目名称:backup2isp,代码行数:12,代码来源:backup2isp.py

示例6: deleteConnection

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import questionYesNo [as 别名]
 def deleteConnection(self):
     profile = self.sender().parent().profile
     package = self.sender().parent().package
     if (
         KMessageBox.questionYesNo(
             self, i18n("Do you really want to remove profile %1?", profile), "Network-Manager"
         )
         == KMessageBox.Yes
     ):
         self.iface.deleteConnection(package, profile)
开发者ID:hasanakgoz,项目名称:Pardus-2011-Svn-,代码行数:12,代码来源:base.py

示例7: ki18n

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import questionYesNo [as 别名]
#!/usr/bin/env python
import sys

from PyQt4.QtCore import QString

from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineArgs
from PyKDE4.kdeui import KApplication, KGuiItem, KMessageBox

appName = "helloworld"
catalog = ""
programName = ki18n("helloworld")
version = "1.0"
description = ki18n("Tutorial - First Program")
license = KAboutData.License_GPL
copyright = ki18n("(c) 2007 Jim Bublitz")
text = ki18n("none")
homePage = "www.riverbankcomputing.com"
bugEmail = "[email protected]"

aboutData = KAboutData(
    appName, catalog, programName, version, description, license, copyright, text, homePage, bugEmail
)

KCmdLineArgs.init(sys.argv, aboutData)

app = KApplication()

guiItem = KGuiItem(QString("Hello"), QString(), QString("this is a tooltip"), QString("this is a whatsthis"))

KMessageBox.questionYesNo(None, "Hello World", "Hello", guiItem)
开发者ID:KDE,项目名称:pykde4,代码行数:32,代码来源:helloworld.py

示例8: confirmQuit

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import questionYesNo [as 别名]
   def confirmQuit(self):
       result = KMessageBox.questionYesNo(None, "Really quit?")
       if result == KMessageBox.Yes:
	app.quit()
开发者ID:sarahcitrus,项目名称:backup2isp,代码行数:6,代码来源:backup2isp.py


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