eric6/eric6.py

Sat, 27 Feb 2021 12:08:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Feb 2021 12:08:23 +0100
changeset 8138
169e65a6787c
parent 7960
e8fc383322f7
child 8143
2c730d5fd177
permissions
-rw-r--r--

Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 #!/usr/bin/env python3
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
3
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7849
diff changeset
4 # Copyright (c) 2002 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5 #
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 """
7960
e8fc383322f7 Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
8 eric Python IDE.
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 This is the main Python script that performs the necessary initialization
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 of the IDE and starts the Qt event loop.
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 """
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
3937
607dd5b0079b Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3814
diff changeset
14 import sys
6581
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6367
diff changeset
15 import os
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6367
diff changeset
16
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6367
diff changeset
17 originalPathString = os.getenv("PATH")
3937
607dd5b0079b Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3814
diff changeset
18
607dd5b0079b Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3814
diff changeset
19 # generate list of arguments to be remembered for a restart
5380
8a9c2ed7fa84 Removed support for the obsoleted '--noopen' and '--nosplash' options.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5379
diff changeset
20 restartArgsList = ["--no-splash", "--plugin", "--debug", "--config",
7198
684261ef2165 Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7192
diff changeset
21 "--settings", "--disable-crash", "--disable-plugin"]
3937
607dd5b0079b Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3814
diff changeset
22 restartArgs = [arg for arg in sys.argv[1:]
607dd5b0079b Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3814
diff changeset
23 if arg.split("=", 1)[0] in restartArgsList]
607dd5b0079b Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3814
diff changeset
24
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
25 sys.path.insert(1, os.path.dirname(__file__))
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
26
3628
deb5973080a9 Added code to prevent possible segfaults when closing down.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3456
diff changeset
27 try:
6364
6a496f0886ad Prepared the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6267
diff changeset
28 try:
7315
41fdf2cd1c33 eric6: removed some 'experimental' code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7257
diff changeset
29 from PyQt5 import sip # __IGNORE_EXCEPTION__
41fdf2cd1c33 eric6: removed some 'experimental' code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7257
diff changeset
30 except ImportError:
41fdf2cd1c33 eric6: removed some 'experimental' code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7257
diff changeset
31 import sip
41fdf2cd1c33 eric6: removed some 'experimental' code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7257
diff changeset
32 sip.setdestroyonexit(False)
41fdf2cd1c33 eric6: removed some 'experimental' code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7257
diff changeset
33 except AttributeError:
41fdf2cd1c33 eric6: removed some 'experimental' code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7257
diff changeset
34 pass
3628
deb5973080a9 Added code to prevent possible segfaults when closing down.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3456
diff changeset
35
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 import traceback
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 import time
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 import logging
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
39 import io
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40
3708
4fbb91fb6a31 Added an error message for the case, where the initial import of PyQt5 fails.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3670
diff changeset
41 try:
4fbb91fb6a31 Added an error message for the case, where the initial import of PyQt5 fails.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3670
diff changeset
42 from PyQt5.QtCore import qWarning, QLibraryInfo, QTimer, QCoreApplication
4fbb91fb6a31 Added an error message for the case, where the initial import of PyQt5 fails.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3670
diff changeset
43 except ImportError:
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
44 try:
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
45 from tkinter import messagebox
3708
4fbb91fb6a31 Added an error message for the case, where the initial import of PyQt5 fails.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3670
diff changeset
46 except ImportError:
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
47 sys.exit(100)
3709
191ccdf78966 Made the last change Python2 compatible.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3708
diff changeset
48 messagebox.showerror(
191ccdf78966 Made the last change Python2 compatible.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3708
diff changeset
49 "eric6 Error",
4364
cdfdb1afaf27 Corrected a typo.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4343
diff changeset
50 "PyQt could not be imported. Please make sure"
3709
191ccdf78966 Made the last change Python2 compatible.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3708
diff changeset
51 " it is installed and accessible.")
3708
4fbb91fb6a31 Added an error message for the case, where the initial import of PyQt5 fails.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3670
diff changeset
52 sys.exit(100)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53
4615
7c090c9d389d Changed the HTML Previewer to use a QWebEngineView, if QtWebKit is not available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4566
diff changeset
54 try:
7c090c9d389d Changed the HTML Previewer to use a QWebEngineView, if QtWebKit is not available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4566
diff changeset
55 from PyQt5 import QtWebEngineWidgets # __IGNORE_WARNING__
7c090c9d389d Changed the HTML Previewer to use a QWebEngineView, if QtWebKit is not available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4566
diff changeset
56 except ImportError:
7c090c9d389d Changed the HTML Previewer to use a QWebEngineView, if QtWebKit is not available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4566
diff changeset
57 pass
7c090c9d389d Changed the HTML Previewer to use a QWebEngineView, if QtWebKit is not available.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4566
diff changeset
58
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 # some global variables needed to start the application
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 args = None
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 mainWindow = None
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 splash = None
4383
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
63 inMainLoop = None
6702
793af5761910 Changed some code to (hopefully) get rid of a crash with upcoming PyQt 5.12.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
64 app = None
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 if "--debug" in sys.argv:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 del sys.argv[sys.argv.index("--debug")]
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
68 logging.basicConfig(level=logging.DEBUG)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69
4343
afe0da217745 Added the '--settings=' command line switch to store the settings files in a non-standard directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4317
diff changeset
70 for arg in sys.argv[:]:
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 if arg.startswith("--config="):
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
72 import Globals
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 configDir = arg.replace("--config=", "")
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
74 Globals.setConfigDir(configDir)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 sys.argv.remove(arg)
4343
afe0da217745 Added the '--settings=' command line switch to store the settings files in a non-standard directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4317
diff changeset
76 elif arg.startswith("--settings="):
afe0da217745 Added the '--settings=' command line switch to store the settings files in a non-standard directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4317
diff changeset
77 from PyQt5.QtCore import QSettings
afe0da217745 Added the '--settings=' command line switch to store the settings files in a non-standard directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4317
diff changeset
78 settingsDir = os.path.expanduser(arg.replace("--settings=", ""))
afe0da217745 Added the '--settings=' command line switch to store the settings files in a non-standard directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4317
diff changeset
79 if not os.path.isdir(settingsDir):
afe0da217745 Added the '--settings=' command line switch to store the settings files in a non-standard directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4317
diff changeset
80 os.makedirs(settingsDir)
afe0da217745 Added the '--settings=' command line switch to store the settings files in a non-standard directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4317
diff changeset
81 QSettings.setPath(QSettings.IniFormat, QSettings.UserScope,
afe0da217745 Added the '--settings=' command line switch to store the settings files in a non-standard directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4317
diff changeset
82 settingsDir)
afe0da217745 Added the '--settings=' command line switch to store the settings files in a non-standard directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4317
diff changeset
83 sys.argv.remove(arg)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84
37
bfe92e414977 Fixed a few porting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 18
diff changeset
85 # make Third-Party package available as a packages repository
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
86 sys.path.insert(2, os.path.join(os.path.dirname(__file__),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
87 "ThirdParty", "Pygments"))
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
88 sys.path.insert(2, os.path.join(os.path.dirname(__file__),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
89 "ThirdParty", "Jasy"))
4489
d0d6e4ad31bd Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4419
diff changeset
90 sys.path.insert(2, os.path.join(os.path.dirname(__file__),
6099
a7fecbc392d7 Started implementing support for EditorConfig.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6092
diff changeset
91 "ThirdParty", "EditorConfig"))
a7fecbc392d7 Started implementing support for EditorConfig.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6092
diff changeset
92 sys.path.insert(2, os.path.join(os.path.dirname(__file__),
5699
0e40b560dcd1 Fixes the view of coverage data in eric.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5616
diff changeset
93 "DebugClients", "Python"))
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 45
diff changeset
95 from E5Gui.E5Application import E5Application
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
97
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 def handleSingleApplication(ddindex):
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 """
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 Global function to handle the single application mode.
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 @param ddindex index of a '--' option in the options list
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 """
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
104 from E5Gui.E5SingleApplication import E5SingleApplicationClient
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
105
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 45
diff changeset
106 client = E5SingleApplicationClient()
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 res = client.connect()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 if res > 0:
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
109 if (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
110 "--no-splash" in sys.argv and
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
111 sys.argv.index("--no-splash") < ddindex
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
112 ):
6267
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
113 sys.argv.remove("--no-splash")
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
114 ddindex -= 1
5371
01c4c059142b Added an option to configure the crash session startup behavior, added the '--no-crash' option to suppress looking for a crash session and changed some command line options:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5154
diff changeset
115 if "--no-open" in sys.argv and sys.argv.index("--no-open") < ddindex:
6267
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
116 sys.argv.remove("--no-open")
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
117 ddindex -= 1
5371
01c4c059142b Added an option to configure the crash session startup behavior, added the '--no-crash' option to suppress looking for a crash session and changed some command line options:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5154
diff changeset
118 if "--no-crash" in sys.argv and sys.argv.index("--no-crash") < ddindex:
6267
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
119 sys.argv.remove("--no-crash")
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
120 if (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
121 "--disable-crash" in sys.argv and
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
122 sys.argv.index("--disable-crash") < ddindex
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
123 ):
6267
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
124 sys.argv.remove("--disable-crash")
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
125 ddindex -= 1
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 if "--debug" in sys.argv and sys.argv.index("--debug") < ddindex:
6267
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
127 sys.argv.remove("--debug")
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
128 ddindex -= 1
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
129 for arg in sys.argv:
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
130 if (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
131 arg.startswith("--config=") and
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
132 sys.argv.index(arg) < ddindex
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
133 ):
6267
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
134 sys.argv.remove(arg)
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
135 ddindex -= 1
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
136 break
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 for arg in sys.argv:
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
138 if (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
139 arg.startswith("--plugin=") and
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
140 sys.argv.index(arg) < ddindex
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
141 ):
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 sys.argv.remove(arg)
6267
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
143 ddindex -= 1
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 break
6267
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
145 for arg in sys.argv[:]:
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
146 if (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
147 arg.startswith("--disable-plugin=") and
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
148 sys.argv.index(arg) < ddindex
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
149 ):
6267
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
150 sys.argv.remove(arg)
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
151 ddindex -= 1
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
152
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 if len(sys.argv) > 1:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 client.processArgs(sys.argv[1:])
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 sys.exit(0)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 elif res < 0:
5616
adcffadf4962 Reworked some __IGNORE_WARNING__ comments to be more specific.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
157 print("eric6: {0}".format(client.errstr()))
adcffadf4962 Reworked some __IGNORE_WARNING__ comments to be more specific.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
158 # __IGNORE_WARNING_M801__
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 sys.exit(res)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
161
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 def excepthook(excType, excValue, tracebackobj):
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 """
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 Global function to catch unhandled exceptions.
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 @param excType exception type
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 @param excValue exception value
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 @param tracebackobj traceback object
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 """
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
170 from UI.Info import BugAddress
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
171 import Utilities
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
172 import Globals
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
173
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174 separator = '-' * 80
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3667
diff changeset
175 logFile = os.path.join(Globals.getConfigDir(), "eric6_error.log")
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
176 notice = (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
177 """An unhandled exception occurred. Please report the problem\n"""
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
178 """using the error reporting dialog or via email to <{0}>.\n"""
433
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 265
diff changeset
179 """A log has been written to "{1}".\n\nError information:\n""".format(
3035
36e9f388958b Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
180 BugAddress, logFile)
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
181 )
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 timeString = time.strftime("%Y-%m-%d, %H:%M:%S")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
184 versionInfo = "\n{0}\n{1}".format(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
185 separator, Utilities.generateVersionInfo())
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 pluginVersionInfo = Utilities.generatePluginsVersionInfo()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 if pluginVersionInfo:
7729
f2f7b7b24879 Utilities: optimized and fixed the assembly of version information.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
188 versionInfo += "\n{0}\n{1}".format(separator, pluginVersionInfo)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 distroInfo = Utilities.generateDistroInfo()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 if distroInfo:
7729
f2f7b7b24879 Utilities: optimized and fixed the assembly of version information.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
191 versionInfo += "\n{0}\n{1}".format(separator, distroInfo)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
193 if isinstance(excType, str):
3417
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
194 tbinfo = tracebackobj
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
195 else:
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
196 tbinfofile = io.StringIO()
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
197 traceback.print_tb(tracebackobj, None, tbinfofile)
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
198 tbinfofile.seek(0)
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
199 tbinfo = tbinfofile.read()
433
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 265
diff changeset
200 errmsg = '{0}: \n{1}'.format(str(excType), str(excValue))
7729
f2f7b7b24879 Utilities: optimized and fixed the assembly of version information.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
201 sections = ['', separator, timeString, separator, errmsg, separator,
f2f7b7b24879 Utilities: optimized and fixed the assembly of version information.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7635
diff changeset
202 tbinfo]
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 msg = '\n'.join(sections)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 try:
7785
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
205 with open(logFile, "w", encoding="utf-8") as f:
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
206 f.write(msg)
9978016560ec Changed code to use context manager 'open()' for file operations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
207 f.write(versionInfo)
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7804
diff changeset
208 except OSError:
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 pass
3417
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
210
4383
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
211 if inMainLoop is None:
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
212 warning = notice + msg + versionInfo
5616
adcffadf4962 Reworked some __IGNORE_WARNING__ comments to be more specific.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
213 print(warning) # __IGNORE_WARNING_M801__
4383
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
214 else:
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
215 warning = notice + msg + versionInfo
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
216 # Escape &<> otherwise it's not visible in the error dialog
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
217 warning = (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
218 warning
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
219 .replace("&", "&amp;")
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
220 .replace(">", "&gt;")
5838
4c2cace2263a Modified the excepthook() function of the main script to get rid of the xml.sax.saxutils import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5699
diff changeset
221 .replace("<", "&lt;")
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
222 )
4383
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
223 qWarning(warning)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
225
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 def uiStartUp():
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 """
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228 Global function to finalize the start up of the main UI.
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230 Note: It is activated by a zero timeout single-shot timer.
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231 """
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232 global args, mainWindow, splash
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 if splash:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235 splash.finish(mainWindow)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 del splash
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238 mainWindow.checkForErrorLog()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239 mainWindow.processArgs(args)
7804
1cbc27e34ec6 Implementing code to record and/or guess some information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7785
diff changeset
240 mainWindow.processInstallInfoFile()
1939
eadb2328d7d4 Introduced a "workspace" directory that is used as the default for opening or saving new files or projects (configurable on Multiproject config page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
241 mainWindow.checkProjectsWorkspace()
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 mainWindow.checkConfigurationStatus()
3113
2780e230f129 Continued implementing the automatic plug-in update check in the plug-in manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3035
diff changeset
243 mainWindow.performVersionCheck(False)
2780e230f129 Continued implementing the automatic plug-in update check in the plug-in manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3035
diff changeset
244 mainWindow.checkPluginUpdatesAvailable()
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2087
diff changeset
245 mainWindow.autoConnectIrc()
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
247
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 def main():
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 """
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 Main entry point into the application.
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 """
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
252 from Globals import AppInfo
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
253 import Globals
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
254
6702
793af5761910 Changed some code to (hopefully) get rid of a crash with upcoming PyQt 5.12.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
255 global app, args, mainWindow, splash, restartArgs, inMainLoop
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 sys.excepthook = excepthook
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258
7380
c99320e859ca Fixed an issue related to showing the application name in the menu bar of Gnome desktop under Wayland.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
259 from PyQt5.QtGui import QGuiApplication
c99320e859ca Fixed an issue related to showing the application name in the menu bar of Gnome desktop under Wayland.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
260 QGuiApplication.setDesktopFileName("eric6.desktop")
c99320e859ca Fixed an issue related to showing the application name in the menu bar of Gnome desktop under Wayland.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
261
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
262 options = [
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
263 ("--config=configDir",
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
264 "use the given directory as the one containing the config files"),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
265 ("--debug", "activate debugging output to the console"),
5371
01c4c059142b Added an option to configure the crash session startup behavior, added the '--no-crash' option to suppress looking for a crash session and changed some command line options:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5154
diff changeset
266 ("--no-splash", "don't show the splash screen"),
01c4c059142b Added an option to configure the crash session startup behavior, added the '--no-crash' option to suppress looking for a crash session and changed some command line options:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5154
diff changeset
267 ("--no-open",
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
268 "don't open anything at startup except that given in command"),
5379
0f14e170a803 Added the '--disable-crash' option to temporarily disable the crash session support through the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5371
diff changeset
269 ("--no-crash", "don't check for a crash session file on startup"),
0f14e170a803 Added the '--disable-crash' option to temporarily disable the crash session support through the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5371
diff changeset
270 ("--disable-crash", "disable the support for crash sessions"),
6267
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
271 ("--disable-plugin=<plug-in name>",
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
272 "disable the given plug-in (may be repeated)"),
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
273 ("--plugin=plugin-file",
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
274 "load the given plugin file (plugin development)"),
4343
afe0da217745 Added the '--settings=' command line switch to store the settings files in a non-standard directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4317
diff changeset
275 ("--settings=settingsDir",
afe0da217745 Added the '--settings=' command line switch to store the settings files in a non-standard directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4317
diff changeset
276 "use the given directory to store the settings files"),
2930
92973b701875 Added commandline options '--start-file', '--start-multi' and '--start-project' to start with the most recently opened file, multi project or project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2779
diff changeset
277 ("--start-file", "load the most recently opened file"),
92973b701875 Added commandline options '--start-file', '--start-multi' and '--start-project' to start with the most recently opened file, multi project or project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2779
diff changeset
278 ("--start-multi", "load the most recently opened multi-project"),
92973b701875 Added commandline options '--start-file', '--start-multi' and '--start-project' to start with the most recently opened file, multi project or project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2779
diff changeset
279 ("--start-project", "load the most recently opened project"),
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
280 ("--start-session", "load the global session file"),
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
281 ("--",
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
282 "indicate that there are options for the program to be debugged"),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
283 ("",
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
284 "(everything after that is considered arguments for this program)")
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 ]
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
286 appinfo = AppInfo.makeAppInfo(sys.argv,
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3667
diff changeset
287 "Eric6",
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 "[project | files... [--] [debug-options]]",
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 "A Python IDE",
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 options)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
291
6775
a84449ccb414 eric6, Startup: get rid of the __PYVENV_LAUNCHER__ environment variable because it get in the way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6702
diff changeset
292 if "__PYVENV_LAUNCHER__" in os.environ:
a84449ccb414 eric6, Startup: get rid of the __PYVENV_LAUNCHER__ environment variable because it get in the way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6702
diff changeset
293 del os.environ["__PYVENV_LAUNCHER__"]
a84449ccb414 eric6, Startup: get rid of the __PYVENV_LAUNCHER__ environment variable because it get in the way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6702
diff changeset
294
7574
3fbc430c4091 eric6.py: make sure our executable directory (i.e. that of the used Python interpreter) is included in the executable search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7461
diff changeset
295 # make sure our executable directory (i.e. that of the used Python
3fbc430c4091 eric6.py: make sure our executable directory (i.e. that of the used Python interpreter) is included in the executable search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7461
diff changeset
296 # interpreter) is included in the executable search path
3fbc430c4091 eric6.py: make sure our executable directory (i.e. that of the used Python interpreter) is included in the executable search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7461
diff changeset
297 pathList = os.environ["PATH"].split(os.pathsep)
3fbc430c4091 eric6.py: make sure our executable directory (i.e. that of the used Python interpreter) is included in the executable search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7461
diff changeset
298 exeDir = os.path.dirname(sys.executable)
3fbc430c4091 eric6.py: make sure our executable directory (i.e. that of the used Python interpreter) is included in the executable search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7461
diff changeset
299 if exeDir not in pathList:
3fbc430c4091 eric6.py: make sure our executable directory (i.e. that of the used Python interpreter) is included in the executable search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7461
diff changeset
300 pathList.insert(0, exeDir)
3fbc430c4091 eric6.py: make sure our executable directory (i.e. that of the used Python interpreter) is included in the executable search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7461
diff changeset
301 os.environ["PATH"] = os.pathsep.join(pathList)
3fbc430c4091 eric6.py: make sure our executable directory (i.e. that of the used Python interpreter) is included in the executable search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7461
diff changeset
302
4035
c38be891d0ab Fixed startup issues on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
303 from Toolbox import Startup
c38be891d0ab Fixed startup issues on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
304 # set the library paths for plugins
c38be891d0ab Fixed startup issues on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
305 Startup.setLibraryPaths()
c38be891d0ab Fixed startup issues on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
306
513
a5329d7867c5 Fixed the QLocalSocket issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 467
diff changeset
307 app = E5Application(sys.argv)
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
308 ddindex = Startup.handleArgs(sys.argv, appinfo)
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
309
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
310 logging.debug("Importing Preferences")
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
311 import Preferences
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
312
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313 if Preferences.getUI("SingleApplicationMode"):
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 handleSingleApplication(ddindex)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315
265
5805c2e1415b Corrected and optimized the code for setting the Qt library paths.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 263
diff changeset
316 # set the search path for icons
7461
1f239d5f89b8 Added code to include the Breeze icons depending on window lightness factor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7451
diff changeset
317 Startup.initializeResourceSearchPath(app)
6267
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
318
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 # generate and show a splash window, if not suppressed
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
320 from UI.SplashScreen import SplashScreen, NoneSplashScreen
5380
8a9c2ed7fa84 Removed support for the obsoleted '--noopen' and '--nosplash' options.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5379
diff changeset
321 if "--no-splash" in sys.argv and sys.argv.index("--no-splash") < ddindex:
6267
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
322 sys.argv.remove("--no-splash")
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
323 ddindex -= 1
5371
01c4c059142b Added an option to configure the crash session startup behavior, added the '--no-crash' option to suppress looking for a crash session and changed some command line options:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5154
diff changeset
324 splash = NoneSplashScreen()
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325 elif not Preferences.getUI("ShowSplash"):
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 splash = NoneSplashScreen()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 else:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328 splash = SplashScreen()
3814
c8b7a6bbb1a4 Another little startup change in the eric main script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3812
diff changeset
329 QCoreApplication.processEvents()
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3628
diff changeset
331 # modify the executable search path for the PyQt5 installer
2608
01118174a2f5 Changed code to be compatible with latest PyQt4 Windows installers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
332 if Globals.isWindowsPlatform():
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3628
diff changeset
333 pyqtDataDir = Globals.getPyQt5ModulesDirectory()
699
c008503ee766 Another fix for the usage of the PyQt4 installer and multiple installations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 565
diff changeset
334 if os.path.exists(os.path.join(pyqtDataDir, "bin")):
4383
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
335 path = os.path.join(pyqtDataDir, "bin")
996
5eddcfeb8948 Modification for compatibility with latest PyQt4 installer change.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
336 else:
4383
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
337 path = pyqtDataDir
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
338 os.environ["PATH"] = path + os.pathsep + os.environ["PATH"]
699
c008503ee766 Another fix for the usage of the PyQt4 installer and multiple installations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 565
diff changeset
339
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340 pluginFile = None
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341 noopen = False
5371
01c4c059142b Added an option to configure the crash session startup behavior, added the '--no-crash' option to suppress looking for a crash session and changed some command line options:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5154
diff changeset
342 nocrash = False
5395
56efc13e456e Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
343 disablecrash = False
6267
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
344 disabledPlugins = []
5380
8a9c2ed7fa84 Removed support for the obsoleted '--noopen' and '--nosplash' options.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5379
diff changeset
345 if "--no-open" in sys.argv and sys.argv.index("--no-open") < ddindex:
6267
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
346 sys.argv.remove("--no-open")
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
347 ddindex -= 1
5371
01c4c059142b Added an option to configure the crash session startup behavior, added the '--no-crash' option to suppress looking for a crash session and changed some command line options:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5154
diff changeset
348 noopen = True
01c4c059142b Added an option to configure the crash session startup behavior, added the '--no-crash' option to suppress looking for a crash session and changed some command line options:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5154
diff changeset
349 if "--no-crash" in sys.argv and sys.argv.index("--no-crash") < ddindex:
6267
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
350 sys.argv.remove("--no-crash")
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
351 ddindex -= 1
5371
01c4c059142b Added an option to configure the crash session startup behavior, added the '--no-crash' option to suppress looking for a crash session and changed some command line options:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5154
diff changeset
352 nocrash = True
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
353 if (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
354 "--disable-crash" in sys.argv and
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
355 sys.argv.index("--disable-crash") < ddindex
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
356 ):
6267
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
357 sys.argv.remove("--disable-crash")
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
358 ddindex -= 1
5379
0f14e170a803 Added the '--disable-crash' option to temporarily disable the crash session support through the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5371
diff changeset
359 disablecrash = True
6267
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
360 for arg in sys.argv[:]:
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
361 if (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
362 arg.startswith("--disable-plugin=") and
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
363 sys.argv.index(arg) < ddindex
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7240
diff changeset
364 ):
6267
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
365 # extract the plug-in name
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
366 pluginName = arg.replace("--disable-plugin=", "")
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
367 sys.argv.remove(arg)
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
368 ddindex -= 1
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
369 disabledPlugins.append(pluginName)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370 for arg in sys.argv:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
371 if arg.startswith("--plugin=") and sys.argv.index(arg) < ddindex:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372 # extract the plugin development option
768
df2dbf3072be Fixed an issue with blanks in pathname of eric plug-ins when developing them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 723
diff changeset
373 pluginFile = arg.replace("--plugin=", "").replace('"', "")
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374 sys.argv.remove(arg)
6267
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
375 ddindex -= 1
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 pluginFile = os.path.expanduser(pluginFile)
7849
70e464748aaa Utilities: removed some obsolete functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7836
diff changeset
377 pluginFile = os.path.abspath(pluginFile)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 break
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
380 # is there a set of filenames or options on the command line,
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381 # if so, pass them to the UI
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 if len(sys.argv) > 1:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383 args = sys.argv[1:]
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384
7198
684261ef2165 Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7192
diff changeset
385 # get the Qt translations directory
4714
03c5936c79e5 Change the prefference for the Qt translations directory because it still reflected Qt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4712
diff changeset
386 qtTransDir = Preferences.getQtTranslationsDir()
03c5936c79e5 Change the prefference for the Qt translations directory because it still reflected Qt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4712
diff changeset
387 if not qtTransDir:
03c5936c79e5 Change the prefference for the Qt translations directory because it still reflected Qt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4712
diff changeset
388 qtTransDir = QLibraryInfo.location(QLibraryInfo.TranslationsPath)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
389
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390 # Load translation files and install them
4714
03c5936c79e5 Change the prefference for the Qt translations directory because it still reflected Qt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4712
diff changeset
391 loc = Startup.loadTranslators(qtTransDir, app, ("qscintilla",))
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
392
4317
0de465a93200 Added code to limit SSL sockets to ciphers with at least 128 bits for Qt < 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4277
diff changeset
393 # Initialize SSL stuff
0de465a93200 Added code to limit SSL sockets to ciphers with at least 128 bits for Qt < 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4277
diff changeset
394 from E5Network.E5SslUtilities import initSSL
0de465a93200 Added code to limit SSL sockets to ciphers with at least 128 bits for Qt < 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4277
diff changeset
395 initSSL()
0de465a93200 Added code to limit SSL sockets to ciphers with at least 128 bits for Qt < 5.3.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4277
diff changeset
396
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3667
diff changeset
397 splash.showMessage(QCoreApplication.translate("eric6", "Starting..."))
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 45
diff changeset
398 # We can only import these after creating the E5Application because they
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 45
diff changeset
399 # make Qt calls that need the E5Application to exist.
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 from UI.UserInterface import UserInterface
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
402 splash.showMessage(
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3667
diff changeset
403 QCoreApplication.translate("eric6", "Generating Main Window..."))
6267
350655a6c85f eric6, PluginManager: added the '--disable-plugin=' option to disable plug-ins via the command line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6181
diff changeset
404 mainWindow = UserInterface(app, loc, splash, pluginFile, disabledPlugins,
6581
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6367
diff changeset
405 noopen, nocrash, disablecrash, restartArgs,
8eb6220f2bb7 Shell: changed code to start the shell/debugger backend with an unmodified PATH setting and added some more special commands (see what's this help of the shell).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6367
diff changeset
406 originalPathString)
4419
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
407 app.lastWindowClosed.connect(app.quit)
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
408 mainWindow.show()
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
409
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
410 QTimer.singleShot(0, uiStartUp)
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
411
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
412 # generate a graphical error handler
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
413 from E5Gui import E5ErrorMessage
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
414 eMsg = E5ErrorMessage.qtHandler()
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
415 eMsg.setMinimumSize(600, 400)
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
416
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
417 # start the event loop
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
418 inMainLoop = True
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7729
diff changeset
419 res = app.exec()
6181
2ae7e332b941 Fixed logging format issues detected by the latest code style checker additions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6099
diff changeset
420 logging.debug("Shutting down, result %d", res)
4419
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
421 logging.shutdown()
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
422 sys.exit(res)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
423
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424 if __name__ == '__main__':
565
21191e634b47 Added checks for blacklisted versions of sip, PyQt4 and QScintilla2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
425 main()

eric ide

mercurial