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 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 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(): 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 __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 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 __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()
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(): 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 __init__(self): aboutData = KAboutData(APP_NAME, CATALOG, PROGRAM_NAME, VERSION, DESCRIPTION, LICENSE, COPYRIGHT, TEXT, HOMEPAGE, BUG_EMAIL) aboutData.addAuthor(ki18n("Chris Dekter"), ki18n("Developer"), "*****@*****.**", "") aboutData.addAuthor(ki18n("Sam Peterson"), ki18n("Original developer"), "*****@*****.**", "") aboutData.setProgramIconName(common.ICON_FILE) self.aboutData = aboutData aboutData_py3 = KAboutData(APP_NAME, CATALOG, PROGRAM_NAME_PY3, VERSION, DESCRIPTION_PY3, LICENSE, COPYRIGHT_PY3, TEXT, HOMEPAGE_PY3, BUG_EMAIL_PY3) aboutData_py3.addAuthor(ki18n("GuoCi"), ki18n("Python 3 port maintainer"), "*****@*****.**", "") aboutData_py3.addAuthor(ki18n("Chris Dekter"), ki18n("Developer"), "*****@*****.**", "") aboutData_py3.addAuthor(ki18n("Sam Peterson"), ki18n("Original developer"), "*****@*****.**", "") aboutData_py3.setProgramIconName(common.ICON_FILE) self.aboutData_py3 = aboutData_py3 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)
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 main(): about = make_about_data(ki18nc('tray application description', 'touchpad management application')) KCmdLineArgs.init(sys.argv, about) KUniqueApplication.addCmdLineOptions() if not KUniqueApplication.start(): return app = SynaptiksApplication() app.exec_()
def main(): """Creates an application from the cmd line args and starts a editor window""" KCmdLineArgs.init(sys.argv, ABOUT) opts = KCmdLineOptions() opts.add('+[file]', ki18n('File to open')) KCmdLineArgs.addCmdLineOptions(opts) args = KCmdLineArgs.parsedArgs() urls = [args.url(i) for i in range(args.count())] #wurgs app = KApplication() #KGlobal.locale().setLanguage(['de']) TODO win = Markdowner(urls) win.show() sys.exit(app.exec_())
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_())
def __init__(self, args): self.getLogin() self.providerPluginManager = PluginManager("providerplugins","providerplugins", providerplugins.Provider.Provider) aboutData = KAboutData ( "Wrapper", "blubb", ki18n("Wrapper for kontact"), "sdaf", ki18n("Displays a KMessageBox popup"), KAboutData.License_GPL, ki18n("(c) 2010"), ki18n("This is a wrapper for kontact to access the multimobileservice"), "http://puzzle.ch", "*****@*****.**" ) KCmdLineArgs.init(sys.argv, aboutData) cmdoptions = KCmdLineOptions() cmdoptions.add("nr <speed>", ki18n("The phone nr")) cmdoptions.add("smsfile <file>", ki18n("The smsfile")) cmdoptions.add("smstext <text>", ki18n("The smstext")) cmdoptions.add("plugin <string>", ki18n("The pluginname")) KCmdLineArgs.addCmdLineOptions(cmdoptions) app = KApplication() lineargs = KCmdLineArgs.parsedArgs() plugin = self.getRightPlugin(lineargs.getOption("plugin")) plugin.addNr(lineargs.getOption("nr")) if lineargs.getOption("smsfile") != "": plugin.setText(self.file2String(lineargs.getOption("smsfile"))) elif lineargs.getOption("smstext") != "": plugin.setText(lineargs.getOption("smstext")) else: KMessageBox.error(None, i18n("No text defined.."), i18n("Text undefined")) raise RuntimeError("No text defined!") plugin.setConfig(self.config) try: plugin.execute() KMessageBox.information(None, i18n("Your SMS was sendet successfull to "+lineargs.getOption("nr")+" with Plugin "+plugin.getObjectname()), i18n("Success")) except Exception, e: KMessageBox.error(None, i18n(e), i18n("Error"))
signal.signal(signal.SIGINT, signal.SIG_DFL) if not dbus.get_default_main_loop(): from dbus.mainloop.qt import DBusQtMainLoop DBusQtMainLoop(set_as_default = True) from optparse import OptionParser usage = ctx.Pds.i18n("%prog packages_to_install") parser = OptionParser(usage=usage) args = filter(lambda x: not x.startswith('-'), sys.argv[1:]) if len(sys.argv) > 1: from mainwindow import MainWindow if ctx.Pds.session == ctx.pds.Kde4: KCmdLineArgs.init([], aboutData) app = KApplication() else: app = QtGui.QApplication(sys.argv) font = ctx.Pds.settings('font','Dejavu Sans,10').split(',') app.setFont(QtGui.QFont(font[0], int(font[1]))) setSystemLocale() manager = MainWindow(app, silence = True) manager.centralWidget().state._selected_packages = args manager.centralWidget().state.operationAction(args, silence = True) manager.centralWidget().progressDialog.show() sys.excepthook = handleException ctx._time()
optlist = getopt.getopt(sys.argv[0:], 'h', ['help','help-all', 'm','appname']) except getopt.GetoptError, err: print "ERROR:", str(err) usage() sys.exit(2) if not sys.argv[1:]: sysarg = sys.argv else: sysarg = sys.argv[1:] for opt in optlist[1:]: if "-m" in opt: sysarg = sys.argv[1:] else: sysarg = sys.argv KCmdLineArgs.init(sysarg, aboutData) app = kdeui.KApplication() if not dbus.get_default_main_loop(): from dbus.mainloop.qt import DBusQtMainLoop DBusQtMainLoop(set_as_default = True) profiler = Profiler() profiler.show() rect = QtGui.QDesktopWidget().screenGeometry() profiler.move(rect.width()/2 - profiler.width()/2, rect.height()/2 - profiler.height()/2) app.exec_()
def run(): appName = "eclectus" catalog = "eclectusqt" programName = ki18n("Eclectus") version = eclectusqt.__version__ description = ki18n("Han character dictionary") license = KAboutData.License_GPL_V3 copyright = ki18n("(c) 2008-2009 Christoph Burgmer") text = ki18n( "Eclectus is a small Han character dictionary for learners.") homePage = eclectusqt.__url__ bugEmail = "*****@*****.**" bugAddress = "http://code.google.com/p/eclectus/issues/list" aboutData = KAboutData(appName, catalog, programName, version, description, license, copyright, text, homePage, bugEmail) aboutData.addAuthor(ki18n("Christoph Burgmer"), ki18n("Developer"), "*****@*****.**", "http://cburgmer.nfshost.com/") aboutData.setCustomAuthorText(ki18n("Please use %1 to report bugs.")\ .subs(bugAddress), ki18n('Please use %1 to report bugs.')\ .subs('<a href="%s">%s</a>' % (bugAddress, bugAddress))) aboutData.addCredit(KLocalizedString(), ki18n("Arrr, Eclectus sits on the shoulders of some fine pirates:")) aboutData.addCredit(ki18n("Jim Breen and contributors"), ki18n("EDICT"), '', 'http://www.csse.monash.edu.au/~jwb/j_edict.html') aboutData.addCredit(ki18n("Paul Denisowski and current contributors"), ki18n("CEDICT"), '', 'http://www.mdbg.net/chindict/chindict.php') aboutData.addCredit(ki18n("HanDeDict team"), ki18n("HanDeDict"), '', 'http://www.chinaboard.de/chinesisch_deutsch.php') aboutData.addCredit(ki18n("Tomoe developers"), ki18n("Tomoe handwriting recognition"), '*****@*****.**', 'http://tomoe.sourceforge.jp') aboutData.addCredit(ki18n("Mathieu Blondel and the Tegaki contributors"), ki18n("Tegaki handwriting recognition"), u'mathieu ÂT mblondel DÔT org'.encode('utf8'), 'http://tegaki.sourceforge.net') aboutData.addCredit(ki18n("Unicode Consortium and contributors"), ki18n("Unihan database"), '', 'http://unicode.org/charts/unihan.html') aboutData.addCredit(ki18n("Commons Stroke Order Project"), ki18n("Stroke order pictures"), '', 'http://commons.wikimedia.org/wiki/Commons:Stroke_Order_Project') aboutData.addCredit(ki18n("Tim Eyre, Ulrich Apel and the Wadoku Project"), ki18n("Kanji stroke order font"), '', 'http://sites.google.com/site/nihilistorguk/') aboutData.addCredit( ki18n("Yue Tan, Wei Gao, Vion Nicolas and the Shtooka Project"), ki18n("Pronunciation examples for Mandarin"), '', 'http://shtooka.net') # find logo file, don't directly use util.getData(), KApplication not # created yet aboutLogoFile = u'/usr/share/kde4/apps/eclectus/eclectus_about.png' if not os.path.exists(aboutLogoFile): modulePath = os.path.dirname(os.path.abspath(__file__)) aboutLogoFile = os.path.join(modulePath, 'data', 'eclectus_about.png') if not os.path.exists(aboutLogoFile): aboutLogoFile = util.getData('eclectus_about.png') if aboutLogoFile: aboutData.setProgramLogo(QVariant(QImage(aboutLogoFile))) KCmdLineArgs.init(sys.argv, aboutData) # create applicaton global g_app g_app = KApplication() # TODO how to access local .mo file? #base = os.path.dirname(os.path.abspath(__file__)) #localeDir = os.path.join(base, "locale") #print localeDir #if os.path.exists(localeDir): #print KGlobal.dirs().addResourceDir('locale', localeDir + '/', True) #print KGlobal.dirs().findResource('locale', 'de/LC_MESSAGES/eclectusqt.mo') # read config file and make global global GeneralConfig global DictionaryConfig global PluginConfig config = KConfig() GeneralConfig = KConfigGroup(config, "General") DictionaryConfig = KConfigGroup(config, "Dictionary") PluginConfig = KConfigGroup(config, "Plugin") # create main window MainWindow().show() # react to CTRL+C on the command line signal.signal(signal.SIGINT, signal.SIG_DFL) g_app.exec_()
def __init__(self): BaseFrontend.__init__(self) self.previous_excepthook = sys.excepthook sys.excepthook = self.excepthook self.debconf_callbacks = {} self.language_questions = ('oem_config', 'language_label', 'language_heading_label', 'timezone_heading_label', 'keyboard_heading_label', 'user_heading_label', 'back', 'next') self.current_step = None # Set default language. dbfilter = language.Language(self, self.debconf_communicator()) dbfilter.cleanup() dbfilter.db.shutdown() self.allowed_change_step = True self.allowed_go_forward = True self.mainLoopRunning = False self.apply_changes = False appName = "oem-config" catalog = "" programName = ki18n("OEM Config") version = "1.0" description = ki18n("Sets up the system") license = KAboutData.License_GPL copyright = ki18n("2006, 2007 Anirudh Ramesh. 2008 Canonical Ltd.") text = ki18n("none") homePage = "http://www.kubuntu.org" bugEmail = "" aboutData = KAboutData(appName, catalog, programName, version, description, license, copyright, text, homePage, bugEmail) KCmdLineArgs.init(['oem-config', '-style=oxygen'], aboutData) self.app = KApplication() # We want to hide the minimise button if running in the ubiquity-only mode (no desktop) # To achieve this we need to set window flags to Dialog but we also need a parent widget which is showing # else Qt tried to be clever and puts the minimise button back self.parentWidget = QWidget() self.parentWidget.show() # The parent for our actual user interface window, this is needed only because Oxygen widget # style refuses to draw our background on a top level widget self.parent2 = QWidget(self.parentWidget) self.parent2.setAutoFillBackground(True) self.parent2.setWindowState(Qt.WindowFullScreen) self.parent2.setWindowFlags(Qt.Dialog) layout = QVBoxLayout(self.parent2) layout.setContentsMargins(0, 0, 0, 0) self.userinterface = OEMConfUI(self.parent2) self.userinterface.setFrontend(self) layout.addWidget(self.userinterface) self.parent2.show() self.userinterface.next.setIcon(KIcon("go-next")) self.userinterface.back.setIcon(KIcon("go-previous")) self.translate_widgets() self.customize_installer() self.tzmap = TimezoneMap(self) map_vbox = QVBoxLayout(self.userinterface.map_frame) map_vbox.setMargin(0) map_vbox.addWidget(self.tzmap)
import dbus # Application stuffs from PyQt4.QtCore import SIGNAL #PyKDE4 stuffs from PyKDE4.kdeui import KUniqueApplication from PyKDE4.kdecore import KCmdLineArgs if __name__ == "__main__": from konfigtracker.about import aboutData from konfigtracker.konfigtrackermain import KonfigTracker # Create a dbus mainloop if its not exists if not dbus.get_default_main_loop(): from dbus.mainloop.qt import DBusQtMainLoop DBusQtMainLoop(set_as_default=True) # set commandline arguments KCmdLineArgs.init(sys.argv, aboutData) #creating a kapplication instance app = KUniqueApplication(True, True) MainWindow = KonfigTracker(app) MainWindow.show() #app.connect(app, SIGNAL('lastWindowClosed()'), app.quit) # Run the application app.exec_()
appName = "Koo" catalog = "" programName = ki18n("Koo") version = "1.0" description = ki18n("KDE OpenObject Client") license = KAboutData.License_GPL copyright = ki18n("(c) 2009 Albert Cervera i Areny") text = ki18n("none") homePage = "www.nan-tic.com" bugEmail = "*****@*****.**" aboutData = KAboutData(appName, catalog, programName, version, description, license, copyright, text, homePage, bugEmail) KCmdLineArgs.init(arguments, aboutData) app = KApplication() else: app = QApplication(arguments) app.setApplicationName('Koo POS') app.setOrganizationDomain('www.NaN-tic.com') app.setOrganizationName('NaN') try: f = open(Settings.value('koo.stylesheet'), 'r') try: app.setStyleSheet(f.read()) finally: f.close()
programName = ki18n("Frescobaldi") version = "@VERSION@" description = ki18n("LilyPond Music Editor") license = KAboutData.License_GPL copyright = ki18n("Copyright (c) 2008-2010, Wilbert Berendsen") text = KLocalizedString() homepage = "http://www.frescobaldi.org/" bugs = "*****@*****.**" aboutData = KAboutData(appName, catalog, programName, version, description, license, copyright, text, homepage, bugs) aboutData.setTranslator( ki18nc("NAME OF TRANSLATORS", "Your name"), ki18nc("EMAIL OF TRANSLATORS", "*****@*****.**") ) KCmdLineArgs.init(list(sys.argv), aboutData) KComponentData(aboutData).dirs().addPrefix("@CMAKE_INSTALL_PREFIX@") options = KCmdLineOptions() options.add("start <session>", ki18n("Session to start")) options.add("n").add("new", ki18n("Start a new instance")) options.add("e").add("encoding <enc>", ki18n("Encoding to use")) options.add("l").add("line <num>", ki18n("Line number to go to, starting at 1")) options.add("c").add("column <num>", ki18n("Column to go to, starting at 0")) options.add("smart", ki18n("Try to use smart line and column numbers")) options.add("+files", ki18n("LilyPond files to open, may also be textedit URLs")) KCmdLineArgs.addCmdLineOptions(options) args = KCmdLineArgs.parsedArgs() app = not args.isSet("new") and runningApp() or newApp()
from optparse import OptionParser usage = unicode(i18n("%prog packages_to_install")) parser = OptionParser(usage=usage) packages = filter(lambda x: not x.startswith('-'), sys.argv[1:]) argv = list(set(sys.argv[1:]) - set(packages)) argv.append('--nofork') argv.insert(0, sys.argv[0]) if len(sys.argv) > 1: aboutData.setAppName("pm-install") KCmdLineArgs.init(argv, aboutData) # Add Command Line options options = KCmdLineOptions() options.add("hide-summary", ki18n("Hide summary screen")) KCmdLineArgs.addCmdLineOptions(options) app = KUniqueApplication(True, True) setSystemLocale() args = KCmdLineArgs.parsedArgs() window = PmWindow(app, packages, hide_summary = args.isSet("hide-summary")) window.show() app.exec_()
KMainWindow.__init__ (self) self.resize (640, 480) label = QLabel ("This is a simple PyKDE4 program", self) label.setGeometry (10, 10, 200, 20) #--------------- main ------------------ if __name__ == '__main__': appName = "KApplication" catalog = "" programName = ki18n ("KApplication") version = "1.0" description = ki18n ("KApplication/KMainWindow/KAboutData example") 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() mainWindow = MainWindow() mainWindow.show() sys.exit(app.exec_())
def main(): " Main Loop " from getopt import getopt OPAQUE = True BORDER = True try: opts, args = getopt(sys.argv[1:], "hvob", ["version", "help", "opaque", "borderless"]) pass except: pass for o, v in opts: if o in ("-h", "--help"): print( """ Usage: -h, --help Show help informations and exit. -v, --version Show version information and exit. -o, --opaque Use Opaque GUI. -b, --borderless No WM Borders. Run without parameters and arguments to use the GUI. """ ) return sys.exit(1) elif o in ("-v", "--version"): print(__version__) return sys.exit(1) elif o in ("-o", "--opaque"): OPAQUE = False elif o in ("-b", "--borderless"): BORDER = False # define our App try: app = QApplication(sys.argv) app.setApplicationName(__doc__) app.setOrganizationName(__author__) app.setOrganizationDomain(__author__) app.setStyle("Plastique") app.setStyle("Oxygen") except TypeError: aboutData = KAboutData( __doc__, "", ki18n(__doc__), __version__, ki18n(__doc__), KAboutData.License_GPL, ki18n(__author__), ki18n("none"), __url__, __email__, ) KCmdLineArgs.init(sys.argv, aboutData) app = QApplication() app.lastWindowClosed.connect(app.quit) # w is gonna be the mymainwindow class w = MyMainWindow() # set the class with the attribute of translucent background as true if OPAQUE is True: w.setAttribute(Qt.WA_TranslucentBackground, True) # WM Borders if BORDER is False: w.setWindowFlags(w.windowFlags() | Qt.FramelessWindowHint) # run the class w.show() # if exiting the loop take down the app sys.exit(app.exec_())