コード例 #1
0
ファイル: widgets.py プロジェクト: pars-linux/uludag
    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
コード例 #2
0
ファイル: kontactwrapper.py プロジェクト: hersche/MultiSms
 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")
コード例 #3
0
ファイル: lfunctions.py プロジェクト: nogates/nepoogle
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
コード例 #4
0
ファイル: download.py プロジェクト: Alwnikrotikz/lilykde
 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()))
コード例 #5
0
ファイル: lfunctions.py プロジェクト: nogates/nepoogle
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
コード例 #6
0
    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)
コード例 #7
0
ファイル: widgets.py プロジェクト: dhirajkhatiwada1/uludag
    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
コード例 #8
0
 def shown(self):
     if not self.users:
         KMessageBox.error(
             self,
             i18n(
                 "There aren't any Microsoft Windows partitions to migrate! Please check your mounted partitions..."
             ))
コード例 #9
0
ファイル: trayapplication.py プロジェクト: adaptee/synaptiks
    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)
コード例 #10
0
ファイル: qtapp.py プロジェクト: johnbeard/autokey-py3
 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)
コード例 #11
0
ファイル: ScrUserFiles.py プロジェクト: pars-linux/uludag
 def shown(self):
     if ctx.sources:
         self.creator(ctx.sources)
     else:
         KMessageBox.error(
             self,
             "There isn't any Windows User Sources to migrate! Check your Windows Partition..."
         )
コード例 #12
0
ファイル: qtapp.py プロジェクト: sonyeric/autokey
 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)
コード例 #13
0
ファイル: qtapp.py プロジェクト: gerrit-rws/autokey-py3
 def show_script_error(self):
     """
     Show the last script error (if any)
     """
     if self.service.scriptRunner.error != '':
         KMessageBox.information(None, self.service.scriptRunner.error, i18n("View Script Error Details"))
         self.service.scriptRunner.error = ''
     else:
         KMessageBox.information(None, i18n("No error information available"), i18n("View Script Error Details"))
コード例 #14
0
ファイル: base.py プロジェクト: Tayyib/uludag
    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
コード例 #15
0
ファイル: qtapp.py プロジェクト: johnbeard/autokey-py3
 def show_script_error(self):
     """
     Show the last script error (if any)
     """
     if self.service.scriptRunner.error != '':
         KMessageBox.information(None, self.service.scriptRunner.error, i18n("View Script Error Details"))
         self.service.scriptRunner.error = ''
     else:
         KMessageBox.information(None, i18n("No error information available"), i18n("View Script Error Details"))
コード例 #16
0
 def __kdeAbout(parent, title, text):
     """
     Function to show a modal about 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
     """
     KMessageBox.about(parent, text, title)
コード例 #17
0
    def finished(self, *args):
        '''Install completed'''

        text = _('Installation is complete.  You may now reboot your computer with this USB thumb drive inserted to boot Ubuntu.')

        self.__backend.cleanup()
        self.progress_bar.hide()
        KMessageBox.information(self.__mainWindow,text)
        sys.exit(0)
コード例 #18
0
 def failed(self, title=None):
     self.__backend.cleanup()
     self.progress_bar.hide()
     if title:
         logging.critical('Install failed: ' + title)
     else:
         logging.critical('Install failed')
     KMessageBox.error(self.__mainWindow,title)
     sys.exit(1)
コード例 #19
0
ファイル: __init__.py プロジェクト: mkhoeini/kate
 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)
コード例 #20
0
	def slotResult(self, job):

		print "result"
		if job.error():
			KMessageBox.sorry(None, job.errorString())
			if self.progressWidget.isVisible():
				self.progressWidget.hide()

		self.frame.setEnabled(True)
コード例 #21
0
ファイル: widgets.py プロジェクト: Tayyib/uludag
 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))
コード例 #22
0
    def __fail(self, message=None):
        '''Handle Failed Install Gracefully'''

        logging.exception('Installation failed.')
        self.__backend.unmount()
        self.progress_bar.hide()
        if not message:
            message = _('Installation failed.')
        KMessageBox.error(self.__mainWindow, message)
        sys.exit(1)
コード例 #23
0
    def success(self):
        '''Install completed'''
        self.__backend.unmount()
        self.progress_bar.hide()
        text = _('The installation is complete.  You may now reboot your '
                 'computer with this device inserted to try or install '
                 'Ubuntu.')

        KMessageBox.information(self.__mainWindow, text)
        sys.exit(0)
