Пример #1
0
    def build_menu(self):
        if ConfigManager.SETTINGS[SHOW_TRAY_ICON]:
            # Get phrase folders to add to main menu
            folders = []
            items = []

            for folder in self.configManager.allFolders:
                if folder.showInTrayMenu:
                    folders.append(folder)
            
            for item in self.configManager.allItems:
                if item.showInTrayMenu:
                    items.append(item)
                    
            # Construct main menu
            menu = popupmenu.PopupMenu(self.app.service, folders, items, False, "AutoKey")
            if len(items) > 0:
                menu.addSeparator()
            
            self.toggleAction = KToggleAction(i18n("&Enable Monitoring"), menu)
            self.toggleAction.connect(self.toggleAction, SIGNAL("triggered()"), self.on_enable_toggled)
            self.toggleAction.setChecked(self.app.service.is_running())
            self.toggleAction.setEnabled(not self.app.serviceDisabled)           
            
            menu.addAction(self.toggleAction)
            menu.addAction(KIcon("edit-clear"), i18n("&Hide Icon"), self.on_hide_icon)
            menu.addAction(KIcon("configure"), i18n("&Show Main Window"), self.on_configure)
            menu.addAction(KStandardAction.quit(self.on_quit, menu))
            self.icon.setContextMenu(menu)
Пример #2
0
    def execute(self):
        if self.__class__.screenSettings["profileSend"]:
            self.__class__.screenSettings["summaryMessage"] = kdecore.i18n("Yes")
        else:
            self.__class__.screenSettings["summaryMessage"] = kdecore.i18n("No")

        return True
Пример #3
0
    def showBasket(self):

        if self.basket.isVisible():
            return

        waitCursor()
        self.statusUpdater.wait()

        if self.currentState == self.state.ALL:
            action = {self.__remove_action:self.state.REMOVE,
                      self.__install_action:self.state.INSTALL}.get(self.sender(), self.state.INSTALL)
            if action:
                if action == self.state.REMOVE:
                    installed_packages = self.state.iface.getInstalledPackages()
                    filtered_packages = filter(lambda x: x not in installed_packages, self.basket.model.selectedPackages())
                    if filtered_packages == self.basket.model.selectedPackages():
                        restoreCursor()
                        QMessageBox(i18n("Select packages"),
                                    i18n("You must select at least one installed package"),
                                    QMessageBox.Information, QMessageBox.Ok, 0, 0).exec_()
                        return
                    self.packageList.model().sourceModel().selectPackages(filtered_packages, state = False)
                self.state.state = action

        self.basket._show()
        restoreCursor()
Пример #4
0
    def __init__(self, parent):
        KDialog.__init__(self, parent)
        self.setCaption(i18n("Transpose"))
        self.setHelp("transpose")
        self.setButtons(KDialog.ButtonCode(KDialog.Ok | KDialog.Cancel | KDialog.Help))
        self.language = ""
        self.initialPitchSet = False
        w = self.mainWidget()
        w.setLayout(QtGui.QGridLayout())
        l = QtGui.QLabel(i18n("Please enter a start pitch and a destination pitch:"))
        w.layout().addWidget(l, 0, 0, 1, 4)
        self.fromPitch = QtGui.QComboBox()
        self.toPitch = QtGui.QComboBox()
        l = QtGui.QLabel(i18n("Transpose from:"))
        l.setBuddy(self.fromPitch)
        w.layout().addWidget(l, 1, 0, QtCore.Qt.AlignRight)
        w.layout().addWidget(self.fromPitch, 1, 1)
        l = QtGui.QLabel(i18n("to:"))
        l.setBuddy(self.toPitch)
        w.layout().addWidget(l, 1, 2, QtCore.Qt.AlignRight)
        w.layout().addWidget(self.toPitch, 1, 3)

        for c in self.fromPitch, self.toPitch:
            c.setEditable(True)
            c.setInsertPolicy(QtGui.QComboBox.NoInsert)
            c.setCompleter(None)
        self.fromPitch.setModel(self.toPitch.model())
Пример #5
0
 def edit(self, name=None):
     """Edit the named or new (if not given) session."""
     # load the session
     self._originalName = name
     if name:
         self.setCaption(i18n("Edit session: %1", name))
         self.name.setText(name)
         conf = self.sm.config(name)
         self.autosave.setChecked(conf.readEntry("autosave", True))
         self.basedir.setUrl(KUrl(conf.readPathEntry("basedir", "")))
         self.loadSessionConfig(conf)
     else:
         self.setCaption(i18n("Edit new session"))
         self.name.clear()
         self.name.setFocus()
         self.autosave.setChecked(True)
         self.basedir.setUrl(KUrl())
         self.loadSessionDefaults()
     self.setCurrentPage(self.firstPage)
     if self.exec_():
         # save
         name = self.name.text()
         if self._originalName and name != self._originalName:
             self.sm.renameSession(self._originalName, name)
         conf = self.sm.config(name)
         conf.writeEntry("autosave", self.autosave.isChecked())
         conf.writePathEntry("basedir", self.basedir.url().path())
         self.saveSessionConfig(conf)
         return name
Пример #6
0
 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")
Пример #7
0
 def __init__(self, mainwin, pdfs):
     KDialog.__init__(self, mainwin)
     self.mainwin = mainwin
     self.setAttribute(Qt.WA_DeleteOnClose)
     self.setButtons(KDialog.ButtonCode(
         KDialog.User1 | KDialog.Ok | KDialog.Cancel))
     self.setButtonGuiItem(KDialog.Ok, KStandardGuiItem.print_())
     self.setButtonIcon(KDialog.User1, KIcon("edit-select-all"))
     self.setButtonText(KDialog.User1, i18n("Select all"))
     self.setCaption(i18n("Print documents"))
     b = KVBox(self)
     b.setSpacing(4)
     QLabel(i18n("Please select the files you want to print:"), b)
     fileList = QListWidget(b)
     fileList.setIconSize(QSize(22, 22))
     fileList.setWhatsThis(i18n(
         "These are the PDF documents that are up-to-date (i.e. newer than "
         "the LilyPond source document). "
         "Check the documents you want to send to the printer."))
     
     for pdf in pdfs:
         i = QListWidgetItem(KIcon("application-pdf"), os.path.basename(pdf),
             fileList)
         i.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable |
             Qt.ItemIsUserCheckable)
         i.setCheckState(Qt.Unchecked)
     
     fileList.item(0).setCheckState(Qt.Checked)
     self.fileList = fileList
     self.setMainWidget(b)
     self.resize(350, 200)
     self.pdfs = pdfs
     self.user1Clicked.connect(self.selectAll)
