当前位置: 首页>>代码示例>>Python>>正文


Python kdecore.KCmdLineArgs类代码示例

本文整理汇总了Python中PyKDE4.kdecore.KCmdLineArgs的典型用法代码示例。如果您正苦于以下问题:Python KCmdLineArgs类的具体用法?Python KCmdLineArgs怎么用?Python KCmdLineArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了KCmdLineArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

 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)
开发者ID:usc-bbdl,项目名称:R01_HSC_cadaver_system,代码行数:28,代码来源:KQApplication.py

示例2: __init__

  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()
开发者ID:thomaseichinger,项目名称:TAmarokControle,代码行数:34,代码来源:TAmarokControls.py

示例3: main

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 = "[email protected]"

    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_()
开发者ID:lbeltrame,项目名称:danbooru-client,代码行数:27,代码来源:danbooru_client.py

示例4: main

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'),
                    '[email protected]')
    about.addCredit(ki18n('Valentyn Pavliuchenko'),
                    ki18n('Debian packaging, russian translation, '
                          'bug reporting and testing'),
                    '[email protected]')
    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_()
开发者ID:Ascaf0,项目名称:synaptiks,代码行数:26,代码来源:try_touchpad_config_widget.py

示例5: start

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 = "[email protected]"

    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
开发者ID:Ebolon,项目名称:pynal,代码行数:27,代码来源:PynalStart.py

示例6: main

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    = "[email protected]"
        
        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_ ()
开发者ID:KDE,项目名称:pykde4,代码行数:25,代码来源:kmainwindow.py

示例7: main

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 = "[email protected]"

    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_()
开发者ID:lbeltrame,项目名称:kde-vlc-snapper,代码行数:26,代码来源:kdevlcsnapper.py

示例8: createApp

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    = "[email protected]"

    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
开发者ID:StyXman,项目名称:satyr,代码行数:34,代码来源:__init__.py

示例9: main

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 protected]" #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)
开发者ID:sassman,项目名称:iosshy,代码行数:59,代码来源:application.py

示例10: __init__

    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"), "[email protected]", "")
        aboutData.addAuthor(ki18n("Sam Peterson"), ki18n("Original developer"), "[email protected]", "")
        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"), "[email protected]", "")
        aboutData_py3.addAuthor(ki18n("Chris Dekter"), ki18n("Developer"), "[email protected]", "")
        aboutData_py3.addAuthor(ki18n("Sam Peterson"), ki18n("Original developer"), "[email protected]", "")
        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)
开发者ID:adragomir,项目名称:autokey-py3,代码行数:56,代码来源:qtapp.py

示例11: main

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_()
开发者ID:adaptee,项目名称:synaptiks,代码行数:12,代码来源:trayapplication.py

示例12: __init__

    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    = "[email protected]"

        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()
开发者ID:B-Rich,项目名称:entropy,代码行数:53,代码来源:interfaces.py

示例13: main

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_())
开发者ID:flying-sheep,项目名称:markdowner,代码行数:16,代码来源:__main__.py

示例14: main

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    = "[email protected]"

    aboutData   = KAboutData (appName, catalog, programName, version, description,
        license, copyright, text, homePage, bugEmail)

    KCmdLineArgs.init (sys.argv, aboutData)
    app = KuadApplication ()
    
    return exit(app.exec_())
开发者ID:szilm,项目名称:Kuad,代码行数:19,代码来源:Kuad.py

示例15: __init__

    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", 
            "[email protected]"
        )
 
        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"))
开发者ID:hersche,项目名称:MultiSms,代码行数:41,代码来源:kontactwrapper.py


注:本文中的PyKDE4.kdecore.KCmdLineArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。