eric6.py

branch
maintenance
changeset 5391
5e79ebb03b10
parent 5389
9b1c800daff3
child 5395
56efc13e456e
equal deleted inserted replaced
5370:78bf5989530b 5391:5e79ebb03b10
1 #!/usr/bin/env python3 1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*- 2 # -*- coding: utf-8 -*-
3 3
4 # Copyright (c) 2002 - 2016 Detlev Offenbach <detlev@die-offenbachs.de> 4 # Copyright (c) 2002 - 2017 Detlev Offenbach <detlev@die-offenbachs.de>
5 # 5 #
6 6
7 """ 7 """
8 Eric6 Python IDE. 8 Eric6 Python IDE.
9 9
14 from __future__ import unicode_literals 14 from __future__ import unicode_literals
15 15
16 import sys 16 import sys
17 17
18 # generate list of arguments to be remembered for a restart 18 # generate list of arguments to be remembered for a restart
19 restartArgsList = ["--nosplash", "--plugin", "--debug", "--config", "--pyqt4" 19 restartArgsList = ["--no-splash", "--plugin", "--debug", "--config",
20 "--settings"] 20 "--pyqt4", "--settings", "--disable-crash"]
21 restartArgs = [arg for arg in sys.argv[1:] 21 restartArgs = [arg for arg in sys.argv[1:]
22 if arg.split("=", 1)[0] in restartArgsList] 22 if arg.split("=", 1)[0] in restartArgsList]
23 23
24 import Toolbox.PyQt4ImportHook # __IGNORE_WARNING__ 24 import Toolbox.PyQt4ImportHook # __IGNORE_WARNING__
25 25
111 from E5Gui.E5SingleApplication import E5SingleApplicationClient 111 from E5Gui.E5SingleApplication import E5SingleApplicationClient
112 112
113 client = E5SingleApplicationClient() 113 client = E5SingleApplicationClient()
114 res = client.connect() 114 res = client.connect()
115 if res > 0: 115 if res > 0:
116 if "--nosplash" in sys.argv and sys.argv.index("--nosplash") < ddindex: 116 if "--no-splash" in sys.argv and \
117 del sys.argv[sys.argv.index("--nosplash")] 117 sys.argv.index("--no-splash") < ddindex:
118 if "--noopen" in sys.argv and sys.argv.index("--noopen") < ddindex: 118 del sys.argv[sys.argv.index("--no-splash")]
119 del sys.argv[sys.argv.index("--noopen")] 119 if "--no-open" in sys.argv and sys.argv.index("--no-open") < ddindex:
120 del sys.argv[sys.argv.index("--no-open")]
121 if "--no-crash" in sys.argv and sys.argv.index("--no-crash") < ddindex:
122 del sys.argv[sys.argv.index("--no-crash")]
123 if "--disable-crash" in sys.argv and \
124 sys.argv.index("--disable-crash") < ddindex:
125 del sys.argv[sys.argv.index("--disable-crash")]
120 if "--debug" in sys.argv and sys.argv.index("--debug") < ddindex: 126 if "--debug" in sys.argv and sys.argv.index("--debug") < ddindex:
121 del sys.argv[sys.argv.index("--debug")] 127 del sys.argv[sys.argv.index("--debug")]
122 for arg in sys.argv: 128 for arg in sys.argv:
123 if arg.startswith("--config="): 129 if arg.startswith("--config="):
124 sys.argv.remove(arg) 130 sys.argv.remove(arg)
232 238
233 options = [ 239 options = [
234 ("--config=configDir", 240 ("--config=configDir",
235 "use the given directory as the one containing the config files"), 241 "use the given directory as the one containing the config files"),
236 ("--debug", "activate debugging output to the console"), 242 ("--debug", "activate debugging output to the console"),
237 ("--nosplash", "don't show the splash screen"), 243 ("--no-splash", "don't show the splash screen"),
238 ("--noopen", 244 ("--no-open",
239 "don't open anything at startup except that given in command"), 245 "don't open anything at startup except that given in command"),
246 ("--no-crash", "don't check for a crash session file on startup"),
247 ("--disable-crash", "disable the support for crash sessions"),
240 ("--plugin=plugin-file", 248 ("--plugin=plugin-file",
241 "load the given plugin file (plugin development)"), 249 "load the given plugin file (plugin development)"),
242 ("--pyqt4", 250 ("--pyqt4",
243 "force use of PyQt4 in environments that have both PyQt variants"), 251 "force use of PyQt4 in environments that have both PyQt variants"),
244 ("--settings=settingsDir", 252 ("--settings=settingsDir",
277 # set the search path for icons 285 # set the search path for icons
278 Startup.initializeResourceSearchPath() 286 Startup.initializeResourceSearchPath()
279 287
280 # generate and show a splash window, if not suppressed 288 # generate and show a splash window, if not suppressed
281 from UI.SplashScreen import SplashScreen, NoneSplashScreen 289 from UI.SplashScreen import SplashScreen, NoneSplashScreen
282 if "--nosplash" in sys.argv and sys.argv.index("--nosplash") < ddindex: 290 if "--no-splash" in sys.argv and sys.argv.index("--no-splash") < ddindex:
283 del sys.argv[sys.argv.index("--nosplash")] 291 del sys.argv[sys.argv.index("--no-splash")]
284 splash = NoneSplashScreen() 292 splash = NoneSplashScreen()
285 elif not Preferences.getUI("ShowSplash"): 293 elif not Preferences.getUI("ShowSplash"):
286 splash = NoneSplashScreen() 294 splash = NoneSplashScreen()
287 else: 295 else:
288 splash = SplashScreen() 296 splash = SplashScreen()
299 path = path.encode(sys.getfilesystemencoding()) 307 path = path.encode(sys.getfilesystemencoding())
300 os.environ["PATH"] = path + os.pathsep + os.environ["PATH"] 308 os.environ["PATH"] = path + os.pathsep + os.environ["PATH"]
301 309
302 pluginFile = None 310 pluginFile = None
303 noopen = False 311 noopen = False
304 if "--noopen" in sys.argv and sys.argv.index("--noopen") < ddindex: 312 nocrash = False
305 del sys.argv[sys.argv.index("--noopen")] 313 disablecrash=False
314 if "--no-open" in sys.argv and sys.argv.index("--no-open") < ddindex:
315 del sys.argv[sys.argv.index("--no-open")]
306 noopen = True 316 noopen = True
317 if "--no-crash" in sys.argv and sys.argv.index("--no-crash") < ddindex:
318 del sys.argv[sys.argv.index("--no-crash")]
319 nocrash = True
320 if "--disable-crash" in sys.argv and \
321 sys.argv.index("--disable-crash") < ddindex:
322 del sys.argv[sys.argv.index("--disable-crash")]
323 disablecrash = True
307 for arg in sys.argv: 324 for arg in sys.argv:
308 if arg.startswith("--plugin=") and sys.argv.index(arg) < ddindex: 325 if arg.startswith("--plugin=") and sys.argv.index(arg) < ddindex:
309 import Utilities 326 import Utilities
310 # extract the plugin development option 327 # extract the plugin development option
311 pluginFile = arg.replace("--plugin=", "").replace('"', "") 328 pluginFile = arg.replace("--plugin=", "").replace('"', "")
336 # make Qt calls that need the E5Application to exist. 353 # make Qt calls that need the E5Application to exist.
337 from UI.UserInterface import UserInterface 354 from UI.UserInterface import UserInterface
338 355
339 splash.showMessage( 356 splash.showMessage(
340 QCoreApplication.translate("eric6", "Generating Main Window...")) 357 QCoreApplication.translate("eric6", "Generating Main Window..."))
341 mainWindow = UserInterface(app, loc, splash, pluginFile, noopen, 358 mainWindow = UserInterface(app, loc, splash, pluginFile, noopen, nocrash,
342 restartArgs) 359 disablecrash, restartArgs)
343 app.lastWindowClosed.connect(app.quit) 360 app.lastWindowClosed.connect(app.quit)
344 mainWindow.show() 361 mainWindow.show()
345 362
346 QTimer.singleShot(0, uiStartUp) 363 QTimer.singleShot(0, uiStartUp)
347 364

eric ide

mercurial