Пример #8
0
    def slotItemDelete(self):
        """
            Delete button clicked.
        """
        widget = self.sender()
        if widget.getType() == "user":
            uid = widget.getId()
            username = widget.getTitle()
            fullname = widget.getDescription()

            # If the user is logged in display warning, else delete user
            if self.userLoggedOn(username):
                message = kdecore.i18n("Cannot delete <b>%1</b>. The user is currently logged in.", username)
                kdeui.KMessageBox.sorry(self, message, 'Message')
            else:
                dialog = DialogQuestion(self)
                dialog.setQuestion(kdecore.i18n("Do you want to delete user '%1' (%2)?", fullname, username))
                dialog.setCheckBox(kdecore.i18n("Also remove user files. (This may take long.)"))
                if dialog.exec_():
                    self.callIface(lambda: self.iface.deleteUser(uid, deleteFiles=dialog.getCheckBox()))
                    # User.Manager does not emit signals, refresh whole list.
                    self.buildItemList()
        else:
            gid = widget.getId()
            groupname = widget.getTitle()
            if kdeui.KMessageBox.questionYesNo(self, kdecore.i18n("Do you want to delete group '%1'?", groupname)) == kdeui.KMessageBox.Yes:
                self.callIface(lambda: self.iface.deleteGroup(gid))
                # User.Manager does not emit signals, refresh whole list.
                self.buildItemList()
Пример #9
0
    def showEditBox(self, id_, type_):
        """
            Shows edit box.
        """
        self.typeEdit = type_
        if type_ == "user":
            # Reset fields
            self.widgetUserEdit.reset()

            if id_ != None:
                try:
                    username, fullname, gid, homedir, shell, groups = self.iface.userInfo(id_)
                except Exception, e: # TODO: Named exception should be raised
                    if "Comar.PolicyKit" in e._dbus_error_name:
                        kdeui.KMessageBox.error(self, kdecore.i18n("Access denied."))
                    else:
                        kdeui.KMessageBox.error(self, unicode(e))
                    return
                self.widgetUserEdit._new = False
                self.widgetUserEdit.setId(id_)
                self.widgetUserEdit.setUsername(username)
                self.widgetUserEdit.setFullname(fullname)
                self.widgetUserEdit.setHomeDir(homedir)
                self.widgetUserEdit.setShell(shell)
                self.widgetUserEdit.setGroups(self.all_groups, groups)
                try:
                    self.widgetUserEdit.setAuthorizations(self.iface.getAuthorizations(id_))
                except Exception, e: # TODO: Named exception should be raised
                    if "Comar.PolicyKit" in e._dbus_error_name:
                        kdeui.KMessageBox.error(self, kdecore.i18n("Access denied."))
                    else:
                        kdeui.KMessageBox.error(self, unicode(e))
                    return
Пример #10
0
    def setupActions(self):
        self._editAction = QAction(KIcon('document-properties'),
            i18n('&Edit Translation'), self)
        self._editAction.setShortcut(Qt.Key_Return)
        self._editAction.setShortcutContext(Qt.WidgetShortcut)
        self.connect(self._editAction, SIGNAL("triggered(bool)"),
            lambda: self.vocabularyListView.edit(
                self.vocabularyListView.currentIndex()))
        self.connect(self.vocabularyListView, SIGNAL("returnPressed()"),
            self._editAction.trigger) # TODO

        self._selectAllAction = KStandardAction.selectAll(
            self.vocabularyListView.selectAll, self)

        self._removeAction = QAction(KIcon('list-remove'),
            i18n('&Remove Selected'), self)
        #c = QShortcut(self)
        #c.setKey(Qt.Key_Delete)
        #c.setContext(Qt.WidgetShortcut)
        #self.connect(c, SIGNAL("activated()"), self._removeAction.trigger)
        self._removeAction.setShortcut(Qt.Key_Delete)
        self._removeAction.setShortcutContext(Qt.WidgetShortcut)
        self.connect(self.vocabularyListView, SIGNAL("deletePressed()"),
            self._removeAction.trigger) # TODO
        self.connect(self.vocabularyListView.selectionModel(),
            SIGNAL("selectionChanged(const QItemSelection &, const QItemSelection &)"),
            lambda: self._removeAction.setEnabled(
                self.vocabularyListView.selectionModel().hasSelection()))
        self.connect(self._removeAction, SIGNAL("triggered(bool)"),
            lambda: self.vocabularyModel.remove(
                self.vocabularyListView.selectedIndexes()))
Пример #11
0
 def addActionsToMenu(self, updatedFiles, menu):
     """
     Queries updatedFiles() and adds corresponding actions to the menu.
     """
     # PDFs
     pdfs = updatedFiles("pdf")
     for pdf in pdfs:
         name = '"{0}"'.format(os.path.basename(pdf))
         a = menu.addAction(KIcon("application-pdf"),
             i18n("Open %1 in external viewer", name))
         a.triggered.connect((lambda pdf: lambda: self.openPDF(pdf))(pdf))
     if pdfs:
         menu.addSeparator()
     # MIDIs
     midis = updatedFiles("mid*")
     for midi in midis:
         name = '"{0}"'.format(os.path.basename(midi))
         a = menu.addAction(KIcon("media-playback-start"), i18n("Play %1", name))
         a.triggered.connect((lambda midi: lambda: self.openMIDI(midi))(midi))
     if not pdfs and not midis:
         a = menu.addAction(
             i18n("(No up-to-date MIDI or PDF files available.)"))
         a.setToolTip(i18n(
             "There are no up-to-date MIDI or PDF files available. "
             "Please run LilyPond to create one or more output files."))
     else:
         addAccelerators(menu.actions())
Пример #12
0
 def getBasketExtrasInfo(self):
     return {
         self.INSTALL: i18n("Extra dependencies of the selected package(s) that are also going to be installed:"),
         self.REMOVE: i18n("Reverse dependencies of the selected package(s) that are also going to be removed:"),
         self.UPGRADE: i18n("Extra dependencies of the selected package(s) that are also going to be upgraded:"),
         self.ALL: i18n("Extra dependencies of the selected package(s) that are also going to be modified:"),
     }[self.state]
Пример #13
0
 def getBasketInfo(self):
     return {
         self.INSTALL: i18n("You have selected the following package(s) to install:"),
         self.REMOVE: i18n("You have selected the following package(s) to removal:"),
         self.UPGRADE: i18n("You have selected the following package(s) to upgrade:"),
         self.ALL: i18n("You have selected the following package(s) to modify:"),
     }[self.state]
