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
예제 #2
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)
 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()
예제 #4
0
 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"))
 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.")
예제 #6
0
    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"),
            )
 def add_key_clicked(self):
   """Provide a file chooser that allows to add the gnupg of a trusted
      software vendor"""
   home = QDir.homePath()
   if "SUDO_USER" in os.environ:
       home = os.path.expanduser("~%s" % os.environ["SUDO_USER"])
   url = KUrl.fromPath(home)
   filename = KFileDialog.getOpenFileName(url, 'application/pgp-keys', self.userinterface, utf8(_("Import key")))
   if filename:
     if not self.add_key(filename):
       title = _("Error importing selected file")
       text = _("The selected file may not be a GPG key file " \
               "or it might be corrupt.")
       KMessageBox.sorry(self.userinterface,
             utf8(text),
             utf8(title))
     self.show_keys()
예제 #8
0
def convertLy(mainwin):
    """
    Run the current document through convert-ly.
    """
    doc = mainwin.currentDocument()
    text = doc.text()
    docVersion = ly.version.getVersion(text)
    lilyVersion = ly.version.LilyPondInstance(lilyPondCommand()).version()
    
    if not docVersion:
        KMessageBox.sorry(mainwin, i18n(
            "Can't determine the LilyPond version of the current document."
            " Please add a \\version statement with the correct version."))
    elif not lilyVersion:
        KMessageBox.sorry(mainwin, i18n(
            "Can't determine the version of LilyPond. "
            "Please check your LilyPond installation."))
    elif docVersion >= lilyVersion:
        KMessageBox.information(mainwin, i18n(
            "This LilyPond document is already up-to-date."))
    else:
        # Ok, let's run convert-ly.
        # We add the from-version. Only in that case convert-ly wants to
        # read from stdin.
        try:
            out, err = Popen(
                (convertLyCommand(), "-f", str(docVersion), "-"),
                stdin=PIPE, stdout=PIPE, stderr=PIPE
                ).communicate(text.encode('utf8'))
            if out:
                doc.setText("{0}\n\n%{{\n{1}\n%}}\n".format(out.decode('utf8'), err.decode('utf8')))
                KMessageBox.information(mainwin, i18n(
                 "The document has been processed with convert-ly. You'll find "
                 "the messages of convert-ly in a comment block at the end. "
                 "You still may have to edit some parts manually."))
            else:
                msg = "<br><br>" + err.decode('utf8').replace('\n', '<br>')
                KMessageBox.information(mainwin, i18n(
                 "The document has been processed with convert-ly, but "
                 "remained unchanged. This is the message given by "
                 "convert-ly: %1", msg))
        except OSError as e:
            msg = unicode(e)
            KMessageBox.error(mainwin, i18n("Could not start convert-ly: %1", msg))
  def on_button_add_cdrom_clicked(self):
    '''Show a dialog that allows to add a repository located on a CDROM
       or DVD'''
    # testing
    #apt_pkg.Config.Set("APT::CDROM::Rename","true")

    saved_entry = apt_pkg.Config.Find("Dir::Etc::sourcelist")
    tmp = tempfile.NamedTemporaryFile()
    apt_pkg.Config.Set("Dir::Etc::sourcelist",tmp.name)
    progress = CdromProgress(self.datadir, self, kapp)
    cdrom = apt_pkg.GetCdrom()
    # if nothing was found just return
    try:
      res = cdrom.Add(progress)
    except SystemError, msg:
      title = _("CD Error")
      text = _("<big><b>Error scanning the CD</b></big>\n\n%s")%msg
      KMessageBox.sorry(self.userinterface, utf8(text), utf8(title))
      return
예제 #10
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
예제 #11
0
 def print_(self, updatedFiles):
     """
     Print updated PDF files.
     
     If there are no updated PDF's a warning is displayed.
     If there is one updated PDF, the print dialog is displayed.
     If there is more than one PDF, a dialog is displayed to select the
     files to print.
     """
     pdfs = updatedFiles("pdf")
     if not pdfs:
         KMessageBox.sorry(self.mainwin, i18n(
             "There are no PDF documents to print.\n\n"
             "You probably need to run LilyPond to create or update a "
             "PDF document. If you are creating MIDI files, be sure you "
             "also put a \layout { } section in your score, otherwise "
             "LilyPond will not create a PDF."),
             i18n("No files to print"))
     elif len(pdfs) == 1:
         printPDF(pdfs[0], self.mainwin)
     else:
         PrintSelectDialog(self.mainwin, pdfs).exec_()
