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


Python KMessageBox.error方法代码示例

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


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

示例1: onSendClick

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import error [as 别名]
    def onSendClick(self):
        for provider in self.providerpluginlist:
            if(provider.getObjectname() == self.ui.providerList.selectedItems()[0].text()):
                sms = provider
        if self.ui.smstext.toPlainText() != "":
            if self.ui.phonenr.text() != "":
                self.getLogin()
                try:
                    sms.setConfig(self.config)
                except Exception:
                    self.onConfigClick()
                    return
                sms.clearNrs()
                for nr in re.findall("(\+\d*)", self.ui.phonenr.text()):
                    sms.addNr(nr)
                sms.setText(self.ui.smstext.toPlainText())
                savenr = self.ui.phonenr.text()
                try:
                    sms.execute()
#                    self.notification.setText(i18n("Wurde erfolgreich an <i>%1</i> geschickt!").arg(savenr ))
#                    self.notification.setTitle("Erfolg!")
#                    self.notification.sendEvent()
                    KMessageBox.information(None, i18n("SMS sendet successfully to " + savenr + ". Service: "+sms.getProvidername()), i18n("Success!"))
                except Exception, error:
                    KMessageBox.error(None, i18n(error.message), i18n("Sendproblems"))
                self.ui.phonenr.clear()
                self.ui.smstext.clear()
            else:
                KMessageBox.error(None, i18n("Please fill in a phonenr"), i18n("Please fill in a phonenr"))
开发者ID:hersche,项目名称:MultiSms,代码行数:31,代码来源:widget.py

示例2: askForPIN

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import error [as 别名]
    def askForPIN(self):
        if "pin" in self.iface.capabilities(self.package)["modes"] and self.iface.requiresPIN(self.package, self.device):
            # Loop 3 times by default
            for c in range(self.pinDialog.maxTries):
                # Clear textbox
                self.pinDialog.setPassword("")
                if self.pinDialog.exec_():
                    # Clicked OK
                    pin = self.pinDialog.password()

                    # Send PIN to the card, returns True if PIN is valid.
                    if self.iface.sendPIN(self.package, self.device, str(pin)):
                        self.pin = str(pin)
                        self.ui.lineEditPIN.setText(self.pin)
                        return True
                else:
                    break

            # Verification failed for 3 times
            if c == self.pinDialog.maxTries-1:
                KMessageBox.error(self, i18n("You've typed the wrong PIN code for 3 times"))
                return False
            else:
                # Canceled
                return True

        else:
            # PIN is already entered or the backend doesn't support PIN operations
            return True
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:31,代码来源:widgets.py

示例3: dialogInputBox

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import error [as 别名]
def dialogInputBox(message = _("Text"), ontType = "string"):
    if (ontType == "date"):
        parameters = ["zenity", "--calendar", "--title=" + PROGRAM_NAME, "--text=" + message, "--date-format=%Y-%m-%d"]

    else:
        parameters = ["kdialog", "--title", PROGRAM_NAME, "--inputbox", message]

    try:
        dialogProcess = subprocess.Popen(parameters, stdout=subprocess.PIPE)
        dialogProcess.wait()
        value = u""
        for line in iter(dialogProcess.stdout.readline, ''):
            value += toUnicode(line)

        # Cleaning last "\n".
        if (value[-1] == "\n"):
            value = value[:-1]

        print(toUtf8("dialogInputBox:%s" % value))

    except:
        value = None
        KMessageBox.error(None, "Zenity and KDialog are required to edit resources.")

    return value
开发者ID:nogates,项目名称:nepoogle,代码行数:27,代码来源:lfunctions.py

示例4: init

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

示例5: file2String

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import error [as 别名]
 def file2String(self, path):
     if(os.path.isfile(path)):
         f = open(path, 'r')
         return f.read()
     else:
         KMessageBox.error(None, i18n("No path on this file"), i18n("No path"))
         raise RuntimeError("No path")