Пример #14
0
 def onTypeFilterChanged(self):
     action = self.sender()
     nepomukType = action.property("nepomukType")
     
     self.typeUri = QUrl(nepomukType.toString())
    
     label = nepomukType.toString()
     label = unicode(label)
     
     if self.typeUri == Soprano.Vocabulary.RDFS.Resource():
         label = i18n("All")
     elif label.find("#") > 0:
         label = label[label.find("#") + 1:]
         if label == "FileDataObject":
             label = "File"
         elif label == "TextDocument":
             label = "File"
         #return a QString instead of a str for the proxy model, which handles only QString
         
     elif label.find("nepomuk:/") == 0:
         #this is a custom type, we need to get the label of the ressource
         typeResource = Nepomuk.Resource(label)
         label = typeResource.genericLabel()
     else:
         label = label[label.rfind("/") + 1:]
     
     self.typeFilterButton.setText(i18n(label))
    
     self.searchMatchingItems()
Пример #15
0
 def changed(self):
     """ Call this when this item needs to redisplay itself. """
     lp = self.lilypond
     lilypond = ly.version.LilyPondInstance(lp)
     if lilypond.version():
         lp += " ({0})".format(lilypond.version())
         self.setIcon(KIcon("run-lilypond"))
         self.setToolTip(
             "<table border=0><tbody>"
             "<tr><td><b>{0}: </b></td><td>{1}</td></tr>"
             "<tr><td><b>{2}: </b></td><td>{3}</td></tr>"
             "</tbody></table>".format(i18n("Path"), lilypond.command() or "", i18n("Version"), lilypond.version())
         )
     else:
         self.setIcon(KIcon("dialog-error"))
         self.setToolTip(i18n("Can't determine LilyPond version."))
     if self.default:
         lp += " [{0}]".format(i18n("default"))
         # reset the default state for others
         for c in range(self.listWidget().count()):
             item = self.listWidget().item(c)
             if item is not self and item.default:
                 item.default = False
                 item.changed()
     self.setText(lp)
Пример #16
0
    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"))
Пример #17
0
    def assignSelectionToVariable(self):
        """
        Cuts out selected text and stores it under a variable name, adding a
        reference to that variable in the original place.
        There MUST be a selection.
        """
        # ask the variable name
        name = promptText(
            self.doc.app.mainwin,
            i18n("Please enter the name for the variable to assign the selected " "text to:"),
            i18n("Cut and Assign"),
            rx="[a-zA-Z]*",
            help="cut-assign",
        )
        if not name:
            return

        # find out in what input mode we are
        mode = ""
        selRange = self.doc.view.selectionRange()  # copy othw. crash in KDE 4.3 /PyQt 4.5.x.
        text = self.doc.textToCursor(selRange.start())
        tokenizer = ly.tokenize.Tokenizer()
        for token in tokenizer.tokens(text):
            pass
        for s in reversed(tokenizer.state):
            if isinstance(s, tokenizer.InputModeParser):
                if isinstance(s, tokenizer.LyricModeParser):
                    mode = " \\lyricmode"
                elif isinstance(s, tokenizer.ChordModeParser):
                    mode = " \\chordmode"
                elif isinstance(s, tokenizer.FigureModeParser):
                    mode = " \\figuremode"
                break

        currentLine = selRange.start().line()
        insertLine = self.findInsertPoint(currentLine)

        text = self.doc.selectionText().strip()
        if "\n" in text:
            result = "{0} ={1} {{\n{2}\n}}\n".format(name, mode, text)
            result = self.doc.indent(result)
        else:
            result = "{0} ={1} {{ {2} }}\n".format(name, mode, text)

        if not isblank(self.doc.line(insertLine)):
            result += "\n"
        if insertLine > 0 and not isblank(self.doc.line(insertLine - 1)):
            result = "\n" + result

        # add space if necessary
        variable = "\\" + name
        end = selRange.end()
        if not isblank(self.doc.line(end.line())[end.column() : end.column() + 1]):
            variable += " "

        # do it:
        cursor = KTextEditor.Cursor(insertLine, 0)
        with self.doc.editContext():
            self.doc.replaceSelectionWith(variable, keepSelection=False)
            self.doc.doc.insertText(cursor, result)
Пример #18
0
 def __init__(self, manager):
     super(EditorDialog, self).__init__(manager.mainwin)
     self.mainwin = manager.mainwin
     self.sm = manager
     self.setButtons(KDialog.ButtonCode(
         KDialog.Help | KDialog.Ok | KDialog.Cancel))
     self.setFaceType(KPageDialog.List)
     self.setHelp("sessions")
     
     # First page with name and auto-save option
     page = QWidget(self)
     item = self.firstPage = self.addPage(page, i18n("Session"))
     item.setHeader(i18n("Properties of this session"))
     item.setIcon(KIcon("configure"))
     
     layout = QGridLayout(page)
     
     l = QLabel(i18n("Name:"))
     self.name = QLineEdit()
     l.setBuddy(self.name)
     layout.addWidget(l, 0, 0)
     layout.addWidget(self.name, 0, 1)
     
     self.autosave = QCheckBox(i18n(
         "Always save the list of documents in this session"))
     layout.addWidget(self.autosave, 1, 1)
     
     l = QLabel(i18n("Base directory:"))
     self.basedir = KUrlRequester()
     self.basedir.setMode(KFile.Mode(
         KFile.Directory | KFile.ExistingOnly | KFile.LocalOnly))
     l.setBuddy(self.basedir)
     layout.addWidget(l, 2, 0)
     layout.addWidget(self.basedir, 2, 1)
Пример #19
0
 def unpack(self, package):
     """Unpack the given lilypond .sh archive."""
     fileName = os.path.basename(package)
     ver = version(fileName) or 'unknown' # should not happen
     self.prefix = os.path.join(self.installDest.url().path(), ver)
     self.lilypond = os.path.join(self.prefix, "bin", "lilypond")
     if not os.path.exists(self.prefix):
         os.makedirs(self.prefix)
     elif os.path.exists(self.lilypond):
         result = KMessageBox.questionYesNoCancel(self, i18n(
             "LilyPond %1 seems already to be installed in %2.\n\n"
             "Do you want to use it or to remove and re-install?",
             ver, self.prefix), None,
             KGuiItem(i18n("Use existing LilyPond")),
             KGuiItem(i18n("Remove and re-install")))
         if result == KMessageBox.Yes:
             self.info.lilypond.setText(self.lilypond)
             self.enableButtonOk(True)
             KDialog.done(self, KDialog.Accepted)
             return
         elif result == KMessageBox.No:
             shutil.rmtree(self.prefix, True)
         else: # Cancel
             self.progress.reset()
             self.enableButtonOk(True)
             return
     self.status.setText(i18n("Unpacking %1...", fileName))
     self.progress.setRange(0, 0)
     unpack = self.unpackJob = QProcess()
     unpack.setProcessChannelMode(QProcess.MergedChannels)
     unpack.setWorkingDirectory(self.prefix)
     unpack.finished.connect(self.unpackFinished)
     unpack.error.connect(self.unpackError)
     unpack.start("sh", [package, "--batch", "--prefix", self.prefix])