コード例 #24
0
ファイル: backup2isp.py プロジェクト: sarahcitrus/backup2isp
    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'])
コード例 #25
0
 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.")
コード例 #26
0
    def detailsButtonClicked(self):
        changedList = list()
        (install, remove, unauthenticated) = self._deb.required_changes
        for i in install:
            changedList.append(_("To be installed: %s") % i)
        for r in remove:
            changedList.append(_("To be removed: %s") % r)

        KMessageBox.informationList(
            self, _("<b>To install the following changes are required:</b>"),
            changedList, _("Details"))
コード例 #27
0
 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)
コード例 #28
0
ファイル: backup2isp.py プロジェクト: sarahcitrus/backup2isp
    def useBackup(self):
        global backupInstance, config, mainwin, backupwin
	resulttype, result = backupInstance.login( config.username, config.password, self.backupList.currentText() )
	if resulttype != "ERROR":
	  self.hide()
	  backupwin = BackupWindow()
	  mainwin = backupwin
	  mainwin.show()
	  backupwin.updateVolumeName( self.backupList.currentText() )
	else:
	  KMessageBox.error(None, result[0]['message'])
コード例 #29
0
ファイル: widgets.py プロジェクト: pars-linux/uludag
 def handler(package, exception, args):
     if exception:
         print "*** exception: %s" % 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))
コード例 #30
0
ファイル: document.py プロジェクト: Alwnikrotikz/lilykde
 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 { ... }.")
         )
コード例 #31
0
ファイル: __init__.py プロジェクト: zybzyb1/emscripten-kate
 def __call__(self):
     try:
         return self.f()
     except _HandledException:
         raise
     except Exception as e:
         txt = "".join(traceback.format_exception(*sys.exc_info()))
         # TODO: Use the i18n() wrapper here. Unfortunately, Python3 currently
         # says "TypeError: i18n(): argument 1 has unexpected type 'str'",
         # and that is rather unfortunate for the catch-all handler.
         KMessageBox.error(None, txt, "Error in action '{}'".format(self.f.__name__))
         raise _HandledException(txt)
コード例 #32
0
    def detailsButtonClicked(self):
        changedList = QStringList()
        (install, remove, unauthenticated) = self._deb.required_changes
        for i in install:
            changedList.append(_("To be installed: %s") % i)
        for r in remove:
            changedList.append(_("To be removed: %s") % r)

        KMessageBox.informationList(
            self,
            _("<b>To install the following changes are required:</b>"),
            changedList, _("Details"))
コード例 #33
0
 def remove_key_clicked(self):
   """Remove a trusted software vendor key"""
   item = self.userinterface.treeview2.currentItem()
   if item == None:
       return
   key = item.text(0)
   if not self.remove_key(key[:8]):
     title = _("Error removing the key")
     text = _("The key you selected could not be removed. "
              "Please report this as a bug.")
     KMessageBox.sorry(self.userinterface, utf8(text), utf8(title))
   self.show_keys()
コード例 #34
0
ファイル: actions.py プロジェクト: Alwnikrotikz/lilykde
 def email(self, updatedFiles, warnpreview=False):
     """
     Collects updated files and provides a nice dialog to send them.
     If warnpreview, the user is warned because he/she would send a PDF
     with point-and-click links in it. The PDFs are MUCH larger in that case.
     """
     if os.path.exists(updatedFiles.lyfile):
         EmailDialog(self.mainwin, updatedFiles, warnpreview).exec_()
     else:
         KMessageBox.sorry(self.mainwin,
             i18n("There are no files to send via email."),
             i18n("No files to send"))
コード例 #35
0
ファイル: __init__.py プロジェクト: azat-archive/kate
 def __call__(self):
     try:
         return self.f()
     except _HandledException:
         raise
     except Exception as e:
         txt = "".join(traceback.format_exception(*sys.exc_info()))
         # TODO: Use the i18n() wrapper here. Unfortunately, Python3 currently
         # says "TypeError: i18n(): argument 1 has unexpected type 'str'",
         # and that is rather unfortunate for the catch-all handler.
         KMessageBox.error(None, txt, "Error in action '{}'".format(self.f.__name__))
         raise _HandledException(txt)
