class Widget(QtGui.QWidget, ScreenWidget): title = ki18n("Bug Reporting Tool") desc = ki18n("Welcome to Bug Reporting Tool :)") def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_bugWidget() self.ui.setupUi(self) def load_report(self, report): details = self.ui.details for key in report: item = QtGui.QTreeWidgetItem([key]) details.addTopLevelItem(item) if not hasattr(report[key], 'gzipvalue') and \ hasattr(report[key], 'isspace') and \ not report._is_binary(report[key]): lines = report[key].splitlines() for line in lines: QtGui.QTreeWidgetItem(item, [line]) if len(lines) < 4: item.setExpanded(True) else: QtGui.QTreeWidgetItem(item, ['(binary data)']) details.header().hide() def shown(self): pass def execute(self): return True
def createApp (args=sys.argv): ######################################### # all the bureaucratic init of a KDE App # the appName must not contain any chars besides a-zA-Z0-9_ # because KMainWindowPrivate::polish() calls QDBusConnection::sessionBus().registerObject() # see QDBusUtil::isValidCharacterNoDash() appName = "satyr" catalog = "" programName = ki18n ("satyr") #ki18n required here version = "0.5.0" description = ki18n ("I need a media player that thinks about music the way I think about it. This is such a program.") #ki18n required here license = KAboutData.License_GPL copyright = ki18n ("(c) 2009, 2010 Marcos Dione") #ki18n required here text = ki18n ("none") #ki18n required here homePage = "http://savannah.nongnu.org/projects/satyr/" bugEmail = "*****@*****.**" aboutData = KAboutData (appName, catalog, programName, version, description, license, copyright, text, homePage, bugEmail) # ki18n required for first two addAuthor () arguments aboutData.addAuthor (ki18n ("Marcos Dione"), ki18n ("design and implementation")) aboutData.addAuthor (ki18n ("Sebastián Álvarez"), ki18n ("features, bugfixes and testing")) KCmdLineArgs.init (args, aboutData) options= KCmdLineOptions () options.add ("s").add ("skin <skin-name>", ki18n ("skin"), "") options.add ("+path", ki18n ("paths to your music collections")) KCmdLineArgs.addCmdLineOptions (options) app= App () args= KCmdLineArgs.parsedArgs () return app, args
def main(): app_name="danbooru_client" catalog = "danbooru_client" program_name = ki18n("Danbooru Client") version = "1.0.0" description = ki18n("A client for Danbooru sites.") license = KAboutData.License_GPL copyright = ki18n("(C) 2009 Luca Beltrame") text = ki18n("Danbooru Client is a program to" " access Danbooru image boards.") home_page = u"http://www.dennogumi.org" bug_email = "*****@*****.**" about_data = KAboutData(app_name, catalog, program_name, version, description, license, copyright, text, home_page, bug_email) about_data.setProgramIconName("internet-web-browser") component_data = KComponentData(about_data) component_data.setAboutData(about_data) KCmdLineArgs.init(sys.argv, about_data) app = KApplication() window = mainwindow.MainWindow() window.show() app.exec_()
def start(): appName = Config.appname catalog = Config.catalog programName = ki18n(Config.readable_appname) version = Config.version description = ki18n("A tablet annotation and journaling application.") license = KAboutData.License_BSD copyright = ki18n("(C) 2009 Dominik Schacht") text = ki18n("Whee, greetings.") homepage = Config.homepage bugemail = "*****@*****.**" aboutData = KAboutData(appName, catalog, programName, version, description, license, copyright, text, homepage, bugemail) KCmdLineArgs.init(sys.argv, aboutData) KCmdLineArgs.addCmdLineOptions(Config.get_param_options()) app = KApplication() Config.init_config() # Init after the KApplication has been created. mw = MainWindow() mw.show() result = app.exec_() return result
def takePhoto(self): if self.isCaptureFlag: self.isCaptureFlag = False self.isTaken = True #change the image from Ipl to PIL for being able to use it in Qt self.image = ImageQt.ImageQt( opencv.adaptors.Ipl2PIL(self.originalFrame).transpose( Image.FLIP_LEFT_RIGHT)) self.ui.displayLabel.setPixmap(QtGui.QPixmap.fromImage(self.image)) #resize photo for avatar processedImage = cvCreateImage(cvSize(60, 60), 8, self.originalFrame.nChannels) cvResize(self.originalFrame, processedImage, CV_INTER_LINEAR) #find homedir homedir = os.path.expanduser("~") #save the image ImageQt.ImageQt( opencv.adaptors.Ipl2PIL(processedImage).transpose( Image.FLIP_LEFT_RIGHT)).save(homedir + "/kaptantmp.png") os.rename(homedir + "/kaptantmp.png", homedir + "/.face.icon") self.ui.captureButton.setText(ki18n("Recapture").toString()) self.terminateCam() else: self.isCaptureFlag = True self.isTaken = False #self.camera = cvCreateCameraCapture(self.camindex) self.initializeCam() self.ui.captureButton.setText(ki18n("Capture").toString())
def main(): app_name = "vlc_snapper" catalog = "danbooru_client" program_name = ki18n("KDE VLC Snapper") version = "0.1" description = ki18n("A screenshot taker for video clips.") license = KAboutData.License_GPL copyright = ki18n("(C) 2011 Luca Beltrame") text = ki18n("") home_page = "http://www.dennogumi.org" bug_email = "*****@*****.**" about_data = KAboutData( app_name, catalog, program_name, version, description, license, copyright, text, home_page, bug_email ) about_data.setProgramIconName("internet-web-browser") KCmdLineArgs.init(sys.argv, about_data) app = KApplication() dialog = capturewidget.CaptureDialog() dialog.show() app.lastWindowClosed.connect(dialog.deleteLater) app.exec_()
class Widget(QtGui.QWidget, ScreenWidget): title = ki18n("Bug Reporting Tool") desc = ki18n("Welcome to Bug Reporting Tool :)") def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_bugWidget() self.ui.setupUi(self) QObject.connect(self.ui.comboBox, SIGNAL("currentIndexChanged(int)"), self.checkChoices) def shown(self): self.checkChoices(self.ui.comboBox.currentIndex()) pass def execute(self): if self.ui.comboBox.currentIndex() == 1: self.shared['type'] = 'bug' else: self.shared['type'] = 'feature' return True def checkChoices(self, value): if int(value) != 0: self.mainwindow.enableNext() else: self.mainwindow.disableNext() @property def mainwindow(self): return self.parentWidget().parentWidget().parentWidget() @property def shared(self): return self.parent().parent().parent().shared_data
class Widget(QtGui.QWidget, Screen): title = ki18n("More") desc = ki18n("Congratulations!") def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_goodbyeWidget() self.ui.setupUi(self) lang = KGlobal.locale().language() if lang == "tr": self.helpPageUrl = "http://www.pardus-anka.org" else: self.helpPageUrl = "http://worldforum.pardus-linux.nl" def on_buttonSystemSettings_clicked(self): self.procSettings = QProcess() self.procSettings.start("systemsettings") def on_buttonHelpPages_clicked(self): self.procSettings = QProcess() command = "kfmclient openURL " + self.helpPageUrl self.procSettings.start(command) def execute(self): return True
def __init__( self ): bus = dbus.SessionBus() try: app_proxy = bus.get_object( 'org.kde.amarok', '/' ) self.app = dbus.Interface( app_proxy, 'org.freedesktop.MediaPlayer' ) player_proxy = bus.get_object( 'org.kde.amarok', '/Player' ) self.player = dbus.Interface( player_proxy, 'org.freedesktop.MediaPlayer' ) tList_proxy = bus.get_object( 'org.kde.amarok', '/TrackList') self.trackList = dbus.Interface( tList_proxy, 'org.freedesktop.MediaPlayer' ) except dbus.exceptions.DBusException: import sys from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineArgs from PyKDE4.kdeui import KMainWindow, KMessageBox, KApplication about = KAboutData("msgbox", "msgbox", ki18n ("TAmarok"), "0.1", ki18n(""), KAboutData.License_GPL, ki18n ( "(c) 2009 Thomas Eichinger" ), ki18n(""), "", "") KCmdLineArgs.init(sys.argv, about) app = KApplication() win = KMainWindow() if KMessageBox.warningYesNo(win, "Oops, found no Amarok instance.\n Start Amarok now?" ) == 3 : import subprocess self.out = "" subprocess.Popen("amarok") import time time.sleep(3) app_proxy = bus.get_object( 'org.kde.amarok', '/' ) self.app = dbus.Interface( app_proxy, 'org.freedesktop.MediaPlayer' ) player_proxy = bus.get_object( 'org.kde.amarok', '/Player' ) self.player = dbus.Interface( player_proxy, 'org.freedesktop.MediaPlayer' ) tList_proxy = bus.get_object( 'org.kde.amarok', '/TrackList') self.trackList = dbus.Interface( tList_proxy, 'org.freedesktop.MediaPlayer' ) else: print "*E* Sorry no Amarok running" quit()
class Widget(QtGui.QWidget, ScreenWidget): title = ki18n("Bug Reporting Tool") desc = ki18n("Progress Screen") def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_bugWidget() self.ui.setupUi(self) def shown(self): pass def execute(self): summary = self.ui.summary.text() description = self.ui.description.toPlainText() if len(summary) == 0 or len(description) == 0: return False else: self.shared['summary'] = str(summary) self.shared['description'] = str(description) return True @property def shared(self): return self.parent().parent().parent().shared_data
def main(): app_name = "vlc_snapper" catalog = "danbooru_client" program_name = ki18n("KDE VLC Snapper") version = "0.1" description = ki18n("A screenshot taker for video clips.") license = KAboutData.License_GPL copyright = ki18n("(C) 2011 Luca Beltrame") text = ki18n("") home_page = "http://www.dennogumi.org" bug_email = "*****@*****.**" about_data = KAboutData(app_name, catalog, program_name, version, description, license, copyright, text, home_page, bug_email) about_data.setProgramIconName("internet-web-browser") KCmdLineArgs.init(sys.argv, about_data) app = KApplication() dialog = capturewidget.CaptureDialog() dialog.show() app.lastWindowClosed.connect(dialog.deleteLater) app.exec_()
def main(): app_name = "danbooru_client" catalog = "danbooru_client" program_name = ki18n("Danbooru Client") version = "1.0.0" description = ki18n("A client for Danbooru sites.") license = KAboutData.License_GPL copyright = ki18n("(C) 2009 Luca Beltrame") text = ki18n("Danbooru Client is a program to" " access Danbooru image boards.") home_page = u"http://www.dennogumi.org" bug_email = "*****@*****.**" about_data = KAboutData(app_name, catalog, program_name, version, description, license, copyright, text, home_page, bug_email) about_data.setProgramIconName("internet-web-browser") component_data = KComponentData(about_data) component_data.setAboutData(about_data) KCmdLineArgs.init(sys.argv, about_data) app = KApplication() window = mainwindow.MainWindow() window.show() app.exec_()
def main (): appName = "KMainWindow" catalog = "" programName = ki18n ("KMainWindow") version = "1.0" description = ki18n ("Tutorial - Second Program") license = KAboutData.License_GPL copyright = ki18n ("(c) 2007 Jim Bublitz") text = ki18n ("none") homePage = "www.riverbankcomputing.com" bugEmail = "*****@*****.**" aboutData = KAboutData (appName, catalog, programName, version, description, license, copyright, text, homePage, bugEmail) KCmdLineArgs.init (sys.argv, aboutData) app = KApplication () #------- new stuff added here ---------- mainWindow = MainWindow () mainWindow.show () app.exec_ ()
def execute(self): if self.__class__.screenSettings["state"] == True: self.__class__.screenSettings["summaryMessage"] = ki18n("On") else: self.__class__.screenSettings["summaryMessage"] = ki18n("Off") return True
def takePhoto(self): if self.isCaptureFlag: self.isCaptureFlag = False self.isTaken = True #change the image from Ipl to PIL for being able to use it in Qt self.image = ImageQt.ImageQt(opencv.adaptors.Ipl2PIL(self.originalFrame).transpose(Image.FLIP_LEFT_RIGHT)) self.ui.displayLabel.setPixmap(QtGui.QPixmap.fromImage(self.image)) #resize photo for avatar processedImage = cvCreateImage(cvSize(60,60), 8, self.originalFrame.nChannels) cvResize(self.originalFrame, processedImage, CV_INTER_LINEAR) #find homedir homedir = os.path.expanduser("~") #save the image ImageQt.ImageQt(opencv.adaptors.Ipl2PIL(processedImage).transpose(Image.FLIP_LEFT_RIGHT)).save(homedir + "/kaptantmp.png") os.rename(homedir + "/kaptantmp.png",homedir + "/.face.icon") self.ui.captureButton.setText(ki18n("Recapture").toString()) self.terminateCam() else: self.isCaptureFlag = True self.isTaken = False #self.camera = cvCreateCameraCapture(self.camindex) self.initializeCam() self.ui.captureButton.setText(ki18n("Capture").toString())
class Widget(QtGui.QWidget, ScreenWidget): title = ki18n("Bug Reporting Tool") desc = ki18n("Welcome to Bug Reporting Tool :)") def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_bugWidget() self.ui.setupUi(self) def shown(self): pass def execute(self): return True @property def choices(self): return self.ui.choicesBox def add_choice(self, option, is_multiple=False): widget = None if is_multiple: widget = QtGui.QCheckBox(option) else: widget = QtGui.QRadioButton(option) assert widget != None, 'Unexpected None value for widget' self.ui.choicesBox.insertWidget(0, widget) def get_response(self): return [c for c in range(0, self.choices.count()) if \ self.choices.itemAt(c).widget().isChecked()]
class Widget(QtGui.QWidget, Screen): title = ki18n("Packages") desc = ki18n("Install / Remove Programs") # min update time updateTime = 12 def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_packageWidget() self.ui.setupUi(self) # set updateTime self.ui.updateInterval.setValue(self.updateTime) # set initial states self.ui.checkUpdate.setChecked(True) self.ui.showTray.setChecked(True) # set signals self.ui.showTray.connect(self.ui.showTray, SIGNAL("toggled(bool)"), self.enableCheckTime) self.ui.checkUpdate.connect(self.ui.checkUpdate, SIGNAL("toggled(bool)"), self.updateSelected) def enableCheckTime(self): if self.ui.showTray.isChecked(): self.ui.checkUpdate.setVisible(True) self.ui.updateInterval.setVisible(True) else: self.ui.checkUpdate.setChecked(False) self.ui.checkUpdate.setVisible(False) self.ui.checkUpdate.setCheckState(Qt.Unchecked) self.ui.updateInterval.setVisible(False) def updateSelected(self): if self.ui.checkUpdate.isChecked(): self.ui.updateInterval.setEnabled(True) else: self.ui.updateInterval.setEnabled(False) def applySettings(self): # write selected configurations to future package-managerrc config = PMConfig() config.setSystemTray(QVariant(self.ui.showTray.isChecked())) config.setUpdateCheck(QVariant(self.ui.checkUpdate.isChecked())) config.setUpdateCheckInterval( QVariant(self.ui.updateInterval.value() * 60)) if self.ui.showTray.isChecked(): p = subprocess.Popen(["package-manager"], stdout=subprocess.PIPE) def shown(self): pass def execute(self): self.applySettings() return True
class Widget(QtGui.QWidget, ScreenWidget): title = ki18n("Bug Reporting Tool") desc = ki18n("Attachment Screen") def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_bugWidget() self.ui.setupUi(self) QObject.connect(self.ui.addButton, SIGNAL("clicked()"), self.add_file) QObject.connect(self.ui.removeButton, SIGNAL("clicked()"), self.remove_file) self.files = {} self.model = QtGui.QStandardItemModel() self.ui.filelist.setModel(self.model) def add_file(self): filename = QtGui.QFileDialog.getOpenFileName(self, 'Choose a file to attach') filename = str(filename) try: f = open(filename) mime, encoding = mimetypes.guess_type(filename) if mime is None: mime = 'text/plain' content = f.read() desc, result = QtGui.QInputDialog.getText(self, 'File description', 'Describe %s briefly:' %\ basename(filename)) if len(desc) == 0: desc = basename(filename) except OSError: QtGui.QMessageBox.critical(self, 'Unable to read %s' % filename) item = QtGui.QStandardItem(desc) self.files[str(item.text())] = (basename(filename), mime, content) self.model.appendRow(item) def remove_file(self): for item in self.ui.filelist.selectedIndexes(): row = item.row() it = str(self.model.item(row, col).text()) if it in self.files: self.files.pop(it) self.model.removeRow(row) def shown(self): # TODO: search for patterns on description and summary to for # auto-attaching pass def execute(self): self.shared['attachments'] = self.files return True @property def shared(self): return self.parent().parent().parent().shared_data
class Widget(QtGui.QWidget, ScreenWidget): title = ki18n("More") desc = ki18n("Congratulations!") def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_goodbyeWidget() self.ui.setupUi(self) lang = KGlobal.locale().language() if lang == "tr": self.helpPageUrl = "http://www.pardus.org.tr/destek" else: self.helpPageUrl = "http://www.pardus.org.tr/eng/support" self.smoltUrl = "http://smolt.pardus.org.tr:8090" users = partition.allUsers() if not users: self.ui.migrationGroupBox.hide() self.ui.label_2.hide() self.ui.buttonSystemSettings_2.connect(self.ui.buttonSystemSettings_2, SIGNAL("clicked()"), self.startSmolt) self.ui.buttonMigration.connect(self.ui.buttonMigration, SIGNAL("clicked()"), self.startMigration) self.ui.buttonSystemSettings.connect(self.ui.buttonSystemSettings, SIGNAL("clicked()"), self.startSystemSettings) self.ui.buttonHelpPages.connect(self.ui.buttonHelpPages, SIGNAL("clicked()"), self.startHelpPages) def startSystemSettings(self): self.procSettings = QProcess() self.procSettings.start("systemsettings") def startMigration(self): self.procSettings = QProcess() self.procSettings.start("migration") def startHelpPages(self): self.procSettings = QProcess() command = "kfmclient openURL " + self.helpPageUrl self.procSettings.start(command) def startSmolt(self): self.procSettings = QProcess() command = "kfmclient openURL " + self.smoltUrl self.procSettings.start(command) def setSmolt(self): if not self.smoltSettings["profileSend"]: self.ui.smoltGroupBox.hide() self.ui.label.hide() def shown(self): self.smoltSettings = smoltWidget.Widget.screenSettings self.setSmolt() def execute(self): return True
class Widget(QtGui.QWidget, ScreenWidget): title = ki18n("Bug Reporting Tool") desc = ki18n("Credentials Screen") def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_bugWidget() self.ui.setupUi(self) QObject.connect(self.ui.logoutButton, SIGNAL("clicked()"), self.logout) self.bugzilla = Bugz(BUGZILLA_URL) cj = CookiePot().make_lwp_cookiejar( self.bugzilla.cookiejar.filename, #'bugs.pardus.org.tr') 'landfill.bugzilla.org') self.bugzilla.cookiejar = cj self.bugzilla.opener = build_opener(HTTPCookieProcessor(cj)) self.is_logged_in = False def logout(self): self.bugzilla.authenticated = False self.bugzilla.opener.open(LOGOUT_URL).read() self.shown() def shown(self): if self.bugzilla.try_auth(): self.is_logged_in = True self.ui.logoutButton.setVisible(True) self.ui.logoutText.setVisible(True) self.ui.username.setEnabled(False) self.ui.password.setEnabled(False) else: self.is_logged_in = False self.ui.logoutButton.setVisible(False) self.ui.logoutText.setVisible(False) self.ui.username.setEnabled(True) self.ui.password.setEnabled(True) pass def execute(self): if not self.is_logged_in: if len(self.ui.password.text()) == 0 or\ len(self.ui.username.text()) == 0: return False else: self.bugzilla.user = self.ui.username.text() self.bugzilla.password = self.ui.password.text() try: self.bugzilla.auth() except RuntimeError: print 'Invalid user/pass pair!' return False self.shared['bugzilla'] = self.bugzilla return True @property def shared(self): return self.parent().parent().parent().shared_data
def __init__(self): app_name = "magneto" catalog = "" prog_name = ki18n("Magneto") version = "1.0" description = ki18n("System Update Status") lic = KAboutData.License_GPL cright = ki18n("(c) 2013 Fabio Erculiani") text = ki18n("none") home_page = "www.sabayon.org" bug_mail = "*****@*****.**" self._kabout = KAboutData(app_name, catalog, prog_name, version, description, lic, cright, text, home_page, bug_mail) argv = [sys.argv[0]] KCmdLineArgs.init(argv, self._kabout) self._app = KApplication() from dbus.mainloop.qt import DBusQtMainLoop super(Magneto, self).__init__(main_loop_class=DBusQtMainLoop) self._window = KStatusNotifierItem() # do not show "Quit" and use quitSelected() signal self._window.setStandardActionsEnabled(False) icon_name = self.icons.get("okay") self._window.setIconByName(icon_name) self._window.setStatus(KStatusNotifierItem.Passive) self._window.connect(self._window, SIGNAL("activateRequested(bool,QPoint)"), self.applet_activated) self._menu = KMenu(_("Magneto Entropy Updates Applet")) self._window.setContextMenu(self._menu) self._menu_items = {} for item in self._menu_item_list: if item is None: self._menu.addSeparator() continue myid, _unused, mytxt, myslot_func = item name = self.get_menu_image(myid) action_icon = KIcon(name) w = KAction(action_icon, mytxt, self._menu) self._menu_items[myid] = w self._window.connect(w, SIGNAL("triggered()"), myslot_func) self._menu.addAction(w) self._menu.hide()
def __init__(self): app_name = "magneto" catalog = "" prog_name = ki18n("Magneto") version = "1.0" description = ki18n("System Update Status") lic = KAboutData.License_GPL cright = ki18n("(c) 2013 Fabio Erculiani") text = ki18n("none") home_page = "www.sabayon.org" bug_mail = "*****@*****.**" self._kabout = KAboutData (app_name, catalog, prog_name, version, description, lic, cright, text, home_page, bug_mail) argv = [sys.argv[0]] KCmdLineArgs.init(argv, self._kabout) self._app = KApplication() from dbus.mainloop.qt import DBusQtMainLoop super(Magneto, self).__init__(main_loop_class = DBusQtMainLoop) self._window = KStatusNotifierItem() # do not show "Quit" and use quitSelected() signal self._window.setStandardActionsEnabled(False) icon_name = self.icons.get("okay") self._window.setIconByName(icon_name) self._window.setStatus(KStatusNotifierItem.Passive) self._window.connect(self._window, SIGNAL("activateRequested(bool,QPoint)"), self.applet_activated) self._menu = KMenu(_("Magneto Entropy Updates Applet")) self._window.setContextMenu(self._menu) self._menu_items = {} for item in self._menu_item_list: if item is None: self._menu.addSeparator() continue myid, _unused, mytxt, myslot_func = item name = self.get_menu_image(myid) action_icon = KIcon(name) w = KAction(action_icon, mytxt, self._menu) self._menu_items[myid] = w self._window.connect(w, SIGNAL("triggered()"), myslot_func) self._menu.addAction(w) self._menu.hide()
class Widget(QtGui.QWidget, ScreenWidget): title = ki18n("Bug Reporting Tool") desc = ki18n("Goodbye Screen") def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_bugWidget() self.ui.setupUi(self) self.bug_submitted = False def shown(self): if not self.bug_submitted: bugz = self.shared['bugzilla'] title = self.shared['summary'] description = self.shared['description'] product = FEATURE_PRODUCT component = FEATURE_COMPONENT data = {'version': FEATURE_VERSION} if self.shared['type'] == 'bug': product = BUG_PRODUCT component = BUG_COMPONENT data['version'] = BUG_VERSION bid = bugz.post(product, component, title, description, **data) if bid == 0: raise RuntimeError, 'Error submitting bug to %s' % BUGZILLA_URL url = '%s?id=%d' % (urljoin(BUGZILLA_URL, config.urls['show']), bid) print url self.ui.linkText.setText('You can view your report online by ' 'clicking <a href=%s>here</a>' % url) # sumbitting attachments files = self.shared['attachments'] for k in files: tmp = tempfile.NamedTemporaryFile() filename, mime, content = files[k] tmp.write(content) tmp.flush() tmp.seek(0) res = bugz.attach(bid, filename, k, tmp.name, mime, filename) if not res: raise RuntimeError, 'Error uploading file %s' % filename self.bug_submitted = True def execute(self): return True @property def shared(self): return self.parent().parent().parent().shared_data
class Widget(QtGui.QWidget, Screen): title = ki18n("Search") desc = ki18n("Enable / Disable Strigi Desktop Search") def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_searchWidget() self.ui.setupUi(self) # set initial states self.ui.checkBoxNepomuk.setChecked(True) # set signals self.ui.checkBoxNepomuk.connect(self.ui.checkBoxNepomuk, SIGNAL("toggled(bool)"), self.enableSearch) def enableSearch(self): if self.ui.showTray.isChecked(): self.ui.checkUpdate.setVisible(True) self.ui.updateInterval.setVisible(True) else: self.ui.checkUpdate.setChecked(False) self.ui.checkUpdate.setVisible(False) self.ui.checkUpdate.setCheckState(Qt.Unchecked) self.ui.updateInterval.setVisible(False) def updateSelected(self): #if self.ui.checkUpdate.isChecked(): # self.ui.updateInterval.setEnabled(True) #else: # self.ui.updateInterval.setEnabled(False) # TODO: Where are Nepomuk/Strigi settings stored? print "This part still needs to be written." def applySettings(self): # write selected configurations to future package-managerrc config = PMConfig() config.setSystemTray(QVariant(self.ui.showTray.isChecked())) config.setUpdateCheck(QVariant(self.ui.checkUpdate.isChecked())) config.setUpdateCheckInterval( QVariant(self.ui.updateInterval.value() * 60)) if self.ui.showTray.isChecked(): p = subprocess.Popen(["spun"], stdout=subprocess.PIPE) def shown(self): pass def execute(self): self.applySettings() return True
def execute(self): self.__class__.screenSettings["summaryMessage"] ={} self.__class__.screenSettings["summaryMessage"].update({"selectedMouse": ki18n("Left Handed") if self.__class__.screenSettings["selectedMouse"] == "LeftHanded" else ki18n("Right Handed")}) self.__class__.screenSettings["summaryMessage"].update({"clickBehaviour": ki18n("Single Click ") if self.clickBehaviour == "True" else ki18n("Double Click")}) config = KConfig("kdeglobals") group = config.group("KDE") group.writeEntry("SingleClick", QString(self.clickBehaviour)) config.sync() KGlobalSettings.self().emitChange(KGlobalSettings.SettingsChanged, KGlobalSettings.SETTINGS_MOUSE) return True
class Widget(QtGui.QWidget, ScreenWidget): title = ki18n("Bug Reporting Tool") desc = ki18n("Welcome to Bug Reporting Tool :)") def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_bugWidget() self.ui.setupUi(self) def shown(self): pass def execute(self): return True
def __init__(self): aboutData = KAboutData(APP_NAME, CATALOG, PROGRAM_NAME, VERSION, DESCRIPTION, LICENSE, COPYRIGHT, TEXT, HOMEPAGE, BUG_EMAIL) aboutData.addAuthor(ki18n("GuoCi"), ki18n("Python 3 port maintainer"), "*****@*****.**", "") aboutData.addAuthor(ki18n("Chris Dekter"), ki18n("Developer"), "*****@*****.**", "") aboutData.addAuthor(ki18n("Sam Peterson"), ki18n("Original developer"), "*****@*****.**", "") aboutData.setProgramIconName(common.ICON_FILE) self.aboutData = aboutData KCmdLineArgs.init(sys.argv, aboutData) options = KCmdLineOptions() options.add("l").add("verbose", ki18n("Enable verbose logging")) options.add("c").add("configure", ki18n("Show the configuration window on startup")) KCmdLineArgs.addCmdLineOptions(options) args = KCmdLineArgs.parsedArgs() self.app = KApplication() try: # Create configuration directory if not os.path.exists(CONFIG_DIR): os.makedirs(CONFIG_DIR) # Create data directory (for log file) if not os.path.exists(DATA_DIR): os.makedirs(DATA_DIR) # Create run directory (for lock file) if not os.path.exists(RUN_DIR): os.makedirs(RUN_DIR) # Initialise logger rootLogger = logging.getLogger() rootLogger.setLevel(logging.DEBUG) if args.isSet("verbose"): handler = logging.StreamHandler(sys.stdout) else: handler = logging.handlers.RotatingFileHandler( LOG_FILE, maxBytes=MAX_LOG_SIZE, backupCount=MAX_LOG_COUNT) handler.setLevel(logging.INFO) handler.setFormatter(logging.Formatter(LOG_FORMAT)) rootLogger.addHandler(handler) if self.__verifyNotRunning(): self.__createLockFile() self.initialise(args.isSet("configure")) except Exception as e: self.show_error_dialog( i18n("Fatal error starting AutoKey.\n") + str(e)) logging.exception("Fatal error starting AutoKey: " + str(e)) sys.exit(1)
def make_about_data(): appName = "viewshow" catalog = "" programName = kdecore.ki18n("ViewShow") version = "0.5" description = kdecore.ki18n("A KDE screen recorder.") license = kdecore.KAboutData.License_GPL copyright = kdecore.ki18n("(c) 2015 Victor Varvaryuk") text = kdecore.ki18n("") homePage = "https://github.com/warvariuc/viewshow" bugEmail = "" global _about_data _about_data = kdecore.KAboutData(appName, catalog, programName, version, description, license, copyright, text, homePage, bugEmail) return _about_data
def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_Form() self.ui.setupUi(self) self.camActive = False Widget.desc = QVariant(unicode(ki18n("Create Your User Picture").toString())) self.pictureTaken = 0 self.ui.takeButton.hide() for dev in os.listdir("/dev"): if dev.startswith("video"): cam = v4l2capture.Video_device(os.path.join("/dev", dev)) cam_driver, cam_card, cam_bus, cam_capabilities = cam.get_info() cam_str = "%s - %s" % (cam_card, os.path.join("/dev", dev)) if "video_capture" in cam_capabilities: if "radio" in cam_capabilities or "tuner" in cam_capabilities: continue self.ui.comboBox.addItem(cam_str, QVariant(os.path.join("/dev", dev))) self.timer = QtCore.QTimer(self) self.connect(self.timer, QtCore.SIGNAL("timeout()"), self.refreshCam) self.connect(self.ui.comboBox, QtCore.SIGNAL('activated(QString)'), self.processSelection) self.connect(self.ui.takeButton, QtCore.SIGNAL('clicked()'), self.showPicture) self.connect(self.ui.takeAgainButton, QtCore.SIGNAL('clicked()'), self.activateCam) self.ui.takeAgainButton.hide()
def createConfigurationInterface(self, parent): self.configDlg = ConfigDlg(parent, self.applet) page = parent.addPage(self.configDlg, ki18n("GetStuffBack Options").toString()) page.setIcon(KIcon("user-desktop")) parent.okClicked.connect(self.configAccepted)
def init(self): self.setHasConfigurationInterface(True) self.setAspectRatioMode(Plasma.IgnoreAspectRatio) self.settings = self.config() self.theme = Plasma.Svg(self) self.theme.setImagePath("widgets/background") self.setBackgroundHints(Plasma.Applet.DefaultBackground) self.layout = QGraphicsGridLayout(self.applet) self.layout.setColumnSpacing(0,5.0) self.lblTitle = Plasma.Label(self.applet) self.lblTitle.nativeWidget().setText( ki18n("Stuff to get back").toString()) self.lblTitle.setAlignment(Qt.AlignHCenter) self.lblTitle.setStyleSheet("""QLabel { text-align:center; font-style: italic; font-weight: bold;}""") self.layout.addItem(self.lblTitle,0,0,1,3) self.btnAdd = Plasma.PushButton(self.applet) self.btnAdd.nativeWidget().setGuiItem(KStandardGuiItem.Add) self.layout.addItem(self.btnAdd,1,0) self.btnRemove = Plasma.PushButton(self.applet) self.btnRemove.nativeWidget().setGuiItem(KStandardGuiItem.Remove) self.layout.addItem(self.btnRemove,1,2) self.db = GSBDbModel() self.view = Plasma.TreeView(self.applet) self.view.setModel(self.db) self.view.nativeWidget().setColumnHidden(self.db.IDCOL,True) self.view.nativeWidget().setRootIsDecorated(False) self.view.nativeWidget().setExpandsOnDoubleClick(False) self.view.nativeWidget().setItemsExpandable(False) self.view.setStyleSheet(""" QTreeView { background-color: transparent; } QTreeView::item { padding-top:10px; padding-bottom: 10px; } """) self.view.nativeWidget().header().resizeSections( QHeaderView.ResizeToContents) self.view.nativeWidget().setItemDelegate( LoanDelegate( self.applet, self.view.nativeWidget())) self.layout.addItem(self.view,2,0,1,3) self.setLayout(self.layout) self.btnAdd.clicked.connect(self.add_loan) self.btnRemove.clicked.connect(self.remove_loan)
class Widget(QtGui.QWidget, Screen): title = ki18n("Welcome") desc = ki18n("Welcome to %s") def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_welcomeWidget() self.ui.setupUi(self) Widget.desc = QVariant(unicode(Widget.desc.toString()) % tools.getRelease()) def shown(self): pass def execute(self): return True
class Widget(QtGui.QWidget, ScreenWidget): title = ki18n("Welcome") desc = ki18n("Welcome to Kaptan Wizard :)") def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_welcomeWidget() self.ui.setupUi(self) self.ui.pixKaptanLogo.setPixmap( QtGui.QPixmap(':/raw/pics/kaptan_welcome.png')) def shown(self): pass def execute(self): return True
def get_loan(self,loan_ID): obj = [loan for loan in self.loans if loan.ID == loan_ID] if len(obj) < 1: return None elif len(obj) > 1: raise Exception(ki18n("Duplicate item with ID %1").arg(loan_ID).toString()) return obj[0]
def main(): about = KAboutData( b'synaptiks', '', ki18n('synaptiks'), str(synaptiks.__version__), ki18n('touchpad management and configuration application'), KAboutData.License_BSD, ki18n('Copyright (C) 2009, 2010 Sebastian Wiesner')) about.addAuthor(ki18n('Sebastian Wiesner'), ki18n('Maintainer'), '*****@*****.**') about.addCredit(ki18n('Valentyn Pavliuchenko'), ki18n('Debian packaging, russian translation, ' 'bug reporting and testing'), '*****@*****.**') about.setHomepage('http://synaptiks.lunaryorn.de/') about.setOrganizationDomain('synaptiks.lunaryorn.de') KCmdLineArgs.init(sys.argv, about) app = KApplication() window = KMainWindow() touchpad = Touchpad.find_first(Display.from_qt()) config = TouchpadConfiguration(touchpad) config_widget = TouchpadConfigurationWidget(config) config_widget.configurationChanged.connect( partial(print, 'config changed?')) window.setCentralWidget(config_widget) window.show() app.exec_()
def main(): about = KAboutData( b'synaptiks', '', ki18n('synaptiks'), str(synaptiks.__version__), ki18n('touchpad management and configuration application'), KAboutData.License_BSD, ki18n('Copyright (C) 2009, 2010 Sebastian Wiesner')) about.addAuthor(ki18n('Sebastian Wiesner'), ki18n('Maintainer'), '*****@*****.**') about.addCredit( ki18n('Valentyn Pavliuchenko'), ki18n('Debian packaging, russian translation, ' 'bug reporting and testing'), '*****@*****.**') about.setHomepage('http://synaptiks.lunaryorn.de/') about.setOrganizationDomain('synaptiks.lunaryorn.de') KCmdLineArgs.init(sys.argv, about) app = KApplication() window = KMainWindow() touchpad = Touchpad.find_first(Display.from_qt()) config = TouchpadConfiguration(touchpad) config_widget = TouchpadConfigurationWidget(config) config_widget.configurationChanged.connect( partial(print, 'config changed?')) window.setCentralWidget(config_widget) window.show() app.exec_()
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)
class Widget(QtGui.QWidget, ScreenWidget): title = ki18n("Network Manager") desc = ki18n("Network Manager") running = False proc = QProcess() def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_networkWidget() self.ui.setupUi(self) moduleInfo = KCModuleInfo("kcm_networkmanager.desktop") nm = KCModuleProxy(moduleInfo) self.ui.layout.addWidget(nm) def execute(self): return True
def get_time_from_loan(self, aDate = datetime.today() ): """return a timedelta between original loan date and a given date""" if self.date is None: raise Exception(ki18n("Loan entered without a date!").toString()) # if loan date is in the future, return None if aDate < self.date: return None return aDate - self.date
def main(argv=None): appName = "Kuad" catalog = "" programName = ki18n ("Kuad") version = "1.0" description = ki18n ("Tiled Multi-Konsole") license = KAboutData.License_GPL copyright = ki18n ("(c) 2010 Stuart Zilm") text = ki18n ("none") homePage = "www.stuartzilm.com" bugEmail = "*****@*****.**" aboutData = KAboutData (appName, catalog, programName, version, description, license, copyright, text, homePage, bugEmail) KCmdLineArgs.init (sys.argv, aboutData) app = KuadApplication () return exit(app.exec_())
class Widget(QtGui.QWidget, Screen): title = ki18n("More") desc = ki18n("Congratulations!") def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_goodbyeWidget() self.ui.setupUi(self) lang = KGlobal.locale().language() if lang == "tr": self.helpPageUrl = "http://www.pisilinux.org" else: self.helpPageUrl = "http://www.pisilinuxworld.org" self.smoltUrl = "http://smolt.pisilinux.org:8090" def on_buttonSystemSettings_clicked(self): self.procSettings = QProcess() self.procSettings.start("systemsettings") def on_buttonHelpPages_clicked(self): self.procSettings = QProcess() command = "kfmclient openURL " + self.helpPageUrl self.procSettings.start(command) def on_buttonSystemSettings_2_clicked(self): self.procSettings = QProcess() command = "kfmclient openURL " + self.smoltUrl self.procSettings.start(command) def setSmolt(self): if not self.smoltSettings["profileSend"]: self.ui.smoltGroupBox.hide() self.ui.label.hide() def shown(self): self.smoltSettings = smoltWidget.Widget.screenSettings self.setSmolt() def execute(self): return True
class Widget(QtGui.QWidget, ScreenWidget): title = ki18n("Bug Reporting Tool") desc = ki18n("Welcome to Bug Reporting Tool :)") def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_bugWidget() self.ui.setupUi(self) self.ui.checkBox.setVisible(False) def shown(self): pass def execute(self): return True def setCheckBox(self, text=None): if text is not None: self.ui.checkBox.setVisible(True) self.ui.checkBox.setText(text)
def setTableWidget(self): ''' Specify the tableWidget properties ''' colLabel = kdecore.ki18n("Label").toString() colData = kdecore.ki18n("Data").toString() item = QtGui.QTableWidgetItem(colLabel) self.ui.tableWidget.setHorizontalHeaderItem(0, item) item = QtGui.QTableWidgetItem(colData) self.ui.tableWidget.setHorizontalHeaderItem(1, item) #self.ui.tableWidget.setHorizontalHeaderLabels(labels) self.ui.tableWidget.horizontalHeader().setResizeMode(0, QtGui.QHeaderView.ResizeToContents) self.ui.tableWidget.horizontalHeader().setResizeMode(1, QtGui.QHeaderView.Stretch) self.ui.tableWidget.verticalHeader().hide() self.ui.tableWidget.setShowGrid(False) self.ui.tableWidget.setSortingEnabled(False) self.ui.tableWidget.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) self.ui.tableWidget.setSelectionMode(QtGui.QAbstractItemView.NoSelection) self.ui.tableWidget.horizontalHeader().setCascadingSectionResizes(True)
class Widget(QtGui.QWidget, ScreenWidget): screenSettings = {} screenSettings["hasChanged"] = True # Set title and description for the information widget title = ki18n("Some catchy title about desktop search") desc = ki18n("Some catchy description desktop search") def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_searchWidget() self.ui.setupUi(self) self.ui.labelSearchImage.setPixmap(QtGui.QPixmap(':/raw/pics/nepomuk.png')) config = KConfig("nepomukserverrc") group = config.group("Basic Settings") isNepomuk = str(group.readEntry('Start Nepomuk')) if isNepomuk.lower() == "true": self.ui.checkBoxNepomuk.setChecked(True) self.__class__.screenSettings["state"] = True else: self.ui.checkBoxNepomuk.setChecked(False) self.__class__.screenSettings["state"] = False self.ui.checkBoxNepomuk.connect(self.ui.checkBoxNepomuk, SIGNAL("toggled(bool)"), self.activateNepomuk) def activateNepomuk(self, state): self.__class__.screenSettings["state"] = state self.__class__.screenSettings["hasChanged"] = True def shown(self): pass def execute(self): if self.__class__.screenSettings["state"] == True: self.__class__.screenSettings["summaryMessage"] = ki18n("On") else: self.__class__.screenSettings["summaryMessage"] = ki18n("Off") return True
def main(): app_name = "nepomuk_tag_example" program_name = kdecore.ki18n("Example Nepomuk application (PyKDE4)") about_data = kdecore.KAboutData(QtCore.QByteArray(app_name), "", program_name, QtCore.QByteArray("0.1")) kdecore.KCmdLineArgs.init(sys.argv, about_data) app = kdeui.KApplication() nepomuk_examples() QtCore.QTimer.singleShot(3000, app.quit) app.exec_()
def main(): app_name = "kio_storedget_example" program_name = kdecore.ki18n("Example KIO usage (PyKDE4)") about_data = kdecore.KAboutData(QtCore.QByteArray(app_name), "", program_name, QtCore.QByteArray("0.1")) kdecore.KCmdLineArgs.init(sys.argv, about_data) app = kdeui.KApplication() mainwindow = ExampleWindow() mainwindow.show() app.exec_()
def __init__(self): appName = "usb-creator-kde" catalogue = "usbcreator" programName = ki18n("Startup Disk Creator") version = "0.2.23" description = ki18n("Create a startup disk using a CD or disc image") license = KAboutData.License_GPL_V3 copyright = ki18n("Copyright 2009 Roderick B. Greening") text = KLocalizedString() homePage = "http://launchpad.net/usb-creator" bugEmail = "*****@*****.**" KAboutData.__init__(self, appName, catalogue, programName, version, description, license, copyright, text, homePage, bugEmail) # Add any authors below self.addAuthor(ki18n("Roderick B. Greening"), ki18n("Author/Maintainer"), "*****@*****.**")
def __init__(self, argv, opts): """ Constructor @param argv command line arguments @param opts acceptable command line options """ loc = _localeString() os.environ["KDE_LANG"] = loc aboutData = KAboutData( Program, "kdelibs", ki18n(Program), Version, ki18n(""), KAboutData.License_GPL, ki18n(Copyright), ki18n ("none"), Homepage, BugAddress) sysargv = argv[:] KCmdLineArgs.init(sysargv, aboutData) if opts: options = KCmdLineOptions() for opt in opts: if len(opt) == 2: options.add(opt[0], ki18n(opt[1])) else: options.add(opt[0], ki18n(opt[1]), opt[2]) KCmdLineArgs.addCmdLineOptions(options) KApplication.__init__(self, True) KQApplicationMixin.__init__(self)
def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_menuWidget() self.ui.setupUi(self) # read default menu style first config = KConfig("plasma-desktop-appletsrc") group = config.group("Containments") self.menuNames = {} self.menuNames["launcher"] = { "menuIndex": 0, "summaryMessage": ki18n("Kick-off Menu"), "image": QtGui.QPixmap(":/raw/pixmap/kickoff.png"), "description": ki18n( "Kick-off menu is the default menu of Pisi Linux.<br><br>The program shortcuts are easy to access and well organized." ), } self.menuNames["simplelauncher"] = { "menuIndex": 1, "summaryMessage": ki18n("Simple Menu"), "image": QtGui.QPixmap(":/raw/pixmap/simple.png"), "description": ki18n( "Simple menu is an old style menu from KDE 3.<br><br>It is a very lightweight menu thus it is recommended for slower PC's." ), } self.menuNames["lancelot_launcher"] = { "menuIndex": 2, "summaryMessage": ki18n("Lancelot Menu"), "image": QtGui.QPixmap(":/raw/pixmap/lancelot.png"), "description": ki18n( "Lancelot is an advanced and highly customizable menu for Pisi Linux.<br><br>The program shortcuts are easy to access and well organized." ), } for each in list(group.groupList()): subgroup = group.group(each) subcomponent = subgroup.readEntry("plugin") if subcomponent == "panel": subg = subgroup.group("Applets") for i in list(subg.groupList()): subg2 = subg.group(i) launcher = subg2.readEntry("plugin") if str(launcher).find("launcher") >= 0: self.__class__.screenSettings["selectedMenu"] = subg2.readEntry("plugin") # set menu preview to default menu # if default menu could not found, default to kickoff if not self.__class__.screenSettings.has_key("selectedMenu"): self.__class__.screenSettings["selectedMenu"] = "launcher" self.ui.pictureMenuStyles.setPixmap(self.menuNames[str(self.__class__.screenSettings["selectedMenu"])]["image"]) self.ui.labelMenuDescription.setText( self.menuNames[str(self.__class__.screenSettings["selectedMenu"])]["description"].toString() ) self.ui.menuStyles.setCurrentIndex( self.menuNames[str(self.__class__.screenSettings["selectedMenu"])]["menuIndex"] ) self.ui.menuStyles.connect(self.ui.menuStyles, SIGNAL("activated(const QString &)"), self.setMenuStyle)
class Widget(QtGui.QWidget, ScreenWidget): title = ki18n("Bug Reporting Tool") desc = ki18n("Welcome to Bug Reporting Tool :)") def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_bugWidget() self.ui.setupUi(self) def shown(self): pass def execute(self): return True def set_progress(self, value=None): if value is None: self.ui.progress.setRange(0, 0) self.ui.progress.setValue(0) else: self.ui.progress.setRange(0, 100) self.ui.progress.setValue(value * 1000)
def main(): global app, aboutData import setproctitle setproctitle.setproctitle("iosshy") from PyQt4.QtCore import QCoreApplication, QTranslator, QLocale, QSettings from PyQt4.QtGui import QApplication, QSystemTrayIcon, QImage from tunneldialog import TunnelDialog try: from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineArgs from PyKDE4.kdeui import KApplication, KIcon aboutData = KAboutData( name, #appName name, #catalogName ki18n(name), #programName version, ki18n(description), #shortDescription KAboutData.License_BSD, #licenseKey ki18n("© 2010 Massimiliano Torromeo"), #copyrightStatement ki18n(""), #text url #homePageAddress ) aboutData.setBugAddress("http://github.com/mtorromeo/iosshy/issues") aboutData.addAuthor( ki18n("Massimiliano Torromeo"), #name ki18n("Main developer"), #task "*****@*****.**" #email ) aboutData.setProgramLogo(QImage(":icons/network-server.png")) KCmdLineArgs.init(sys.argv, aboutData) app = KApplication() app.setWindowIcon(KIcon("network-server")) if app.isSessionRestored(): sys.exit(0) except ImportError: app = QApplication(sys.argv) app.setOrganizationName("MTSoft") app.setApplicationName(name) if QSystemTrayIcon.isSystemTrayAvailable(): translator = QTranslator() qmFile = "tunneller_%s.qm" % QLocale.system().name() if os.path.isfile(qmFile): translator.load(qmFile) app.installTranslator(translator) dialog = TunnelDialog() sys.exit(app.exec_()) else: print "System tray not available. Exiting." sys.exit(1)
def get_param_options(): """ Add the parameters that are to be recognized by pynal to a KCmdLineOptions object. Options: <files> -- A list of files that will be opened after start. """ options = KCmdLineOptions() options.add("+[<files>]", ki18n("Files to open on startup.")) return options
def __init__(self): aboutData = KAboutData(APP_NAME, CATALOG, PROGRAM_NAME, VERSION, DESCRIPTION, LICENSE, COPYRIGHT, TEXT, HOMEPAGE, BUG_EMAIL) aboutData.addAuthor(ki18n("GuoCi"), ki18n("Python 3 port maintainer"), "*****@*****.**", "") aboutData.addAuthor(ki18n("Chris Dekter"), ki18n("Developer"), "*****@*****.**", "") aboutData.addAuthor(ki18n("Sam Peterson"), ki18n("Original developer"), "*****@*****.**", "") aboutData.setProgramIconName(common.ICON_FILE) self.aboutData = aboutData KCmdLineArgs.init(sys.argv, aboutData) options = KCmdLineOptions() options.add("l").add("verbose", ki18n("Enable verbose logging")) options.add("c").add("configure", ki18n("Show the configuration window on startup")) KCmdLineArgs.addCmdLineOptions(options) args = KCmdLineArgs.parsedArgs() self.app = KApplication() try: # Create configuration directory if not os.path.exists(CONFIG_DIR): os.makedirs(CONFIG_DIR) # Initialise logger rootLogger = logging.getLogger() rootLogger.setLevel(logging.DEBUG) if args.isSet("verbose"): handler = logging.StreamHandler(sys.stdout) else: handler = logging.handlers.RotatingFileHandler(LOG_FILE, maxBytes=MAX_LOG_SIZE, backupCount=MAX_LOG_COUNT) handler.setLevel(logging.INFO) handler.setFormatter(logging.Formatter(LOG_FORMAT)) rootLogger.addHandler(handler) if self.__verifyNotRunning(): self.__createLockFile() self.initialise(args.isSet("configure")) except Exception as e: self.show_error_dialog(i18n("Fatal error starting AutoKey.\n") + str(e)) logging.exception("Fatal error starting AutoKey: " + str(e)) sys.exit(1)
class Widget(QtGui.QWidget, ScreenWidget): title = ki18n("Bug Reporting Tool") desc = ki18n("Welcome to Bug Reporting Tool :)") def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_bugWidget() self.ui.setupUi(self) def shown(self): pass def execute(self): return True def get_userpass(self): username = str(self.ui.username.text()) password = str(self.ui.password.text()) if len(username) == 0 or len(password) == 0: return None else: return (username, password)
def main(): app_name = "kconfigxtexample" program_name = kdecore.ki18n("Example KConfigXT application (PyKDE4)") about_data = kdecore.KAboutData(QtCore.QByteArray(app_name), "", program_name, QtCore.QByteArray("0.1")) kdecore.KCmdLineArgs.init(sys.argv, about_data) app = kdeui.KApplication() settings = preferences.Preferences() dialog = preferences.ConfigDialog(None, "settings", settings) dialog.show() app.exec_()
def main(): app_name = "nepomuk_tag_query_example" program_name = kdecore.ki18n("Example Nepomuk tag query" " application (PyKDE4)") about_data = kdecore.KAboutData(QtCore.QByteArray(app_name), "", program_name, QtCore.QByteArray("0.1")) kdecore.KCmdLineArgs.init(sys.argv, about_data) app = kdeui.KApplication() first_test = NepomukTagQueryExample() first_test.query_tag("test_query") second_test = NepomukTagQueryExample() second_test.query_desktop_query("test_query") QtCore.QTimer.singleShot(5000, app.quit) app.exec_()
def __init__(self,parent, applet): super(ConfigDlg,self).__init__(parent) path = applet.package().path() + "configui/config.ui" confDlg, baseClass = uic.loadUiType(path) self.realDlg = confDlg() self.realDlg.setupUi(self) self.options = applet.config().group("general") overdueColour = QColor( self.options.readEntry("overdue_colour","#ff6666")) grace_period = int(self.options.readEntry("grace","5").toString()) self.btnColour = KColorButton(overdueColour, self) self.realDlg.formLayout.addRow(ki18n("Overdue Colour").toString(), self.btnColour) self.spinGrace = self.realDlg.spinGrace self.spinGrace.setValue(grace_period)