예제 #12
0
    def transpose(self):
        """
        Transpose all or selected pitches.
        """
        text, start = self.doc.selectionOrDocument()

        # determine the language and key signature
        language, keyPitch = ly.tools.languageAndKey(text)

        # present a dialog
        dlg = self.transposeDialog()
        dlg.setLanguage(language)
        dlg.setInitialPitch(keyPitch)
        if not dlg.exec_():
            return
        transposer = dlg.transposer()
        if not transposer:
            KMessageBox.sorry(
                self.doc.app.mainwin,
                i18n(
                    "Could not understand the entered pitches.\n\n"
                    'Please make sure you use pitch names in the language "%1".',
                    language,
                ),
            )
            return
        try:
            ly.tools.transpose(text, transposer, start).applyToCursor(EditCursor(self.doc.doc))
        except ly.QuarterToneAlterationNotAvailable:
            KMessageBox.sorry(
                self.doc.app.mainwin,
                i18n(
                    "Can't perform the requested transposition.\n\n"
                    "The transposed music would contain quarter-tone alterations "
                    'that are not available in the pitch language "%1".',
                    language,
                ),
            )
예제 #13
0
def hyphenate(text, mainwindow):
    """
    Ask the user which language to use.
    Returns None if the user cancels the dialog or no hyphenation pattern files
    could be found.
    """
    if not hyphdicts:
        KMessageBox.sorry(mainwindow, i18n(
            "Could not find any hyphenation dictionaries.\n\n"
            "Please install a package containing some and/or or configure the "
            "search path to find them in the Frescobaldi settings under "
            "\"Paths.\""))
        return
    
    conf = config("hyphenation")
    lang = conf.readEntry("lastused", "")
    langs = list(sorted(hyphdicts.keys()))
    index = lang in langs and langs.index(lang) or 0
    
    d = KDialog(mainwindow)
    d.setButtons(KDialog.ButtonCode(KDialog.Ok | KDialog.Cancel | KDialog.Help))
    d.setCaption(i18n("Hyphenate Lyrics Text"))
    d.setHelp("lyrics")
    layout = QVBoxLayout()
    d.mainWidget().setLayout(layout)
    layout.addWidget(QLabel(i18n("Please select a language:")))
    listbox = QListWidget()
    layout.addWidget(listbox)
    listbox.addItems(langs)
    listbox.setCurrentRow(index)
    listbox.setFocus()
    if d.exec_():
        lang = langs[listbox.currentRow()]
        conf.writeEntry("lastused", lang)
        conf.sync()
        # get hyphenator
        h = Hyphenator(hyphdicts[lang])
        return ly.rx.lyric_word.sub(lambda m: h.inserted(m.group(), ' -- '), text)
예제 #14
0
def insertVersion(mainwin):
    """
    Insert the current LilyPond version into the current document
    if it does not already have a version command.
    """
    doc = mainwin.currentDocument()
    for token in ly.tokenize.LineColumnTokenizer().tokens(doc.text()):
        if token == "\\version":
            doc.view.setCursorPosition(KTextEditor.Cursor(token.line, token.column))
            KMessageBox.sorry(mainwin,
                i18n("Your document has already a LilyPond version statement."),
                i18n("Version already set"))
            return
    else:
        lilypond = mainwin.sessionManager().lilyPondCommand()
        version = (lilypond and ly.version.LilyPondInstance(lilypond).version()
                            or defaultVersion())
        if version:
            doc.doc.insertLine(0, '\\version "{0}"'.format(version))
        else:
            KMessageBox.sorry(mainwin,
                i18n("Can't determine the version of LilyPond. "
                     "Please check your LilyPond installation."))
예제 #15
0
def _warning(text):
    if type(PYQT_VERSION) == int:
        QMessageBox.warning(None, "", text)
    else:
        KMessageBox.sorry(None, text, "")
예제 #16
0
 def error(self, summary, message):
     if type(PYQT_VERSION) == int:
         QMessageBox.critical(None, summary, message)
     else:
         KMessageBox.sorry(None, message, summary)
예제 #17
0
 def error(self, summary, message):
     KMessageBox.sorry(None, message, summary)
