Utilities/Startup.py

changeset 432
497e188ee86e
parent 265
5805c2e1415b
child 500
c3abc7895a01
equal deleted inserted replaced
431:96cc7d322f89 432:497e188ee86e
60 ("-h, --help", "show this help message and exit") 60 ("-h, --help", "show this help message and exit")
61 ] 61 ]
62 options.extend(appinfo["options"]) 62 options.extend(appinfo["options"])
63 63
64 print(""" 64 print("""
65 Usage: %(bin)s [OPTIONS] %(arg)s 65 Usage: {bin} [OPTIONS] {arg}
66 66
67 %(name)s - %(description)s 67 {name} - {description}
68 68
69 Options:""" % appinfo) 69 Options:""".format(**appinfo))
70 for opt in options: 70 for opt in options:
71 print(" %s %s" % (opt[0].ljust(optlen), opt[1])) 71 print(" {0} {1}".format(opt[0].ljust(optlen), opt[1]))
72 sys.exit(0) 72 sys.exit(0)
73 73
74 def version(appinfo): 74 def version(appinfo):
75 """ 75 """
76 Module function to show the version information. 76 Module function to show the version information.
77 77
78 @param appinfo dictionary describing the application 78 @param appinfo dictionary describing the application
79 """ 79 """
80 print(""" 80 print("""
81 %(name)s %(version)s 81 {name} {version}
82 82
83 %(description)s 83 {description}
84 84
85 Copyright (c) 2002 - 2010 Detlev Offenbach <detlev@die-offenbachs.de> 85 Copyright (c) 2002 - 2010 Detlev Offenbach <detlev@die-offenbachs.de>
86 This is free software; see LICENSE.GPL3 for copying conditions. 86 This is free software; see LICENSE.GPL3 for copying conditions.
87 There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A 87 There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
88 PARTICULAR PURPOSE.""" % appinfo) 88 PARTICULAR PURPOSE.""".format(**appinfo))
89 sys.exit(0) 89 sys.exit(0)
90 90
91 def handleArgs(argv, appinfo): 91 def handleArgs(argv, appinfo):
92 """ 92 """
93 Module function to handle the always present commandline options. 93 Module function to handle the always present commandline options.
180 dirs = [getConfig('ericTranslationsDir'), Utilities.getConfigDir()] 180 dirs = [getConfig('ericTranslationsDir'), Utilities.getConfigDir()]
181 if qtTransDir is not None: 181 if qtTransDir is not None:
182 dirs.append(qtTransDir) 182 dirs.append(qtTransDir)
183 183
184 loca = loc 184 loca = loc
185 for tf in ["%s_%s" % (tr, loc) for tr in translations]: 185 for tf in ["{0}_{1}".format(tr, loc) for tr in translations]:
186 translator, ok = loadTranslatorForLocale(dirs, tf) 186 translator, ok = loadTranslatorForLocale(dirs, tf)
187 loaded_translators[tf] = translator 187 loaded_translators[tf] = translator
188 if ok: 188 if ok:
189 app.installTranslator(translator) 189 app.installTranslator(translator)
190 else: 190 else:

eric ide

mercurial