开发者ID:hersche,项目名称:MultiSms,代码行数:9,代码来源:kontactwrapper.py

示例6: __init__

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import error [as 别名]
    def __init__(self, parent=None):
        KStatusNotifierItem.__init__(self, parent)
        self.setTitle('synaptiks')
        self.setIconByName('synaptiks')
        self.setCategory(KStatusNotifierItem.Hardware)
        self.setStatus(KStatusNotifierItem.Passive)
        self.setup_actions()

        self._config = SynaptiksTrayConfiguration(self)

        try:
            self.touchpad = Touchpad.find_first(Display.from_qt())
        except Exception as error:
            # show an error message
            from synaptiks.kde.error import get_localized_error_message
            error_message = get_localized_error_message(error)
            options = KMessageBox.Options(KMessageBox.Notify |
                                          KMessageBox.AllowLink)
            KMessageBox.error(None, error_message, '', options)
            # disable all touchpad related actions
            for act in (self.touchpad_on_action, self.preferences_action):
                act.setEnabled(False)
            # disable synaptiks autostart, the user can still start synaptiks
            # manually again, if the reason of the error is fixed
            self._config.findItem('Autostart').setProperty(False)
            self._config.writeConfig()
        else:
            self.activateRequested.connect(self.show_configuration_dialog)
            # setup the touchpad manager
            self.setup_manager(self.touchpad)
开发者ID:adaptee,项目名称:synaptiks,代码行数:32,代码来源:trayapplication.py

示例7: unpackError

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import error [as 别名]
 def unpackError(self, err):
     self.progress.setRange(0, 100)
     self.progress.reset()
     self.enableButtonOk(True)
     self.status.setText(i18n("Unpacking failed."))
     KMessageBox.error(self, i18n("An error occurred:\n\n%1",
         self.unpackJob.errorString()))
开发者ID:Alwnikrotikz,项目名称:lilykde,代码行数:9,代码来源:download.py

示例8: dialogList

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import error [as 别名]
def dialogList(parameters = [], message = _("Select")):
    value = label = None

    try:
        if parameters:
            parameters = ["kdialog", "--title", PROGRAM_NAME, "--radiolist", message] \
                            + parameters
            dialogProcess = subprocess.Popen(parameters, stdout=subprocess.PIPE)
            dialogProcess.wait()
            value = u""
            for line in iter(dialogProcess.stdout.readline, ''):
                value += toUnicode(line)

            # Cleaning last "\n".
            if (value[-1] == "\n"):
                value = value[:-1]

            try:
                label = toUnicode(parameters[parameters.index(value) + 1])

            except:
                label = toUnicode(value)

        print(toUtf8("dialogList:%s" % value))

    except:
        KMessageBox.error(None, "Zenity and KDialog are required to edit resources.")

    return value, label
开发者ID:nogates,项目名称:nepoogle,代码行数:31,代码来源:lfunctions.py

示例9: pkgChanges

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import error [as 别名]
    def pkgChanges(self, mode):

        if mode == "install":
            items = self.ui.listViewLanguagesInst.selectedItems()
        else:
            items = self.ui.listViewLanguagesUninst.selectedItems()
            
        if len(items) == 1:
            elm = items[0]
            li = self._localeinfo.listviewStrToLangInfoMap[unicode(elm.text())]
            langPkg = li.languagePkgList["languagePack"]
            if langPkg.available:
                if (mode == "install") and (not langPkg.installed):
                    langPkg.doChange = self.ui.checkBoxTr.isChecked()
                elif (mode == "uninstall") and langPkg.installed:
                    langPkg.doChange = True
            try:
                self._cache.tryChangeDetails(li)
                for langPkg in li.languagePkgList.values():
                  langPkg.doChange = False
            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)

        (to_inst, to_rm) = self._cache.getChangesList()
        if len(to_inst) == len(to_rm) == 0:
            return
        # first install
        self.setCursor(Qt.WaitCursor)
        self.setEnabled(False)
        self.run_pkg_manager(to_inst,to_rm)
        self.setCursor(Qt.ArrowCursor)
        self.setEnabled(True)
        