예제 #18
0
    def installButtonClicked(self):
        # if not root, start a new instance
        if os.getuid() != 0:
            if os.path.exists("gdebi-kde"):
                executable = os.path.curdir + "/gdebi-kde"
            else:
                executable = "/usr/bin/gdebi-kde"
            su_cmd = "/usr/bin/kdesudo"
            if not os.access(su_cmd, os.X_OK):
                su_cmd = "/usr/lib/kde4/libexec/kdesu"
            os.execl(su_cmd, os.path.basename(su_cmd), executable, "--", "-n", self._deb.filename)
            self.kapp.exit()

        if not self.try_acquire_lock():
            KMessageBox.error(self, '<b>' + self.error_header + '</b><br>' + self.error_body, self.error_header)
            return False
        if not self.try_acquire_lock():
            KMessageBox.error(self, '<b>' + self.error_header + '</b><br>' + self.error_body, self.error_header)
            return False
        # set the window as disabled
        self.setDisabled(True)
        self.installDialog = GDebiKDEInstall(self)
        self.installDialog.show()

        # FIXME: use the new python-apt acquire interface here,
        # or rather use it in the apt module and raise exception
        # when stuff goes wrong!
        if len(self.install) > 0 or len(self.remove) > 0:
            #if not self.acquire_lock():
            if not self.acquire_lock():
                #self.show_alert(Gtk.MessageType.ERROR, self.error_header, self.error_body)
                KMessageBox.sorry(self, '<b>' + self.error_header + '</b><br>' + self.error_body, self.error_header)
                return False
            fprogress = KDEFetchProgressAdapter(self.installDialog.installationProgress,
                                                self.installDialog.installingLabel,
                                                self.installDialog)
            iprogress = KDEInstallProgressAdapter(self.installDialog.installationProgress,
                                                  self.installDialog.installingLabel,
                                                  self.installDialog)
            self.installDialog.konsole.setInstallProgress(iprogress)
            #errMsg = None
            try:
                res = self._cache.commit(fprogress,iprogress)
            except IOError as msg:
                res = False
                #errMsg = "%s" % msg
                header = _("Could not download all required files")
                body = _("Please check your internet connection or "
                            "installation medium.")
            except SystemError as msg:
                logging.warn("error: %s" % msg)
                res = False
                header = _("Could not install all dependencies")
                body = _("Usually this is related to an error of the "
                        "software distributor. See the terminal window for "
                        "more details.")
            if not res:
                #print "something bad happend"
                self.errorReport = KMessageBox.error(self, header + "<br>" + body, header)
                return

        # install the package itself
        #self.label_action.set_markup("<b><big>"+_("Installing package file")+"</big></b>")
        dprogress = KDEDpkgInstallProgress(self._deb.filename,
                                             self.installDialog.installingLabel,
                                             self.installDialog.installationProgress,
                                             self.installDialog.konsole, self.installDialog)
        dprogress.commit()
        #self.label_action.set_markup("<b><big>"+_("Package installed")+"</big></b>")
        # show the button
        #self.button_deb_install_close.set_sensitive(True)
        #self.button_deb_install_close.grab_default()
        self.installDialog.setWindowTitle(_("Installation finished"))
        if dprogress.exitstatus == 0:
            self.installDialog.installingLabel.setText(_("<b>" + "Package '%s' was installed" + "</b>") % self._deb.pkgname)
        else:
            self.installDialog.installingLabel.setText("<b>"+_("Failed to install package '%s'") % os.path.basename(self._deb.filename)+"</b>")
            self.installDialog.konsoleFrame.show()
        #self.statusbar_main.push(self.context,_("Installation complete"))
        # FIXME: Doesn't stop notifying
        #self.window_main.set_property("urgency-hint", 1)

        # reopen the cache, reread the file, FIXME: add progress reporting
        #self._cache = Cache(self.cprogress)
        self._cache = Cache()
        if self._cache._depcache.broken_count > 0:
            header = _("Failed to completely install all dependencies")
            text = _("To fix this run 'sudo apt-get install -f' in a "
                         "terminal window.")
            self.errorReport = KMessageBox.error(self, header + text, header)
            sys.exit(1)