Пример #20
0
    def save(self):
        try:
            for output in self._outputs:
                enabled = output in (self._left, self._right)
                self.iface.setOutput(output.name, enabled, False)
                if enabled:
                    self.iface.setMode(output.name,
                                        self._modes[output.name],
                                        self._rates[output.name])
                    self.iface.setRotation(output.name,
                                        self._rotations[output.name])

            left = self._left.name if self._left else None
            right = self._right.name if self._right else None
            cloned = not self.extendDisplays.isChecked()
            self.iface.setSimpleLayout(left, right, cloned)

            self.iface.sync()
            self.iface.applyNow()

            kdeui.KMessageBox.information(self,
                    kdecore.i18n("You must restart your X session for all the "
                                 "changes to take effect."),
                    QtCore.QString(),
                    "Screen Configuration Saved")

        except dbus.DBusException, exception:
            if "Comar.PolicyKit" in exception._dbus_error_name:
                kdeui.KMessageBox.error(self, kdecore.i18n("Access denied."))
            else:
                kdeui.KMessageBox.error(self, str(exception))

            QtCore.QTimer.singleShot(0, self.emitConfigChanged)
Пример #21
0
 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()))
Пример #22
0
 def updateData(self, data):
     if type(data) == list:
         if len(data) == 2:
             name, state = data
             detail = ''
         elif len(data) == 3:
             name, state, detail = data
     elif type(data) == str:
         splitted = data.split(' ',1)
         state = splitted[0]
         detail = ""
         if len(splitted) > 1:
             detail = splitted[1]
     if state == "down":
         self.ui.labelDesc.setText(i18n("Disconnected"))
         self.ui.checkToggler.setChecked(False)
         self.ui.labelStatus.setPixmap(KIcon(getIconForPackage(self.package)).pixmap(32))
         self.setState(True)
     elif state == "up":
         self.ui.labelDesc.setText(unicode(i18n("Connected: %s")) % detail)
         self.ui.checkToggler.setChecked(True)
         self.ui.labelStatus.setPixmap(KIcon("dialog-ok-apply").pixmap(32))
         self.setState(True)
     elif state == "connecting":
         self.ui.labelDesc.setText(i18n("Connecting"))
         self.ui.labelStatus.setPixmap(KIcon("chronometer").pixmap(32))
         self.setState(True)
     elif state == "inaccessible":
         self.ui.labelDesc.setText(unicode(detail))
         self.ui.labelStatus.setPixmap(KIcon("emblem-important").pixmap(32))
         self.setState(True)
     elif state == "unplugged":
         self.ui.labelDesc.setText(i18n("Cable or device is unplugged"))
         self.ui.labelStatus.setPixmap(KIcon("dialog-warning").pixmap(32))
         self.setState(False)
Пример #23
0
 def toBe(self):
     return {
         self.INSTALL: i18n("installed"),
         self.REMOVE: i18n("removed"),
         self.UPGRADE: i18n("upgraded"),
         self.ALL: i18n("modified"),
     }[self.state]
