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


Python KCmdLineArgs.parsedArgs方法代码示例

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


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

示例1: createApp

# 需要导入模块: from PyKDE4.kdecore import KCmdLineArgs [as 别名]
# 或者: from PyKDE4.kdecore.KCmdLineArgs import parsedArgs [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

示例2: __init__

# 需要导入模块: from PyKDE4.kdecore import KCmdLineArgs [as 别名]
# 或者: from PyKDE4.kdecore.KCmdLineArgs import parsedArgs [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

示例3: main

# 需要导入模块: from PyKDE4.kdecore import KCmdLineArgs [as 别名]
# 或者: from PyKDE4.kdecore.KCmdLineArgs import parsedArgs [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

示例4: newInstance

# 需要导入模块: from PyKDE4.kdecore import KCmdLineArgs [as 别名]
# 或者: from PyKDE4.kdecore.KCmdLineArgs import parsedArgs [as 别名]
    def newInstance(self):
        args = KCmdLineArgs.parsedArgs()

        component = None
        if args.isSet("select-component"):
            component = str(args.getOption("select-component"))
            self.manager.cw.selectComponent(component)

        # Check if show-mainwindow used in sys.args to show mainWindow
        if args.isSet("show-mainwindow"):
            self.manager.show()

        # If system tray disabled show mainwindow at first
        if not config.PMConfig().systemTray():
            self.manager.show()

        return super(PmApp, self).newInstance()
开发者ID:SamiBabat,项目名称:playground,代码行数:19,代码来源:main.py

示例5: start

# 需要导入模块: from PyKDE4.kdecore import KCmdLineArgs [as 别名]
# 或者: from PyKDE4.kdecore.KCmdLineArgs import parsedArgs [as 别名]
    def start(self):
        """
        Called when the window has been set up and is ready to receive
        commands. E.g. opening documents.

        This can be extended to auto-reopen documents that were open
        when pynal was closed the last time.
        """
        args = KCmdLineArgs.parsedArgs()

        errors = ""
        for i in range(args.count()):
            filename = os.path.basename(str(args.arg(i)))
            if os.path.isfile(args.arg(i)):
                self.open_document(PynalDocument(args.arg(i)), filename)
            else:
                errors += args.arg(i) + "\n"

        if errors is not "":
            self.errorDialog.showMessage("Could not open file(s):\n" + errors)
开发者ID:Ebolon,项目名称:pynal,代码行数:22,代码来源:MainControl.py

示例6: __init__

# 需要导入模块: from PyKDE4.kdecore import KCmdLineArgs [as 别名]
# 或者: from PyKDE4.kdecore.KCmdLineArgs import parsedArgs [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: KCmdLineOptions

# 需要导入模块: from PyKDE4.kdecore import KCmdLineArgs [as 别名]
# 或者: from PyKDE4.kdecore.KCmdLineArgs import parsedArgs [as 别名]
    # 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()

    # If system tray disabled show mainwindow at first
    if not config.PMConfig().systemTray():
        manager.show()

    # Set exception handler
    sys.excepthook = handleException

    # Run the Package Manager
    app.exec_()

开发者ID:Tayyib,项目名称:uludag,代码行数:31,代码来源:main.py


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