コード例 #36
0
ファイル: base.py プロジェクト: hasanakgoz/Pardus-2011-Svn-
    def applyChanges(self):
        ui = self.ui
        connectionName = unicode(ui.lineProfileName.text())
        connections = self.iface.connections(self.lastEditedPackage)

        if (self.isEditBox) or (not connectionName in connections):
            try:
                self.iface.updateConnection(self.lastEditedPackage, connectionName, self.collectDataFromUI())
            except Exception, e:
                KMessageBox.error(self.baseWidget, unicode(e))
                ui.lineProfileName.setFocus()
                return
コード例 #37
0
ファイル: download.py プロジェクト: Alwnikrotikz/lilykde
 def unpackFinished(self, exitCode, exitStatus):
     self.progress.setRange(0, 100)
     self.progress.reset()
     self.enableButtonOk(True)
     if exitStatus == QProcess.NormalExit and exitCode == 0:
         self.status.setText(i18n("Unpacking finished."))
         self.info.lilypond.setText(self.lilypond)
         KDialog.done(self, KDialog.Accepted)
     else:
         self.status.setText(i18n("Unpacking failed."))
         KMessageBox.error(self, i18n("An error occurred:\n\n%1",
             str(self.unpackJob.readAllStandardOutput())))
コード例 #38
0
    def __init__(self, datadir, options, file="", parent=None, name=None,
                 modal=0, fl=0):
        GDebiKDEDialog.__init__(self,parent)
        GDebiCommon.__init__(self,datadir,options,file)
        # load the icon
        self.setWindowIcon(KIcon("application-x-deb"))
        # first, we load all the default descriptions -- pyuic doesn't use
        # gettext as default (FIXME, copy code from language-selector)
        self.textLabel1.setText(_("Package:"))
        self.textLabel1_2.setText(_("Status:"))
        self.detailsButton.setText(_("Details"))
        self.tabWidget2.setTabText(0,_("Description"))
        self.tabWidget2.setTabText(1,_("Details"))
        self.tabWidget2.setTabText(2,_("Included Files"))
        self.cancelButton.setText(__("kdelibs","&Cancel"))
        self.installButton.setText(_("&Install Package"))
        self.downloadButton.setText(_("&Download Package"))
        self.DetailsVersionLabel.setText(_("<b>Version:</b>"))
        self.DetailsMaintainerLabel.setText(_("<b>Maintainer:</b>"))
        self.DetailsPriorityLabel.setText(_("<b>Priority:</b>"))
        self.DetailsSectionLabel.setText(_("<b>Section:</b>"))
        self.DetailsSizeLabel.setText(_("<b>Size:</b>"))
        # translation finished
        self.setDisabled(True)
        self.PackageProgressBar.setEnabled(True)
        self.detailsButton.hide()
        self.downloadButton.hide()
        self.installButton.setIcon(KIcon("dialog-ok"))
        self.cancelButton.setIcon(KIcon("dialog-cancel"))
        self.show()
        self.kapp = KApplication.kApplication() #incidently, this stops it crashing on quit, no idea why, jriddell
        self.kapp.processEvents() #run because openCache takes a while to do its thing
        self.cprogress = CacheProgressAdapter(self.PackageProgressBar)
        if not self.openCache():
            KMessageBox.error(self, '<b>' + self.error_header + '</b><br>' + self.error_body,
                self.error_header)
            sys.exit(1)
        # try to open the file
        if file != "" and os.path.exists(file):
            self.open(file)
        else:
            header = _("The package file does not exist")
            body = _("A nonexistent file has been selected for installation. Please select an existing .deb package file.")
            KMessageBox.error(self, '<b>' + header + '</b><br>' + body, header)
            sys.exit(1)

        self.setEnabled(True)
        self.PackageProgressBar.hide()
        self.connect(self.cancelButton, SIGNAL("clicked()"), self.cancelButtonClicked)
        self.connect(self.installButton, SIGNAL("clicked()"), self.installButtonClicked)
        self.connect(self.downloadButton, SIGNAL("clicked()"), self.downloadButtonClicked)
        self.connect(self.detailsButton, SIGNAL("clicked()"), self.detailsButtonClicked)
コード例 #39
0
ファイル: backup2isp.py プロジェクト: sarahcitrus/backup2isp
    def addBackup(self):
	global backupInstance, config
	text, result = QtGui.QInputDialog.getText(self, 'Add Backup', 'Backup Name:')
	if result:
	  resulttype, result = backupInstance.addBackup( str(text), config.workstation_id, config.workstation_name )
	  if resulttype != "ERROR":
	    KMessageBox.information(None, text + ' added.')
	    self.backupList.addItem(text)
	  else:
	    messagetext = result[0]['message']
	    if messagetext == "":
	      messagetext = result[0]['label']
	    KMessageBox.error(None, messagetext)