Пример #24
0
    def setupUi(self, PoolWidget):
        PoolWidget.setObjectName(_fromUtf8("PoolWidget"))
        PoolWidget.resize(540, 275)
        PoolWidget.setWindowTitle(_fromUtf8(""))
        self.gridLayout = QtGui.QGridLayout(PoolWidget)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.fetchButton = KPushButton(PoolWidget)
        self.fetchButton.setText(kdecore.i18n(_fromUtf8("Fetch more pools")))
        self.fetchButton.setObjectName(_fromUtf8("fetchButton"))
        self.gridLayout.addWidget(self.fetchButton, 0, 0, 1, 1)
        spacerItem = QtGui.QSpacerItem(430, 22, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.gridLayout.addItem(spacerItem, 0, 1, 1, 1)
        self.poolTable = QtGui.QTableWidget(PoolWidget)
        self.poolTable.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
        self.poolTable.setObjectName(_fromUtf8("poolTable"))
        self.poolTable.setColumnCount(4)
        self.poolTable.setRowCount(0)
        item = QtGui.QTableWidgetItem()
        item.setText(kdecore.i18n(_fromUtf8("ID")))
        self.poolTable.setHorizontalHeaderItem(0, item)
        item = QtGui.QTableWidgetItem()
        item.setText(kdecore.i18n(_fromUtf8("Name")))
        self.poolTable.setHorizontalHeaderItem(1, item)
        item = QtGui.QTableWidgetItem()
        item.setText(kdecore.i18n(_fromUtf8("Posts")))
        self.poolTable.setHorizontalHeaderItem(2, item)
        item = QtGui.QTableWidgetItem()
        item.setText(kdecore.i18n(_fromUtf8("Description")))
        self.poolTable.setHorizontalHeaderItem(3, item)
        self.poolTable.horizontalHeader().setVisible(True)
        self.poolTable.verticalHeader().setVisible(False)
        self.gridLayout.addWidget(self.poolTable, 1, 0, 1, 2)

        self.retranslateUi(PoolWidget)
        QtCore.QMetaObject.connectSlotsByName(PoolWidget)
Пример #25
0
 def onTextChanged(self):
     tmp = self.messageText.nativeWidget()
     if(len(tmp.toPlainText()) < 160):
         self.messagelabel.setText(i18n("Message - ") + str(len(tmp.toPlainText())) + i18n(" signs used"))
     else:
         # count how many sms are used and update the status
         self.messagelabel.setText(i18n("Message - ") + str(len(tmp.toPlainText())) + i18n(" signs used"))
Пример #26
0
 def __init__(self, mainwin):
     self.mainwin = mainwin
     KDialog.__init__(self, mainwin)
     self.setCaption(i18n("Run LilyPond"))
     self.setButtons(KDialog.ButtonCode(
         KDialog.Help | KDialog.Ok | KDialog.Cancel ))
     self.setButtonText(KDialog.Ok, i18n("Run LilyPond"))
     self.setButtonIcon(KDialog.Ok, KIcon("run-lilypond"))
     self.setHelp("running")
     
     layout = QVBoxLayout(self.mainWidget())
     
     layout.addWidget(QLabel(i18n(
         "Select which LilyPond version you want to run:")))
         
     self.lilypond = QListWidget()
     self.lilypond.setIconSize(QSize(22, 22))
     self.lilypond.setSpacing(4)
     layout.addWidget(self.lilypond)
     
     self.preview = QCheckBox(i18n(
         "Run LilyPond in preview mode (with Point and Click)"))
     layout.addWidget(self.preview)
     
     self.verbose = QCheckBox(i18n("Run LilyPond with verbose output"))
     layout.addWidget(self.verbose)
Пример #27
0
    def buildPolicies(self):
        self.actionItems = {}
        self._vendors = []

        categories = {"tr.org.pardus.comar.user.manager": (i18n("User/group operations"), "system-users"),
                      "tr.org.pardus.comar.system.manager|org.kde.fontinst": (i18n("Package operations"), "applications-other"),
                      "tr.org.pardus.comar.system.service": (i18n("Service operations"), "services"),
                      "tr.org.pardus.comar.time|org.kde.kcontrol.kcmclock": (i18n("Date/time operations"), "clock"),
                      "tr.org.pardus.comar.boot.modules|org.kde.ksysguard": (i18n("Kernel/Process operations"), "utilities-terminal"),
                      "tr.org.pardus.comar.boot.loader": (i18n("Bootloader settings"), "media-floppy"),
                      "org.kde.kcontrol.kcmpanda": (i18n("Screen settings"), "video-display"),
                      "org.kde.kcontrol.kcmlocale": (i18n("Locale settings"), "preferences-desktop-locale"),
                      "tr.org.pardus.comar.net.filter|tr.org.pardus.comar.net.share|org.freedesktop.network-manager-settings|org.freedesktop.NetworkManager": (i18n("Network settings"), "networkmanager"),
                      "org.kde.kcontrol.kcmkdm": (i18n("Login Manager settings"), "preferences-system-login"),
                      "org.kde.kcontrol.kcmkeyboard": (i18n("Keyboard settings"), "input-keyboard")}

        # do not show policies require policy type yes or no, only the ones require auth_* type
        allActions = filter(lambda x: polkit.action_info(x)['policy_active'].startswith("auth_"),polkit.action_list())
        for _category in categories.keys():
            parent_item = QtGui.QTreeWidgetItem(self.treeAuthorizations)
            parent_item.setIcon(0, kdeui.KIcon(categories[_category][1]))
            parent_item.setText(0, unicode(categories[_category][0]))
            for category in _category.split('|'):
                catactions = filter(lambda x: x.startswith(category), allActions)
                for action_id in catactions:
                    info = polkit.action_info(action_id)
                    item = PolicyItem(parent_item, unicode(info["description"]), action_id)
                    self.actionItems[action_id] = item
Пример #28
0
    def retranslateUi(self, summaryWidget):
        summaryWidget.setWindowTitle(kdecore.i18n("Summary"))
        self.labelProfilerIntro.setText(kdecore.i18n("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'Droid Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:12pt; font-weight:600;\">Your settings will be applied in next screen...</span></p></body></html>"))
Пример #29
0
def checkPyflakes(currentDocument=None, refresh=True):
    """Check the pyflakes errors of the document"""
    if not canCheckDocument(currentDocument):
        return
    if refresh:
        checkAll.f(currentDocument, ['checkPyflakes'],
                   exclude_all=not currentDocument)
    move_cursor = not currentDocument
    currentDocument = currentDocument or kate.activeDocument()

    path = currentDocument.url().path()
    mark_key = '%s-pyflakes' % path

    text = currentDocument.text()
    errors = pyflakes(text, path)
    errors_to_show = []

    if len(errors) == 0:
        showOk(i18n("Pyflakes Ok"))
        return

    # Prepare errors found for painting
    for error in errors:
        error_to_show = {
            "message": error.message % error.message_args,
            "line": error.lineno,
        }
        if getattr(error, 'col', None) is not None:
            error_to_show['column'] = error.col + 1
        errors_to_show.append(error_to_show)

    showErrors(i18n('Pyflakes Errors:'), errors_to_show,
               mark_key, currentDocument,
               move_cursor=move_cursor)
Пример #30
0
    def checkBackend(self):
        """
            Check if there are packages that provide required backend.
        """
        if not len(self.iface.getPackages()):
            kdeui.KMessageBox.error(self, kdecore.i18n(
                "There are no packages that provide backend for this "
                "application.\nPlease be sure that packages are installed "
                "and configured correctly."))
            return False

        elif not self.iface.isReady():
            answer = kdeui.KMessageBox.questionYesNo(self, kdecore.i18n(
                "Cannot find a valid configuration. Display settings won't "
                "be enabled until you create a new configuration.\n"
                "Would you like to create a safe configuration now?"))
            if answer == kdeui.KMessageBox.Yes:
                try:
                    self.iface.safeConfig()
                    self.iface.readConfig()
                except dbus.DBusException, exception:
                    if "Comar.PolicyKit" in exception._dbus_error_name:
                        kdeui.KMessageBox.error(self, kdecore.i18n("Access denied."))
                    else:
                        kdeui.KMessageBox.error(self, str(exception))

            return self.iface.isReady()
Пример #31
0
 def getBasketInfo(self):
     return {
         self.INSTALL:
         i18n("You have selected the following package(s) to install:"),
         self.REMOVE:
         i18n("You have selected the following package(s) to removal:"),
         self.UPGRADE:
         i18n("You have selected the following package(s) to upgrade:")
     }[self.state]
Пример #32
0
 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"))
Пример #33
0
 def getSummaryInfo(self, total):
     return {
         self.INSTALL:
         i18n("%1 new package(s) have been installed succesfully.", total),
         self.REMOVE:
         i18n("%1 package(s) have been removed succesfully.", total),
         self.UPGRADE:
         i18n("%1 package(s) have been upgraded succesfully.", total)
     }[self.state]
Пример #34
0
 def clearCache(self):
     if QMessageBox.Yes == QMessageBox.warning(self.settings,
                                               i18n("Warning"),
                                               i18n("All the cached packages will be deleted. Are you sure? "),
                                               QMessageBox.Yes | QMessageBox.No):
         try:
             self.iface.clearCache(0)
         except Exception, e:
             self.settings.parent.cw.exceptionCaught(str(e))
Пример #35
0
 def no_device_notification(self):
     if self.first_run:
         msgBox = QtGui.QMessageBox(
             1, i18n("QuickFormat"),
             i18n("There aren't any removable devices."))
         msgBox.exec_()
         sys.exit()
     else:
         self.notifier.notify(NO_DEVICE)
Пример #36
0
    def execute(self):
        if self.__class__.screenSettings["profileSend"]:
            self.__class__.screenSettings["summaryMessage"] = kdecore.i18n(
                "Yes")
        else:
            self.__class__.screenSettings["summaryMessage"] = kdecore.i18n(
                "No")

        return True
Пример #37
0
class Widget(QtGui.QWidget, Screen):
    title = i18n("Services")
    desc = i18n("Enable / Disable Services (Daemons)")

    screenSettings = {}
    screenSettings["hasChanged"] = False

    def __init__(self, *args):
        QtGui.QWidget.__init__(self, None)
        self.ui = Ui_servicesWidget()
        self.ui.setupUi(self)

        # set up self.config
        self.__class__.screenSettings["daemons"] = []
        self.services = ["org.cups.cupsd", "bluetooth"]
        self.daemons = {}
        for service in self.services:
            self.daemons[service] = Daemon(service)

        # set initial states
        # TODO: avoid the code dublication here
        self.ui.enableCups.setChecked(self.daemons["org.cups.cupsd"].is_enabled())
        self.ui.enableBluetooth.setChecked(self.daemons["bluetooth"].is_enabled())
        self.ui.enableCups.setEnabled(self.daemons["org.cups.cupsd"].is_installed())
        self.ui.enableBluetooth.setEnabled(self.daemons["bluetooth"].is_installed())

    def applySettings(self):
        if self.ui.enableCups.isChecked():
            self.__class__.screenSettings["enableCups"] = True
            if not self.daemons["org.cups.cupsd"].is_enabled():
                self.daemons["org.cups.cupsd"].has_changed = True
                self.__class__.screenSettings["daemons"].append(self.daemons["org.cups.cupsd"])
        else:
            self.__class__.screenSettings["enableCups"] = False
            if self.daemons["org.cups.cupsd"].is_enabled():
                self.daemons["org.cups.cupsd"].has_changed = True
                self.__class__.screenSettings["daemons"].append(self.daemons["org.cups.cupsd"])

        if self.ui.enableBluetooth.isChecked():
            self.__class__.screenSettings["enableBluetooth"] = True
            if not self.daemons["bluetooth"].is_enabled():
                self.daemons["bluetooth"].has_changed = True
                self.__class__.screenSettings["daemons"].append(self.daemons["bluetooth"])
        else:
            self.__class__.screenSettings["enableBluetooth"] = False
            if self.daemons["bluetooth"].is_enabled():
                self.__class__.screenSettings["hasChanged"] = True
                self.daemons["bluetooth"].has_changed = True
        self.__class__.screenSettings["hasChanged"] = self.daemons["org.cups.cupsd"].has_changed or self.daemons["bluetooth"].has_changed

    def shown(self):
        pass

    def execute(self):
        self.applySettings()
        return True
Пример #38
0
 def checkBackend(self):
     """ Check if there are packages that provide required backend. """
     if not len(self.iface.getPackages()):
         QtGui.QMessageBox.critical(self, i18n("Error"), \
                                          i18n("There are no packages that provide \
                                               backend for this application.\n \
                                               Please make sure that packages \
                                               are installed and configured correctly."))
         return False
     return True
Пример #39
0
 def createActions(self):
     if self.propvalue:
         copyAction = QAction(i18n("&Copy value to clipboard"), self)
         copyAction.setProperty("key", QVariant(COPY_TO_CLIPBOARD))
         #openInNewTabAction.setIcon(KIcon("tab-new-background-small"))
         self.addAction(copyAction)
     else:
         newPropertyAction = QAction(i18n("&Add property"), self)
         newPropertyAction.setProperty("key", QVariant(ADD_PROPERTY))
         self.addAction(newPropertyAction)
Пример #40
0
 def getTypeString(self):
     names = {
         Output.UnknownOutput: "",
         Output.DefaultOutput: kdecore.i18n("Default Output"),
         Output.LaptopPanel: kdecore.i18n("Laptop Panel"),
         Output.AnalogOutput: kdecore.i18n("Analog Output"),
         Output.DigitalOutput: kdecore.i18n("Digital Output"),
         Output.TVOutput: kdecore.i18n("TV Output"),
     }
     return names[self.outputType]
Пример #41
0
 def reset(self):
     self.actionLabel.setText(i18n("<h3>Preparing PiSi...</h3>"))
     self.progressBar.setValue(0)
     self.operationInfo.setText("")
     self.completedInfo.setText("")
     self.statusLabel.setText(i18n("Status:"))
     self.statusInfo.setText(i18n("--  / --"))
     self.timeLabel.setText(i18n("Time remaining:"))
     self.timeRemaining.setText(i18n("--:--:--"))
     self.timeRemaining.show()
Пример #42
0
    def updateOperation(self, operation, arg):
        if operation in [i18n("configuring"), i18n("extracting")]:
            self.disableCancel()

        if operation == "updatingrepo":
            operationInfo = i18n("Downloading package list of %1", arg)
        else:
            operationInfo = i18n('%1 %2', operation, arg)

        self.operationInfo.setText(operationInfo)
Пример #43
0
 def createModel(self):
     urisExclude = [Soprano.Vocabulary.NAO.prefLabel(), Soprano.Vocabulary.NAO.description()]
     
     data = datamanager.findResourceLiteralProperties(self.resource, urisExclude)
     if self.resource:
         uriprop = (Soprano.Vocabulary.NAO.identifier(), self.resource.resourceUri())
         data.append(uriprop)
     self.model = ResourcePropertiesTableModel(self, data=data)
     
     self.model.setHeaders([i18n("Property"), i18n("Value")])
Пример #44
0
    def getSummaryInfo(self, total, extraPackagesCount):
        # BUG Fixed #15163
        extraPackageMessage = i18n("%1 new package(s) have been installed succesfully.", extraPackagesCount)
        upgradeMessage = i18n("%1 package(s) have been upgraded succesfully.", total-extraPackagesCount)
        if not extraPackagesCount == 0:
            upgradeMessage = "%s\n%s" % (upgradeMessage, extraPackageMessage)

        return {self.INSTALL:i18n("%1 new package(s) have been installed succesfully.", total),
                self.REMOVE :i18n("%1 package(s) have been removed succesfully.", total),
                self.UPGRADE:upgradeMessage,
                self.ALL    :i18n("%1 package(s) have been modified succesfully.", total)}[self.state]
Пример #45
0
    def initializeUpdateTypeList(self):
        self.typeCombo.clear()
        UPDATE_TYPES = [[
            'normal', i18n('All Updates'), 'system-software-update'
        ], ['security',
            i18n('Security Updates'), 'security-medium'],
                        ['critical',
                         i18n('Critical Updates'), 'security-low']]

        for type in UPDATE_TYPES:
            self.typeCombo.addItem(KIcon(type[2]), type[1], QVariant(type[0]))
Пример #46
0
 def updateProgress(self, progress):
     self.busy.stopAnimation()
     self.busy.hide()
     self.widget.show()
     if not self.isVisible():
         if not self.parent.cw._started:
             self.disableCancel()
         self._show()
     self.progressBar.setValue(progress)
     self.percentage.setText(i18n("<p align='right'>%1 %</p>", progress))
     self.parent.setWindowTitle(i18n("Operation - %1%", progress))
Пример #47
0
        def __init__(self, parent):
            kdeui.KPageDialog.__init__(self, parent)

            self.setFaceType(kdeui.KPageDialog.Tabbed)
            self.setCaption(i18n("Settings"))

            self.page_widget = EditWidget(self)
            self.page_item = kdeui.KPageWidgetItem(self.page_widget, i18n("Settings"))

            self.addPage(self.page_item)
            self.edit = self.page_widget
Пример #48
0
        def __init__(self, parent, parameters, savedParameters):
            kdeui.KPageDialog.__init__(self, parent)

            self.setFaceType(kdeui.KPageDialog.Tabbed)
            self.setCaption(kdecore.i18n("Settings"))

            self.page_widget = PageWidget(self, parameters, savedParameters)
            self.page_item = kdeui.KPageWidgetItem(self.page_widget,
                                                   kdecore.i18n("Settings"))

            self.addPage(self.page_item)
Пример #49
0
 def retranslateUi(self, Form):
     Form.setWindowTitle(kdecore.i18n(_fromUtf8("Form")))
     self.modsLabel.setText(kdecore.i18n(_fromUtf8("Modifiers:")))
     self.controlButton.setText(kdecore.i18n(_fromUtf8("Control")))
     self.altButton.setText(kdecore.i18n(_fromUtf8("Alt")))
     self.shiftButton.setText(kdecore.i18n(_fromUtf8("Shift")))
     self.superButton.setText(kdecore.i18n(_fromUtf8("Super")))
     self.hyperButton.setText(kdecore.i18n(_fromUtf8("Hyper")))
     self.metaButton.setText(kdecore.i18n(_fromUtf8("Meta")))
     self.keyLabel.setText(kdecore.i18n(_fromUtf8("Key: %s")))
     self.setButton.setText(kdecore.i18n(_fromUtf8("Press to set")))
Пример #50
0
 def retranslateUi(self, ScriptPage):
     ScriptPage.setWindowTitle(kdecore.i18n(_fromUtf8("Form")))
     self.urlLabel.setTipText(
         kdecore.i18n(
             _fromUtf8("Open the script in the default text editor")))
     self.settingsGroupbox.setTitle(
         kdecore.i18n(_fromUtf8("Script Settings")))
     self.promptCheckbox.setText(
         kdecore.i18n(
             _fromUtf8("Always prompt before running this script")))
     self.showInTrayCheckbox.setText(
         kdecore.i18n(_fromUtf8("Show in notification icon menu")))
Пример #51
0
class Widget(QtGui.QWidget, Screen):
    title = i18n("Packages")
    desc = i18n("Install / Remove Programs")

    screenSettings = {}
    screenSettings["hasChanged"] = False

    def __init__(self, *args):
        QtGui.QWidget.__init__(self, None)
        self.ui = Ui_packageWidget()
        self.ui.setupUi(self)

        # set up some variables
        notifier = '/usr/bin/octopi-notifier'
        desktop = '/usr/share/applications/octopi-notifier.desktop'
        autostart = '/usr/share/autostart/octopi-notifier.desktop'
        self.notifier_enabled = os.path.exists(autostart)

        # set initial states
        self.ui.checkUpdate.setEnabled(os.path.exists(notifier))
        self.ui.checkUpdate.setChecked(self.notifier_enabled)

    def applySettings(self):
        self.__class__.screenSettings["enabled"] = self.notifier_enabled
        if self.ui.checkUpdate.isChecked():
            # checks if octopi-notifier is not in the output of ps -Af
            if "octopi-notifier" not in subprocess.Popen(
                    "ps -Af", shell=True,
                    stdout=subprocess.PIPE).stdout.read():
                subprocess.Popen(["octopi-notifier"], stdout=subprocess.PIPE)

            # was octopi-notifier disabled before?
            if not self.notifier_enabled:
                self.__class__.screenSettings["hasChanged"] = True
            else:
                self.__class__.screenSettings["hasChanged"] = False

        else:
            # don't care if this fails
            os.system("killall octopi-notifier")

            # was octopi-notifier enabled to begin with?
            if self.notifier_enabled:
                self.__class__.screenSettings["hasChanged"] = True
            else:
                self.__class__.screenSettings["hasChanged"] = False

    def shown(self):
        pass

    def execute(self):
        self.applySettings()
        return True
Пример #52
0
    def createActions(self):

        if self.selectedResources:
            action = QAction(i18n("&Remove type"), self)
            action.setProperty("key", QVariant(TYPE_LIST_REMOVE_TYPE))
            self.addAction(action)

        else:
            #the user right clicked in the empty zone
            action = QAction(i18n("&Add type"), self)
            action.setProperty("key", QVariant(TYPE_LIST_ADD_TYPE))
            self.addAction(action)
Пример #53
0
 def retranslateUi(self, NepomukPage):
     self.kcfg_nepomukEnabled.setWhatsThis(
         kdecore.i18n(
             "Check this to enable semantic tagging of the downloaded images, using Nepomuk."
         ))
     self.kcfg_nepomukEnabled.setText(
         kdecore.i18n("Enable Nepomuk tagging"))
     self.kcfg_tagBlacklist.setWhatsThis(
         kdecore.i18n(
             "Insert tags that you do not want to appear in your searches, regardless of the rating. They will also be excluded if the Nepomuk tagging is enabled."
         ))
     self.kcfg_tagBlacklist.setTitle(kdecore.i18n("Blacklisted tags"))
Пример #54
0
    def init(self):
        """ Const method for initializing the applet """

        self.readEntries()
        self.followSolid()

        self.connectedDevices = []
        self.maxQuality = 100.0

        self.iface = NetworkIface()
        self.notifyface = Notifier(dbus.get_default_main_loop())
        self.notifyface.registerNetwork()

        # Aspect ratio defined in Plasma
        self.setAspectRatioMode(Plasma.Square)

        self.loader = KIconLoader()
        self.defaultIcon = WIRED
        self.emblem = DISCONNECTED["emblem"]

        self.icon = NmIcon(self)
        self.icon.setToolTip(i18n("Click here to show connections.."))

        self.layout = QGraphicsLinearLayout(self.applet)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0)
        self.layout.addItem(self.icon)

        self.connect(self.icon, SIGNAL("clicked()"), self.showDialog)

        self.receiverBlinker = Blinker(self)
        self.transmitterBlinker = Blinker(self, QColor(255,114,32))

        # Listen data transfers from lastUsed Device ..
        self.lastActiveDevice = None
        self.lastActivePackage = None

        self.initPopup()

        # It may cause crashes in PlasmoidViewer but luckly not in Plasma :)
        self.connect(Plasma.Theme.defaultTheme(), SIGNAL("themeChanged()"), self.updateTheme)

        # Listen network status from comar
        self.iface.listen(self.handler)

        QTimer.singleShot(self._config['pollinterval'], self.dataUpdated)

        # Context Menu
        icon = self.loader.loadIcon(WIRED, KIconLoader.NoGroup, 22)
        openNm = QAction(QIcon(icon), i18n("Open Network Manager"), self)
        self.actions.append(openNm)
        self.connect(openNm, SIGNAL("triggered(bool)"), self.openNM)
        self.connect(self.popup.ui.nmButton, SIGNAL("clicked()"), self.openNM)
