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


Python KCmdLineArgs.addCmdLineOptions方法代码示例

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


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

示例1: __init__

# 需要导入模块: from PyKDE4.kdecore import KCmdLineArgs [as 别名]
# 或者: from PyKDE4.kdecore.KCmdLineArgs import addCmdLineOptions [as 别名]
 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,代码行数:30,代码来源:KQApplication.py

示例2: start

# 需要导入模块: from PyKDE4.kdecore import KCmdLineArgs [as 别名]
# 或者: from PyKDE4.kdecore.KCmdLineArgs import addCmdLineOptions [as 别名]
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,代码行数:29,代码来源:PynalStart.py

示例3: createApp

# 需要导入模块: from PyKDE4.kdecore import KCmdLineArgs [as 别名]
# 或者: from PyKDE4.kdecore.KCmdLineArgs import addCmdLineOptions [as 别名]
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,代码行数:36,代码来源:__init__.py

示例4: __init__

# 需要导入模块: from PyKDE4.kdecore import KCmdLineArgs [as 别名]
# 或者: from PyKDE4.kdecore.KCmdLineArgs import addCmdLineOptions [as 别名]
    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,代码行数:58,代码来源:qtapp.py

示例5: main

# 需要导入模块: from PyKDE4.kdecore import KCmdLineArgs [as 别名]
# 或者: from PyKDE4.kdecore.KCmdLineArgs import addCmdLineOptions [as 别名]
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,代码行数:18,代码来源:__main__.py

示例6: __init__

# 需要导入模块: from PyKDE4.kdecore import KCmdLineArgs [as 别名]
# 或者: from PyKDE4.kdecore.KCmdLineArgs import addCmdLineOptions [as 别名]
    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,代码行数:43,代码来源:kontactwrapper.py

示例7: DBusQtMainLoop

# 需要导入模块: from PyKDE4.kdecore import KCmdLineArgs [as 别名]
# 或者: from PyKDE4.kdecore.KCmdLineArgs import addCmdLineOptions [as 别名]
    # Catch signals
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    # 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)

    # Initialize Command Line arguments from sys.argv
    KCmdLineArgs.init(sys.argv, aboutData)

    # Add Command Line options
    options = KCmdLineOptions()
    options.add("show-mainwindow", ki18n("Show main window"))
    KCmdLineArgs.addCmdLineOptions(options)

    # Create a unique KDE Application
    app = KUniqueApplication(True, True)

    # Set system Locale, we may not need it anymore
    # It should set just before MainWindow call
    setSystemLocale()

    # Create MainWindow
    manager = MainWindow()

    # Check if show-mainwindow used in sys.args to show mainWindow
    args = KCmdLineArgs.parsedArgs()
    if args.isSet("show-mainwindow"):
        manager.show()
开发者ID:Tayyib,项目名称:uludag,代码行数:32,代码来源:main.py


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