eric6/eric6.py

Sat, 31 Aug 2019 12:58:11 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 31 Aug 2019 12:58:11 +0200
branch
without_py2_and_pyqt4
changeset 7192
a22eee00b052
parent 6949
a5255f1ba3f0
child 7198
684261ef2165
permissions
-rw-r--r--

Started removing runtime support for Python2 and PyQt4.

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
6645
ad476851d7e0 Updated copyright for 2019.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6581
diff changeset
4 # Copyright (c) 2002 - 2019 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 """
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3667
diff changeset
8 Eric6 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
3145
a9de05d4a22f # __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3142
diff changeset
14 from __future__ import unicode_literals
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2409
diff changeset
15
3937
607dd5b0079b Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3814
diff changeset
16 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
17 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
18
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
19 originalPathString = os.getenv("PATH")
3937
607dd5b0079b Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3814
diff changeset
20
607dd5b0079b Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3814
diff changeset
21 # 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
22 restartArgsList = ["--no-splash", "--plugin", "--debug", "--config",
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
23 "--pyqt4", "--settings", "--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
24 "--disable-plugin"]
3937
607dd5b0079b Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3814
diff changeset
25 restartArgs = [arg for arg in sys.argv[1:]
607dd5b0079b Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3814
diff changeset
26 if arg.split("=", 1)[0] in restartArgsList]
607dd5b0079b Refined the PyQt4 compatibility stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3814
diff changeset
27
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
28 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
29
4277
b4b10e89e247 Corrected a code style issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4035
diff changeset
30 import Toolbox.PyQt4ImportHook # __IGNORE_WARNING__
3776
ccb6eacb50e5 Started adding code to make eric6 usable with PyQt5 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3709
diff changeset
31
3628
deb5973080a9 Added code to prevent possible segfaults when closing down.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3456
diff changeset
32 try:
6364
6a496f0886ad Prepared the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6267
diff changeset
33 try:
6367
7bc6fc02d981 Fixed a few bugs caused by using the new virtual environment manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6365
diff changeset
34 from PyQt5 import sip # __IGNORE_EXCEPTION__
6364
6a496f0886ad Prepared the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6267
diff changeset
35 except ImportError:
6365
85f8745427a6 Redid the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6364
diff changeset
36 import sip
3628
deb5973080a9 Added code to prevent possible segfaults when closing down.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3456
diff changeset
37 sip.setdestroyonexit(False)
deb5973080a9 Added code to prevent possible segfaults when closing down.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3456
diff changeset
38 except AttributeError:
deb5973080a9 Added code to prevent possible segfaults when closing down.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3456
diff changeset
39 pass
deb5973080a9 Added code to prevent possible segfaults when closing down.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3456
diff changeset
40
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 import traceback
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 import time
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 import logging
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
44 import io
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45
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 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
47 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
48 except ImportError:
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
49 try:
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
50 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
51 except ImportError:
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
52 sys.exit(100)
3709
191ccdf78966 Made the last change Python2 compatible.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3708
diff changeset
53 messagebox.showerror(
191ccdf78966 Made the last change Python2 compatible.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3708
diff changeset
54 "eric6 Error",
4364
cdfdb1afaf27 Corrected a typo.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4343
diff changeset
55 "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
56 " 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
57 sys.exit(100)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58
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
59 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
60 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
61 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
62 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
63
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 # some global variables needed to start the application
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 args = None
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 mainWindow = None
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 splash = None
4383
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
68 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
69 app = None
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 if "--debug" in sys.argv:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 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
73 logging.basicConfig(level=logging.DEBUG)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74
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
75 for arg in sys.argv[:]:
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 if arg.startswith("--config="):
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
77 import Globals
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 configDir = arg.replace("--config=", "")
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
79 Globals.setConfigDir(configDir)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 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
81 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
82 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
83 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
84 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
85 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
86 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
87 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
88 sys.argv.remove(arg)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89
37
bfe92e414977 Fixed a few porting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 18
diff changeset
90 # 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
91 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
92 "ThirdParty", "Pygments"))
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
93 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
94 "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
95 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
96 "ThirdParty", "EditorConfig"))
a7fecbc392d7 Started implementing support for EditorConfig.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6092
diff changeset
97 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
98 "DebugClients", "Python"))
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 45
diff changeset
100 from E5Gui.E5Application import E5Application
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
102
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 def handleSingleApplication(ddindex):
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 """
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 Global function to handle the single application mode.
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 @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
108 """
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
109 from E5Gui.E5SingleApplication import E5SingleApplicationClient
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
110
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 45
diff changeset
111 client = E5SingleApplicationClient()
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 res = client.connect()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 if res > 0:
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
114 if "--no-splash" in sys.argv and \
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 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
116 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
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-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
119 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
120 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
121 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
122 sys.argv.remove("--no-crash")
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
123 if "--disable-crash" in sys.argv and \
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
124 sys.argv.index("--disable-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
125 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
126 ddindex -= 1
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 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
128 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
129 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
130 for arg in sys.argv:
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
131 if arg.startswith("--config=") and \
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
132 sys.argv.index(arg) < ddindex:
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
133 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
134 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
135 break
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 for arg in sys.argv:
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
137 if arg.startswith("--plugin=") and \
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
138 sys.argv.index(arg) < ddindex:
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 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
140 ddindex -= 1
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 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
142 for arg in sys.argv[:]:
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 if arg.startswith("--disable-plugin=") and \
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
144 sys.argv.index(arg) < ddindex:
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 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
146 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
147
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 if len(sys.argv) > 1:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 client.processArgs(sys.argv[1:])
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 sys.exit(0)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 elif res < 0:
5616
adcffadf4962 Reworked some __IGNORE_WARNING__ comments to be more specific.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
152 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
153 # __IGNORE_WARNING_M801__
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 sys.exit(res)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
156
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 def excepthook(excType, excValue, tracebackobj):
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 """
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 Global function to catch unhandled exceptions.
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 @param excType exception type
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 @param excValue exception value
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 @param tracebackobj traceback object
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 """
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
165 from UI.Info import BugAddress
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
166 import Utilities
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
167 import Globals
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
168
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 separator = '-' * 80
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3667
diff changeset
170 logFile = os.path.join(Globals.getConfigDir(), "eric6_error.log")
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 notice = \
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 """An unhandled exception occurred. Please report the problem\n"""\
433
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 265
diff changeset
173 """using the error reporting dialog or via email to <{0}>.\n"""\
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 265
diff changeset
174 """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
175 BugAddress, logFile)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 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
177
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
178 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
179 separator, Utilities.generateVersionInfo())
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 pluginVersionInfo = Utilities.generatePluginsVersionInfo()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 if pluginVersionInfo:
433
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 265
diff changeset
182 versionInfo += "{0}\n{1}".format(separator, pluginVersionInfo)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183 distroInfo = Utilities.generateDistroInfo()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 if distroInfo:
433
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 265
diff changeset
185 versionInfo += "{0}\n{1}".format(separator, distroInfo)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
187 if isinstance(excType, str):
3417
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
188 tbinfo = tracebackobj
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
189 else:
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
190 tbinfofile = io.StringIO()
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
191 traceback.print_tb(tracebackobj, None, tbinfofile)
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
192 tbinfofile.seek(0)
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
193 tbinfo = tbinfofile.read()
433
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 265
diff changeset
194 errmsg = '{0}: \n{1}'.format(str(excType), str(excValue))
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 sections = [separator, timeString, separator, errmsg, separator, tbinfo]
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 msg = '\n'.join(sections)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197 try:
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
198 f = open(logFile, "w", encoding="utf-8")
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 f.write(msg)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 f.write(versionInfo)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 f.close()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 except IOError:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 pass
3417
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
204
4383
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
205 if inMainLoop is None:
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
206 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
207 print(warning) # __IGNORE_WARNING_M801__
4383
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
208 else:
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
209 warning = notice + msg + versionInfo
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
210 # Escape &<> otherwise it's not visible in the error dialog
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
211 warning = warning\
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
212 .replace("&", "&amp;")\
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
213 .replace(">", "&gt;")\
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
214 .replace("<", "&lt;")
4383
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
215 qWarning(warning)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
217
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 def uiStartUp():
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219 """
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 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
221
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
222 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
223 """
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 global args, mainWindow, splash
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
225
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 if splash:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 splash.finish(mainWindow)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228 del splash
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 mainWindow.checkForErrorLog()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231 mainWindow.processArgs(args)
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
232 mainWindow.checkProjectsWorkspace()
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233 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
234 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
235 mainWindow.checkPluginUpdatesAvailable()
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2087
diff changeset
236 mainWindow.autoConnectIrc()
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
238
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239 def main():
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 """
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241 Main entry point into the application.
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 """
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
243 from Globals import AppInfo
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
244 import Globals
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
245
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
246 global app, args, mainWindow, splash, restartArgs, inMainLoop
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 sys.excepthook = excepthook
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
250 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
251 ("--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
252 "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
253 ("--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
254 ("--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
255 ("--no-open",
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
256 "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
257 ("--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
258 ("--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
259 ("--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
260 "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
261 ("--plugin=plugin-file",
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
262 "load the given plugin file (plugin development)"),
5154
0a86d976fef5 Added a missing eric6 help entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4975
diff changeset
263 ("--pyqt4",
0a86d976fef5 Added a missing eric6 help entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4975
diff changeset
264 "force use of PyQt4 in environments that have both PyQt variants"),
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
265 ("--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
266 "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
267 ("--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
268 ("--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
269 ("--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
270 ("--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
271 ("--",
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
272 "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
273 ("",
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
274 "(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
275 ]
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
276 appinfo = AppInfo.makeAppInfo(sys.argv,
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3667
diff changeset
277 "Eric6",
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 "[project | files... [--] [debug-options]]",
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 "A Python IDE",
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 options)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281
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
282 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
283 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
284
4035
c38be891d0ab Fixed startup issues on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
285 from Toolbox import Startup
c38be891d0ab Fixed startup issues on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
286 # set the library paths for plugins
c38be891d0ab Fixed startup issues on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
287 Startup.setLibraryPaths()
c38be891d0ab Fixed startup issues on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
288
513
a5329d7867c5 Fixed the QLocalSocket issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 467
diff changeset
289 app = E5Application(sys.argv)
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
290 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
291
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
292 logging.debug("Importing Preferences")
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
293 import Preferences
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
294
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 if Preferences.getUI("SingleApplicationMode"):
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 handleSingleApplication(ddindex)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297
265
5805c2e1415b Corrected and optimized the code for setting the Qt library paths.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 263
diff changeset
298 # set the search path for icons
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299 Startup.initializeResourceSearchPath()
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
300
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 # 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
302 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
303 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
304 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
305 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
306 splash = NoneSplashScreen()
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 elif not Preferences.getUI("ShowSplash"):
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 splash = NoneSplashScreen()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309 else:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 splash = SplashScreen()
3814
c8b7a6bbb1a4 Another little startup change in the eric main script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3812
diff changeset
311 QCoreApplication.processEvents()
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3628
diff changeset
313 # 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
314 if Globals.isWindowsPlatform():
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3628
diff changeset
315 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
316 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
317 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
318 else:
4383
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
319 path = pyqtDataDir
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
320 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
321
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322 pluginFile = None
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323 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
324 nocrash = False
5395
56efc13e456e Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
325 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
326 disabledPlugins = []
5380
8a9c2ed7fa84 Removed support for the obsoleted '--noopen' and '--nosplash' options.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5379
diff changeset
327 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
328 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
329 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
330 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
331 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
332 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
333 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
334 nocrash = True
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
335 if "--disable-crash" in sys.argv and \
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
336 sys.argv.index("--disable-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
337 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
338 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
339 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
340 for arg in sys.argv[:]:
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
341 if arg.startswith("--disable-plugin=") and \
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
342 sys.argv.index(arg) < ddindex:
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
343 # 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
344 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
345 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
346 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
347 disabledPlugins.append(pluginName)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348 for arg in sys.argv:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
349 if arg.startswith("--plugin=") and sys.argv.index(arg) < ddindex:
3812
9643514994be A little startup change in the eric main script.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3776
diff changeset
350 import Utilities
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
351 # 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
352 pluginFile = arg.replace("--plugin=", "").replace('"', "")
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 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
354 ddindex -= 1
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
355 pluginFile = os.path.expanduser(pluginFile)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356 pluginFile = Utilities.normabspath(pluginFile)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
357 break
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
358
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359 # 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
360 # if so, pass them to the UI
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361 if len(sys.argv) > 1:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
362 args = sys.argv[1:]
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
363
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
364 # get the Qt4 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
365 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
366 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
367 qtTransDir = QLibraryInfo.location(QLibraryInfo.TranslationsPath)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369 # 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
370 loc = Startup.loadTranslators(qtTransDir, app, ("qscintilla",))
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
371
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
372 # 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
373 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
374 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
375
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3667
diff changeset
376 splash.showMessage(QCoreApplication.translate("eric6", "Starting..."))
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 45
diff changeset
377 # 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
378 # 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
379 from UI.UserInterface import UserInterface
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
380
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
381 splash.showMessage(
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3667
diff changeset
382 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
383 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
384 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
385 originalPathString)
4419
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
386 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
387 mainWindow.show()
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
388
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
389 QTimer.singleShot(0, uiStartUp)
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
390
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
391 # 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
392 from E5Gui import E5ErrorMessage
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
393 eMsg = E5ErrorMessage.qtHandler()
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
394 eMsg.setMinimumSize(600, 400)
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
395
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
396 # start the event loop
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
397 inMainLoop = True
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
398 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
399 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
400 logging.shutdown()
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
401 sys.exit(res)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
403 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
404 main()

eric ide

mercurial