Пример #55
0
    def addExternalOpenAction(self):
        if len(self.selectedResources) == 1:
            resource = Nepomuk.Resource(self.selectedResources[0])
            if resource and NFO.FileDataObject in resource.types():
                action = QAction(i18n("Open &file"), self)
                action.setProperty("key", QVariant(OPEN_FILE))
                self.addAction(action)

            if resource and NFO.Website in resource.types():
                action = QAction(i18n("Open &page"), self)
                action.setProperty("key", QVariant(OPEN_PAGE))
                self.addAction(action)
Пример #56
0
class Widget(QtGui.QWidget, ScreenWidget):
    title = i18n("Summary")
    desc = i18n("Welcome to Migration Tool Wizard :)")

    def __init__(self, *args):
        QtGui.QWidget.__init__(self, None)
        self.ui = Ui_summaryWidget()
        self.ui.setupUi(self)

    def shown(self):
        subject = "<p><li><b>%s</b></li><ul>"
        item = "<li>%s</li>"
        end = "</ul></p>"
        content = QString("")

        content.append("""<html><body><ul>""")

        # Selected User
        content.append(subject % ki18n("User Settings").toString())
        content.append(item % ki18n("Selected User: <b>%s</b>").toString() %
                       ctx.user[2])
        content.append(end)

        # Selected Options
        content.append(subject % ki18n("Options Settings").toString())
        for key, value in ctx.options.items():
            content.append(item % ki18n("Option %1 : <b>%2</b>").toString() %
                           (key, value))
        content.append(end)

        if ctx.filesOptions:
            #Selected Files Destinations
            content.append(subject % ki18n("Destination Settings").toString())
            if ctx.filesOptions.has_key("links"):
                for link in ctx.filesOptions["links"]:
                    content.append(
                        item %
                        ki18n("Linked Destination to: <b> %s </b>").toString()
                        % link)
            elif ctx.filesOptions.has_key("copy destination"):
                content.append(
                    item %
                    ki18n("Copied Destination to: <b> %s </b>").toString() %
                    ctx.filesOptions["copy destination"])

            content.append(end)

        content.append("""</ul></body></html>""")
        self.ui.textSummary.setHtml(content)

    def execute(self):
        return (True, None)
