示例#1
0
 def getConfiguration(self):
     iniPath = self._getConfigurationFilePath()
     self._parseConfigFile(iniPath)
     #
     # Watch out for the method self._overrideConfigWithArgs when you're adding custom multi-word command line arguments
     #
     if self._config['language']:
         setLanguage(self._config['language'])
     self._argparser = argparse.ArgumentParser(description=getMessage("argument-description"),
                                      epilog=getMessage("argument-epilog"))
     self._argparser.add_argument('--no-gui', action='store_true', help=getMessage("nogui-argument"))
     self._argparser.add_argument('-a', '--host', metavar='hostname', type=str, help=getMessage("host-argument"))
     self._argparser.add_argument('-n', '--name', metavar='username', type=str, help=getMessage("name-argument"))
     self._argparser.add_argument('-d', '--debug', action='store_true', help=getMessage("debug-argument"))
     self._argparser.add_argument('-g', '--force-gui-prompt', action='store_true', help=getMessage("force-gui-prompt-argument"))
     self._argparser.add_argument('--no-store', action='store_true', help=getMessage("no-store-argument"))
     self._argparser.add_argument('-r', '--room', metavar='room', type=str, nargs='?', help=getMessage("room-argument"))
     self._argparser.add_argument('-p', '--password', metavar='password', type=str, nargs='?', help=getMessage("password-argument"))
     self._argparser.add_argument('--player-path', metavar='path', type=str, help=getMessage("player-path-argument"))
     self._argparser.add_argument('--language', metavar='language', type=str, help=getMessage("language-argument"))
     self._argparser.add_argument('file', metavar='file', type=lambda s: unicode(s, 'utf8'), nargs='?', help=getMessage("file-argument"))
     self._argparser.add_argument('--clear-gui-data', action='store_true', help=getMessage("clear-gui-data-argument"))
     self._argparser.add_argument('-v', '--version', action='store_true', help=getMessage("version-argument"))
     self._argparser.add_argument('_args', metavar='options', type=str, nargs='*', help=getMessage("args-argument"))
     args = self._argparser.parse_args()
     if args.version:
         print getMessage("version-message").format(version, milestone)
         sys.exit()
     self._overrideConfigWithArgs(args)
     if not self._config['noGui']:
         try:
             from PySide import QtGui  # @UnresolvedImport
             from PySide.QtCore import QCoreApplication
             from syncplay.vendor import qt4reactor
             if QCoreApplication.instance() is None:
                 self.app = QtGui.QApplication(sys.argv)
             qt4reactor.install()
         except ImportError:
             print getMessage("unable-import-gui-error")
             self._config['noGui'] = True
     if self._config['file'] and self._config['file'][:2] == "--":
         self._config['playerArgs'].insert(0, self._config['file'])
         self._config['file'] = None
     # Arguments not validated yet - booleans are still text values
     if self._config['language']:
         setLanguage(self._config['language'])
     if (self._config['forceGuiPrompt'] == "True" or not self._config['file']) and not self._config['noGui']:
         self._forceGuiPrompt()
     self._checkConfig()
     self._saveConfig(iniPath)
     if self._config['file']:
         self._config['loadedRelativePaths'] = self._loadRelativeConfiguration()
     if self._config['language']:
         setLanguage(self._config['language'])
     return self._config