예제 #19
0
 def error(self, summary, message):
     if type(PYQT_VERSION) == int:
         QMessageBox.critical(None, summary, message)
     else:
         KMessageBox.sorry(None, message, summary)
    def installButtonClicked(self):
        # if not root, start a new instance
        if os.getuid() != 0:
            if os.path.exists("gdebi-kde"):
                executable = os.path.curdir + "/gdebi-kde"
            else:
                executable = "/usr/bin/gdebi-kde"
            su_cmd = "/usr/bin/kdesudo"
            if not os.access(su_cmd, os.X_OK):
                su_cmd = "/usr/lib/kde4/libexec/kdesu"
            os.execl(su_cmd, os.path.basename(su_cmd), executable, "--", "-n",
                     self._deb.filename)
            self.kapp.exit()

        if not self.try_acquire_lock():
            KMessageBox.error(
                self, '<b>' + self.error_header + '</b><br>' + self.error_body,
                self.error_header)
            return False
        if not self.try_acquire_lock():
            KMessageBox.error(
                self, '<b>' + self.error_header + '</b><br>' + self.error_body,
                self.error_header)
            return False
        # set the window as disabled
        self.setDisabled(True)
        self.installDialog = GDebiKDEInstall(self)
        self.installDialog.show()

        # FIXME: use the new python-apt acquire interface here,
        # or rather use it in the apt module and raise exception
        # when stuff goes wrong!
        if len(self.install) > 0 or len(self.remove) > 0:
            #if not self.acquire_lock():
            if not self.acquire_lock():
                #self.show_alert(Gtk.MessageType.ERROR, self.error_header, self.error_body)
                KMessageBox.sorry(
                    self,
                    '<b>' + self.error_header + '</b><br>' + self.error_body,
                    self.error_header)
                return False
            fprogress = KDEFetchProgressAdapter(
                self.installDialog.installationProgress,
                self.installDialog.installingLabel, self.installDialog)
            iprogress = KDEInstallProgressAdapter(
                self.installDialog.installationProgress,
                self.installDialog.installingLabel, self.installDialog)
            self.installDialog.konsole.setInstallProgress(iprogress)
            #errMsg = None
            try:
                res = self._cache.commit(fprogress, iprogress)
            except IOError as msg:
                res = False
                #errMsg = "%s" % msg
                header = _("Could not download all required files")
                body = _("Please check your internet connection or "
                         "installation medium, or make sure your "
                         "APT cache is up-to-date.")
            except SystemError as msg:
                logging.warning("error: %s" % msg)
                res = False
                header = _("Could not install all dependencies")
                body = _("Usually this is related to an error of the "
                         "software distributor. See the terminal window for "
                         "more details.")
            if not res:
                #print "something bad happend"
                self.errorReport = KMessageBox.error(self,
                                                     header + "<br>" + body,
                                                     header)
                return

        # install the package itself
        #self.label_action.set_markup("<b><big>"+_("Installing package file")+"</big></b>")
        dprogress = KDEDpkgInstallProgress(
            self._deb.filename, self.installDialog.installingLabel,
            self.installDialog.installationProgress,
            self.installDialog.konsole, self.installDialog)
        dprogress.commit()
        #self.label_action.set_markup("<b><big>"+_("Package installed")+"</big></b>")
        # show the button
        #self.button_deb_install_close.set_sensitive(True)
        #self.button_deb_install_close.grab_default()
        self.installDialog.setWindowTitle(_("Installation finished"))
        if dprogress.exitstatus == 0:
            self.installDialog.installingLabel.setText(
                _("<b>" + "Package '%s' was installed" + "</b>") %
                self._deb.pkgname)
        else:
            self.installDialog.installingLabel.setText(
                "<b>" + _("Failed to install package '%s'") %
                os.path.basename(self._deb.filename) + "</b>")
            self.installDialog.konsoleFrame.show()
        #self.statusbar_main.push(self.context,_("Installation complete"))
        # FIXME: Doesn't stop notifying
        #self.window_main.set_property("urgency-hint", 1)

        # reopen the cache, reread the file, FIXME: add progress reporting
        #self._cache = Cache(self.cprogress)
        self._cache = Cache()
        if self._cache._depcache.broken_count > 0:
            header = _("Failed to completely install all dependencies")
            text = _("To fix this run 'sudo apt-get install -f' in a "
                     "terminal window.")
            self.errorReport = KMessageBox.error(self, header + text, header)
            sys.exit(1)
예제 #21
0
def _warning(text):
    if type(PYQT_VERSION) == int:
        QMessageBox.warning(None, "", text)
    else:
        KMessageBox.sorry(None, text, "")
예제 #22
0
 def startup_failure(cls, message):
     KMessageBox.sorry(None, message, "", KMessageBox.Notify)
예제 #23
0
 def notify(self,title):
     KMessageBox.sorry(self.__mainWindow,title)
    gettext.bindtextdomain("language-selector", "/usr/share/locale")
    gettext.textdomain("language-selector")

    app = KApplication()

    args = KCmdLineArgs.parsedArgs()

    if args.isSet("mode"):
        whattodo = args.getOption("mode")
        if whattodo in ["install", "uninstall", "select"]:
            pass
        else:
            print whattodo, "is not a valid argument"
            args.usage()
    else:
        print "Please review the usage."
        args.usage()

    if os.getuid() != 0:
        KMessageBox.sorry(None, _("Please run this software with administrative rights."),  _("Not Root User"))
        sys.exit(1)

    lc = QtLanguageSelector("/usr/share/language-selector/")

    lc.show()

    app.exec_()

# kate: space-indent on; indent-width 4; mixedindent off; indent-mode python;