Пример #57
0
 def buildFilter(self):
     """
         Builds item filter.
     """
     self.comboFilter.clear()
     self.comboFilter.addItem(kdecore.i18n("Users"),
                              QtCore.QVariant("users"))
     self.comboFilter.addItem(kdecore.i18n("Groups"),
                              QtCore.QVariant("groups"))
     self.comboFilter.addItem(kdecore.i18n("All Users"),
                              QtCore.QVariant("all-users"))
     self.comboFilter.addItem(kdecore.i18n("All Groups"),
                              QtCore.QVariant("all-groups"))
Пример #58
0
    def __init__(self, parent):
        KVBox.__init__(self, parent)
        self.setSpacing(40)
        self.help = QLabel(i18n(helpText), self)
        self.layout().setAlignment(self.help, Qt.AlignHCenter)

        self.button = KPushButton(i18n("Show %s" % dialogName), self)
        self.button.setFixedSize(200, 30)
        self.layout().setAlignment(self.button, Qt.AlignHCenter)
        self.fontLabel = QLabel(quote, self)
        self.layout().setAlignment(self.fontLabel, Qt.AlignHCenter)

        self.connect(self.button, SIGNAL('clicked()'), self.showDialog)
Пример #59
0
    def enable(self, doc):
        if doc.url() == '':
            self.act.blockSignals(True)
            showError(i18n('Can\'t auto-reload unsaved file'))
            self.act.setChecked(False)
            self.act.blockSignals(False)
            return

        doc.setModifiedOnDiskWarning(False)
        doc.modifiedOnDisk.connect(doc.documentReload)
        doc.setProperty('AutoReload', True)

        showOk(i18n('Auto-Reload enabled'))
Пример #60
0
    def statusText(self, packages, packagesSize, extraPackages, extraPackagesSize):
        if not packages:
            return ''

        text = i18n("Currently there are <b>%1</b> selected package(s) of total <b>%2</b> of size ", packages, packagesSize)
        if extraPackages:
            if self.state == self.REMOVE:
                text += i18n("with <b>%1</b> reverse dependencies of total <b>%2</b> of size ", extraPackages, extraPackagesSize)
            else:
                text += i18n("with <b>%1</b> extra dependencies of total <b>%2</b> of size ", extraPackages, extraPackagesSize)
        text += i18n("in your basket.")

        return text