8 """ |
8 """ |
9 |
9 |
10 import os |
10 import os |
11 import sys |
11 import sys |
12 |
12 |
13 from PyQt4.QtCore import QTranslator, QTextCodec, QLocale, QDir, SIGNAL, SLOT, \ |
13 from PyQt4.QtCore import QTranslator, QTextCodec, QLocale, SIGNAL, SLOT, \ |
14 QLibraryInfo |
14 QLibraryInfo |
15 from PyQt4.QtGui import QApplication |
15 from PyQt4.QtGui import QApplication |
16 |
16 |
17 from E5Gui.E5Application import E5Application |
17 from E5Gui.E5Application import E5Application |
18 |
18 |
93 Module function to handle the always present commandline options. |
93 Module function to handle the always present commandline options. |
94 |
94 |
95 @param argv list of commandline parameters (list of strings) |
95 @param argv list of commandline parameters (list of strings) |
96 @param appinfo dictionary describing the application |
96 @param appinfo dictionary describing the application |
97 @return index of the '--' option (integer). This is used to tell |
97 @return index of the '--' option (integer). This is used to tell |
98 the application, that all additional option don't belong to |
98 the application, that all additional options don't belong to |
99 the application. |
99 the application. |
100 """ |
100 """ |
101 ddindex = 30000 # arbitrarily large number |
101 ddindex = 30000 # arbitrarily large number |
102 args = { |
102 args = { |
103 "--version": version, |
103 "--version": version, |
152 @param app reference to the application object (QApplication) |
152 @param app reference to the application object (QApplication) |
153 @param translationFiles tuple of additional translations to |
153 @param translationFiles tuple of additional translations to |
154 be loaded (tuple of strings) |
154 be loaded (tuple of strings) |
155 @return the requested locale (string) |
155 @return the requested locale (string) |
156 """ |
156 """ |
|
157 global loaded_translators |
157 translations = ("qt", "eric5") + translationFiles |
158 translations = ("qt", "eric5") + translationFiles |
158 loc = Preferences.getUILanguage() |
159 loc = Preferences.getUILanguage() |
159 if loc is None: |
160 if loc is None: |
160 return |
161 return |
161 |
162 |
195 <dd>list of commandline parameters (list of strings)</dd> |
196 <dd>list of commandline parameters (list of strings)</dd> |
196 </dl> |
197 </dl> |
197 @keyparam quitOnLastWindowClosed flag indicating to quit the application, |
198 @keyparam quitOnLastWindowClosed flag indicating to quit the application, |
198 if the last window was closed (boolean) |
199 if the last window was closed (boolean) |
199 """ |
200 """ |
200 ddindex = handleArgs(argv, appinfo) |
201 handleArgs(argv, appinfo) |
201 app = E5Application(argv) |
202 app = E5Application(argv) |
202 app.setQuitOnLastWindowClosed(quitOnLastWindowClosed) |
203 app.setQuitOnLastWindowClosed(quitOnLastWindowClosed) |
203 try: |
204 try: |
204 sys.setappdefaultencoding(Preferences.getSystem("StringEncoding")) |
205 sys.setappdefaultencoding(Preferences.getSystem("StringEncoding")) |
205 except AttributeError: |
206 except AttributeError: |