示例#2
0
 def getConfiguration(self):
     iniPath = self._getConfigurationFilePath()
     self._parseConfigFile(iniPath)
     args = self._argparser.parse_args()
     self._overrideConfigWithArgs(args)
     # Arguments not validated yet - booleans are still text values
     if(self._config['forceGuiPrompt'] == "True" or not self._config['file']):
         self._forceGuiPrompt()
     self._checkConfig()
     self._saveConfig(iniPath)
     if(self._config['file']):
         self._loadRelativeConfiguration()
     if(not self._config['noGui']):
         from syncplay.vendor import qt4reactor
         if QCoreApplication.instance() is None:
             self.app = QtGui.QApplication(sys.argv)
         qt4reactor.install()
     return self._config
 def getConfiguration(self):
     iniPath = self._getConfigurationFilePath()
     self._parseConfigFile(iniPath)
     args = self._argparser.parse_args()
     self._overrideConfigWithArgs(args)
     #Arguments not validated yet - booleans are still text values
     if (self._config['forceGuiPrompt'] == "True"
             or not self._config['file']):
         self._forceGuiPrompt()
     self._checkConfig()
     self._saveConfig(iniPath)
     if (self._config['file']):
         self._loadRelativeConfiguration()
     if (not self._config['noGui']):
         from syncplay.vendor import qt4reactor
         if QCoreApplication.instance() is None:
             self.app = QtGui.QApplication(sys.argv)
         qt4reactor.install()
     return self._config