#        kdmscript = "/etc/init.d/kdm"
#        if os.path.exists("/var/run/kdm.pid") and os.path.exists(kdmscript):
#            subprocess.call(["invoke-rc.d","kdm","reload"])

        #self.run_pkg_manager(to_inst, to_rm)

        if self.returncode == 0:
            if (mode == "install"):
                KMessageBox.information( self, _("All selected components have now been installed for %s.  Select them from Country/Region & Language.") % unicode(items[0].text()), _("Language Installed") )
            elif (mode == "uninstall"):
                KMessageBox.information( self, _("Translations and support have now been uninstalled for %s.") % unicode(items[0].text()), _("Language Uninstalled") )
            # Resync the cache to match packageManager changes, then update views
            self._cache.open(None)
            self.updateLanguagesList()
            self.updateSystemDefaultListbox()
            if mode == "install":
                self.checkInstallableComponents()
        else:
            KMessageBox.sorry(self, _("Failed to set system language."), _("Language Not Set"))
            self._cache.clear() # undo all selections
开发者ID:wzssyqa,项目名称:language-selector-im-config,代码行数:61,代码来源:QtLanguageSelector.py

示例10: show_error_dialog

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import error [as 别名]
 def show_error_dialog(self, message, details=None):
     """
     Convenience method for showing an error dialog.
     """
     if details is None:
         KMessageBox.error(None, message)
     else:
         KMessageBox.detailedError(None, message, details)
开发者ID:johnbeard,项目名称:autokey-py3,代码行数:10,代码来源:qtapp.py

示例11: __call__

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import error [as 别名]
 def __call__(self):
     try:
         return self.f()
     except _HandledException:
         raise
     except Exception, e:
         txt = "".join(traceback.format_exception(*sys.exc_info()))
         KMessageBox.error(None, txt, i18n("Error in action '{}'").format(self.f.__name__))
         raise _HandledException(txt)
开发者ID:mkhoeini,项目名称:kate,代码行数:11,代码来源:__init__.py

示例12: applyChanges

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import error [as 别名]
    def applyChanges(self):
        ui = self.ui
        connectionName = unicode(ui.lineConnectionName.text())

        try:
            self.iface.updateConnection(self.lastEditedPackage, connectionName, self.collectDataFromUI())
        except Exception, e:
            KMessageBox.error(self.baseWidget, unicode(e))
            return
开发者ID:Tayyib,项目名称:uludag,代码行数:11,代码来源:base.py

示例13: deleteBackup

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

示例14: handler

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import error [as 别名]
 def handler(package, exception, args):
     if exception:
         if self.ui.checkToggler.isChecked():
             self.ui.checkToggler.setChecked(False)
         else:
             self.ui.checkToggler.setChecked(True)
         if "Comar.PolicyKit" in exception._dbus_error_name:
             KMessageBox.error(self, i18n("Access denied."))
         else:
             KMessageBox.error(self, unicode(exception))
开发者ID:Tayyib,项目名称:uludag,代码行数:12,代码来源:widgets.py

示例15: convertAbsoluteToRelative

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import error [as 别名]
 def convertAbsoluteToRelative(self):
     """
     Converts the selected music expression or all toplevel expressions to \relative ones.
     """
     text, start = self.doc.selectionOrDocument()
     try:
         ly.tools.absoluteToRelative(text, start).applyToCursor(EditCursor(self.doc.doc))
     except ly.NoMusicExpressionFound:
         KMessageBox.error(
             self.doc.app.mainwin, i18n("Please select a music expression, enclosed in << ... >> or { ... }.")
         )
开发者ID:Alwnikrotikz,项目名称:lilykde,代码行数:13,代码来源:document.py


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