コード例 #40
0
ファイル: settings.py プロジェクト: Alwnikrotikz/lilykde
    def installOkularPartRC(self):
        import frescobaldi_app.install

        frescobaldi_app.install.installOkularPartRC()
        config("").writeEntry("configure okularpart", True)
        KMessageBox.information(
            self,
            i18n(
                "The Okular PDF preview has been reconfigured.\n\n"
                "If you already opened the PDF preview, "
                "restart Frescobaldi for the new settings to take effect."
            ),
        )
コード例 #41
0
    def applyChanges(self):
        ui = self.ui
        connectionName = unicode(ui.lineProfileName.text())
        connections = self.iface.connections(self.lastEditedPackage)

        if (self.isEditBox) or (not connectionName in connections):
            try:
                self.iface.updateConnection(self.lastEditedPackage,
                                            connectionName,
                                            self.collectDataFromUI())
            except Exception, e:
                KMessageBox.error(self.baseWidget, unicode(e))
                ui.lineProfileName.setFocus()
                return
コード例 #42
0
    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
コード例 #43
0
ファイル: kde.py プロジェクト: ospalh/kajongg-fork
 def __init__(self, msg, icon=QMessageBox.Information, buttons=KDialog.Ok, caption=None, default=None):
     """buttons is button codes or-ed like KDialog.Ok | KDialog.Cancel. First one is default."""
     self.msg = msg
     self.default = default
     if Internal.field:
         MustChooseKDialog.__init__(self, Internal.field)
         self.setWindowFlags(self.windowFlags() | Qt.WindowStaysOnTopHint)
         if caption:
             caption += ' - Kajongg'
         else:
             caption = 'Kajongg'
         self.setCaption(caption)
         KMessageBox.createKMessageBox(self, icon, msg,
             QStringList(), "", False, KMessageBox.NoExec)
         self.setButtons(KDialog.ButtonCode(buttons))
コード例 #44
0
ファイル: document.py プロジェクト: Alwnikrotikz/lilykde
    def changeLanguage(self, lang):
        """
        Change the LilyPond pitch name language in our document to lang.
        
        This is a bit hairy because LilyPond has a new syntax for this since 2.14,
        \language "name", while the old \include "name.ly" still is supported as well.
        """
        newSyntax = (self.doc.lilyPondVersion() or lilyPondVersion()) >= (2, 13, 38)
        text, start = self.doc.selectionOrDocument()
        try:
            changes, includeCommandChanged = ly.tools.translate(text, lang, start)
        except ly.QuarterToneAlterationNotAvailable:
            KMessageBox.sorry(
                self.doc.app.mainwin,
                i18n(
                    "Can't perform the requested translation.\n\n"
                    "The music contains quarter-tone alterations, but "
                    'those are not available in the pitch language "%1".',
                    lang,
                ),
            )
            return

        # Apply the changes.
        with self.doc.editContext():
            changes.applyToCursor(EditCursor(self.doc.doc))
            if not start and not includeCommandChanged:
                if newSyntax:
                    self.addLineToTop('\\language "{0}"'.format(lang))
                else:
                    self.addLineToTop('\\include "{0}.ly"'.format(lang))
        if start and not includeCommandChanged:
            KMessageBox.information(
                self.doc.app.mainwin,
                "<p>{0}</p>"
                '<p><tt>\\include "{1}.ly"</tt> {2}</p>'
                '<p><tt>\\language "{1}"</tt> {3}</p>'.format(
                    i18n(
                        "The pitch language of the selected text has been "
                        "updated, but you need to manually add the following "
                        "command to your document:"
                    ),
                    lang,
                    i18n("(for LilyPond below 2.14), or"),
                    i18n("(for LilyPond 2.14 and higher.)"),
                ),
                i18n("Pitch Name Language"),
            )
コード例 #45
0
    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)
コード例 #46
0
 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)
コード例 #47
0
    def retry(self, message):
        '''A retry dialog'''

        caption = _('Retry?')

        res = KMessageBox.warningYesNo(self.__mainWindow,message,caption)

        return res == KMessageBox.Yes
コード例 #48
0
 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