示例#4
0
 def getConfiguration(self):
     iniPath = self._getConfigurationFilePath()
     self._parseConfigFile(iniPath)
     #
     # Watch out for the method self._overrideConfigWithArgs when you're adding custom multi-word command line arguments
     #
     if self._config['language']:
         setLanguage(self._config['language'])
     self._argparser = argparse.ArgumentParser(
         description=getMessage("argument-description"),
         epilog=getMessage("argument-epilog"))
     self._argparser.add_argument('--no-gui',
                                  action='store_true',
                                  help=getMessage("nogui-argument"))
     self._argparser.add_argument('-a',
                                  '--host',
                                  metavar='hostname',
                                  type=str,
                                  help=getMessage("host-argument"))
     self._argparser.add_argument('-n',
                                  '--name',
                                  metavar='username',
                                  type=str,
                                  help=getMessage("name-argument"))
     self._argparser.add_argument('-d',
                                  '--debug',
                                  action='store_true',
                                  help=getMessage("debug-argument"))
     self._argparser.add_argument(
         '-g',
         '--force-gui-prompt',
         action='store_true',
         help=getMessage("force-gui-prompt-argument"))
     self._argparser.add_argument('--no-store',
                                  action='store_true',
                                  help=getMessage("no-store-argument"))
     self._argparser.add_argument('-r',
                                  '--room',
                                  metavar='room',
                                  type=str,
                                  nargs='?',
                                  help=getMessage("room-argument"))
     self._argparser.add_argument('-p',
                                  '--password',
                                  metavar='password',
                                  type=str,
                                  nargs='?',
                                  help=getMessage("password-argument"))
     self._argparser.add_argument('--player-path',
                                  metavar='path',
                                  type=str,
                                  help=getMessage("player-path-argument"))
     self._argparser.add_argument('--language',
                                  metavar='language',
                                  type=str,
                                  help=getMessage("language-argument"))
     self._argparser.add_argument('file',
                                  metavar='file',
                                  type=lambda s: unicode(s, 'utf8'),
                                  nargs='?',
                                  help=getMessage("file-argument"))
     self._argparser.add_argument(
         '--clear-gui-data',
         action='store_true',
         help=getMessage("clear-gui-data-argument"))
     self._argparser.add_argument('-v',
                                  '--version',
                                  action='store_true',
                                  help=getMessage("version-argument"))
     self._argparser.add_argument('_args',
                                  metavar='options',
                                  type=str,
                                  nargs='*',
                                  help=getMessage("args-argument"))
     args = self._argparser.parse_args()
     if args.version:
         print getMessage("version-message").format(version, milestone)
         sys.exit()
     self._overrideConfigWithArgs(args)
     if not self._config['noGui']:
         try:
             from PySide import QtGui  # @UnresolvedImport
             from PySide.QtCore import QCoreApplication
             from syncplay.vendor import qt4reactor
             if QCoreApplication.instance() is None:
                 self.app = QtGui.QApplication(sys.argv)
             qt4reactor.install()
         except ImportError:
             print getMessage("unable-import-gui-error")
             self._config['noGui'] = True
     if self._config['file'] and self._config['file'][:2] == "--":
         self._config['playerArgs'].insert(0, self._config['file'])
         self._config['file'] = None
     # Arguments not validated yet - booleans are still text values
     if self._config['language']:
         setLanguage(self._config['language'])
     if (self._config['forceGuiPrompt'] == "True"
             or not self._config['file']) and not self._config['noGui']:
         self._forceGuiPrompt()
     self._checkConfig()
     self._saveConfig(iniPath)
     if self._config['file']:
         self._config[
             'loadedRelativePaths'] = self._loadRelativeConfiguration()
     if self._config['language']:
         setLanguage(self._config['language'])
     return self._config
    def getConfiguration(self):
        iniPath = self._getConfigurationFilePath()
        self._parseConfigFile(iniPath)
        #
        # Watch out for the method self._overrideConfigWithArgs when you're adding custom multi-word command line arguments
        #
        if self._config["language"]:
            setLanguage(self._config["language"])
        self._argparser = argparse.ArgumentParser(
            description=getMessage("argument-description"), epilog=getMessage("argument-epilog")
        )
        self._argparser.add_argument("--no-gui", action="store_true", help=getMessage("nogui-argument"))
        self._argparser.add_argument("-a", "--host", metavar="hostname", type=str, help=getMessage("host-argument"))
        self._argparser.add_argument("-n", "--name", metavar="username", type=str, help=getMessage("name-argument"))
        self._argparser.add_argument("-d", "--debug", action="store_true", help=getMessage("debug-argument"))
        self._argparser.add_argument(
            "-g", "--force-gui-prompt", action="store_true", help=getMessage("force-gui-prompt-argument")
        )
        self._argparser.add_argument("--no-store", action="store_true", help=getMessage("no-store-argument"))
        self._argparser.add_argument(
            "-r", "--room", metavar="room", type=str, nargs="?", help=getMessage("room-argument")
        )
        self._argparser.add_argument(
            "-p", "--password", metavar="password", type=str, nargs="?", help=getMessage("password-argument")
        )
        self._argparser.add_argument("--player-path", metavar="path", type=str, help=getMessage("player-path-argument"))
        self._argparser.add_argument("--language", metavar="language", type=str, help=getMessage("language-argument"))
        self._argparser.add_argument("file", metavar="file", type=str, nargs="?", help=getMessage("file-argument"))
        self._argparser.add_argument(
            "--clear-gui-data", action="store_true", help=getMessage("clear-gui-data-argument")
        )
        self._argparser.add_argument("-v", "--version", action="store_true", help=getMessage("version-argument"))
        self._argparser.add_argument("_args", metavar="options", type=str, nargs="*", help=getMessage("args-argument"))
        args = self._argparser.parse_args()
        if args.version:
            print getMessage("version-message").format(version, milestone)
            sys.exit()
        self._overrideConfigWithArgs(args)
        if self._config["file"] and self._config["file"][:2] == "--":
            self._config["playerArgs"].insert(0, self._config["file"])
            self._config["file"] = None
        # Arguments not validated yet - booleans are still text values
        if self._config["language"]:
            setLanguage(self._config["language"])
        if (
            (self._config["forceGuiPrompt"] == "True" or not self._config["file"])
            and GuiConfiguration
            and not self._config["noGui"]
        ):
            self._forceGuiPrompt()
        self._checkConfig()
        self._saveConfig(iniPath)
        if self._config["file"]:
            self._config["loadedRelativePaths"] = self._loadRelativeConfiguration()
        if self._config["language"]:
            setLanguage(self._config["language"])
        if not GuiConfiguration:
            self._config["noGui"] = True
        if not self._config["noGui"]:
            from syncplay.vendor import qt4reactor

            if QCoreApplication.instance() is None:
                self.app = QtGui.QApplication(sys.argv)
            qt4reactor.install()
        return self._config