コード例 #49
0
 def showReleaseNotes(self):
     # FIXME: care about i18n! (append -$lang or something)
     self.dialogue = QDialog()
     uic.loadUi(self.APPDIR + "/dialog_release_notes.ui", self.dialogue)
     upgradeButton = self.dialogue.buttonBox.button(QDialogButtonBox.Ok)
     upgradeButton.setText(_("Upgrade"))
     upgradeButton.setIcon(KIcon("dialog-ok"))
     cancelButton = self.dialogue.buttonBox.button(QDialogButtonBox.Cancel)
     cancelButton.setIcon(KIcon("dialog-cancel"))
     self.dialogue.setWindowTitle(_("Release Notes"))
     self.dialogue.show()
     if self.new_dist.releaseNotesURI is not None:
         uri = self._expandUri(self.new_dist.releaseNotesURI)
         # download/display the release notes
         # FIXME: add some progress reporting here
         result = None
         try:
             release_notes = urlopen(uri)
             notes = release_notes.read().decode("UTF-8", "replace")
             self.dialogue.scrolled_notes.setText(notes)
             result = self.dialogue.exec_()
         except HTTPError:
             primary = "<span weight=\"bold\" size=\"larger\">%s</span>" % \
                       _("Could not find the release notes")
             secondary = _("The server may be overloaded. ")
             KMessageBox.sorry(None, primary + "<br />" + secondary, "")
         except IOError:
             primary = "<span weight=\"bold\" size=\"larger\">%s</span>" % \
                       _("Could not download the release notes")
             secondary = _("Please check your internet connection.")
             KMessageBox.sorry(None, primary + "<br />" + secondary, "")
         # user clicked cancel
         if result == QDialog.Accepted:
             self.progressDialogue.show()
             return True
     if __name__ == "__main__":
         KApplication.kApplication().exit(1)
     if self.useDevelopmentRelease or self.useProposed:
         #FIXME why does KApplication.kApplication().exit() crash but
         # this doesn't?
         sys.exit()
     return False
コード例 #50
0
    def format_dest_clicked(self):
        item = self.__mainWindow.ui_dest_list.currentItem()
        if not item:
            return
        udi = misc.text_type(item.data(0,Qt.UserRole))

        text = _('Are you sure you want to erase the entire disk?')

        res = KMessageBox.warningYesNo(self.__mainWindow,text)

        if res == KMessageBox.Yes:
            self.__mainWindow.setCursor(Qt.BusyCursor)
            # Disable simultaneous format attempts.. let current finish first
            self.__mainWindow.ui_format_dest.setEnabled(False)
            self.__backend.format(udi)
コード例 #51
0
ファイル: widgets.py プロジェクト: pars-linux/uludag
    def applyChanges(self):
        def collectDataFromUI():
            data = {}

            data["device_id"] = self.device
            data["name"] = self.connectionName
            data["auth"] = "pin"

            if self.pin and self.ui.checkBoxRemember.isChecked():
                data["auth_pin"] = self.pin

            return data

        self.connectionName = str(
            self.ui.comboBoxOperators.itemData(
                self.ui.comboBoxOperators.currentIndex()).toString())

        try:
            self.iface.updateConnection(self.package, self.connectionName,
                                        collectDataFromUI())
            self.accept()
        except Exception, e:
            KMessageBox.error(self, unicode(e))
            return
コード例 #52
0
    def warning_dialog(self):
        '''A warning dialog to show when progress dialog cancel is pressed'''

        caption = _('Quit the installation?')
        text = _('Do you really want to quit the installation now?')

        #hide the progress bar - install will still continue in bg
        self.progress_bar.hide()

        res = KMessageBox.warningYesNo(self.__mainWindow,text,caption)

        if res == KMessageBox.Yes:
            self.abort()

        #user chose not to quit, so re-show progress bar
        self.progress_bar.show()
コード例 #53
0
 def notify(self,title):
     KMessageBox.sorry(self.__mainWindow,title)
コード例 #54
0
 def startup_failure(cls, message):
     KMessageBox.sorry(None, message, "", KMessageBox.Notify)
コード例 #55
0
def _warning(text):
    if type(PYQT_VERSION) == int:
        QMessageBox.warning(None, "", text)
    else:
        KMessageBox.sorry(None, text, "")
コード例 #56
0
 def error(self, summary, message):
     if type(PYQT_VERSION) == int:
         QMessageBox.critical(None, summary, message)
     else:
         KMessageBox.sorry(None, message, summary)