eric6/eric6.py

Wed, 29 May 2019 22:14:02 +0200

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Wed, 29 May 2019 22:14:02 +0200
branch
Variables Viewer
changeset 7030
73779c4c135a
parent 6949
a5255f1ba3f0
child 7192
a22eee00b052
permissions
-rw-r--r--

Bugfix displaying to many characters as default_factory type.

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
2538
b2642e7a4c18 Fixed a few PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2526
diff changeset
32 try: # Only for Py2
4975
c71c0afee067 Added a few changes to improve the situation where Py2/3 compatibility packages are installed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4714
diff changeset
33 import Globals.compatibility_fixes # __IGNORE_WARNING__
3417
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
34 import StringIO as io # __IGNORE_EXCEPTION__
4383
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
35 import locale
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
36 except ImportError:
2526
a91cba8291b9 Minimum modifications to start Eric5 with Py2.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2525
diff changeset
37 import io # __IGNORE_WARNING__
3417
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
38 basestring = str
2526
a91cba8291b9 Minimum modifications to start Eric5 with Py2.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2525
diff changeset
39
3628
deb5973080a9 Added code to prevent possible segfaults when closing down.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3456
diff changeset
40 try:
6364
6a496f0886ad Prepared the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6267
diff changeset
41 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
42 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
43 except ImportError:
6365
85f8745427a6 Redid the "import sip" statements for PyQt 5.11.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6364
diff changeset
44 import sip
3628
deb5973080a9 Added code to prevent possible segfaults when closing down.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3456
diff changeset
45 sip.setdestroyonexit(False)
deb5973080a9 Added code to prevent possible segfaults when closing down.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3456
diff changeset
46 except AttributeError:
deb5973080a9 Added code to prevent possible segfaults when closing down.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3456
diff changeset
47 pass
deb5973080a9 Added code to prevent possible segfaults when closing down.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3456
diff changeset
48
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 import traceback
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 import time
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 import logging
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52
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
53 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
54 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
55 except ImportError:
3991
73731c4bf5bd Corrected some coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3937
diff changeset
56 try: # Py2
3709
191ccdf78966 Made the last change Python2 compatible.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3708
diff changeset
57 import tkMessageBox as 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
58 except ImportError:
3709
191ccdf78966 Made the last change Python2 compatible.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3708
diff changeset
59 try: # Py3
191ccdf78966 Made the last change Python2 compatible.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3708
diff changeset
60 from tkinter import messagebox
191ccdf78966 Made the last change Python2 compatible.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3708
diff changeset
61 except ImportError:
191ccdf78966 Made the last change Python2 compatible.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3708
diff changeset
62 sys.exit(100)
191ccdf78966 Made the last change Python2 compatible.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3708
diff changeset
63 messagebox.showerror(
191ccdf78966 Made the last change Python2 compatible.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3708
diff changeset
64 "eric6 Error",
4364
cdfdb1afaf27 Corrected a typo.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4343
diff changeset
65 "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
66 " 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
67 sys.exit(100)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68
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
69 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
70 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
71 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
72 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
73
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 # some global variables needed to start the application
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 args = None
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 mainWindow = None
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 splash = None
4383
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
78 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
79 app = None
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 if "--debug" in sys.argv:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 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
83 logging.basicConfig(level=logging.DEBUG)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84
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
85 for arg in sys.argv[:]:
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 if arg.startswith("--config="):
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
87 import Globals
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 configDir = arg.replace("--config=", "")
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
89 Globals.setConfigDir(configDir)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 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
91 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
92 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
93 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
94 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
95 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
96 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
97 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
98 sys.argv.remove(arg)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99
37
bfe92e414977 Fixed a few porting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 18
diff changeset
100 # 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
101 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
102 "ThirdParty", "Pygments"))
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
103 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
104 "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
105 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
106 "ThirdParty", "EditorConfig"))
a7fecbc392d7 Started implementing support for EditorConfig.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6092
diff changeset
107 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
108 "DebugClients", "Python"))
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 45
diff changeset
110 from E5Gui.E5Application import E5Application
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
112
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 def handleSingleApplication(ddindex):
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 """
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 Global function to handle the single application mode.
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 @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
118 """
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
119 from E5Gui.E5SingleApplication import E5SingleApplicationClient
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
120
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 45
diff changeset
121 client = E5SingleApplicationClient()
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 res = client.connect()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 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
124 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
125 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
126 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
127 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
128 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
129 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
130 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
131 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
132 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
133 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
134 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
135 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
136 ddindex -= 1
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 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
138 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
139 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
140 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
141 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
142 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
143 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
144 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
145 break
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 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
147 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
148 sys.argv.index(arg) < ddindex:
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 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
150 ddindex -= 1
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 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
152 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
153 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
154 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
155 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
156 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
157
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 if len(sys.argv) > 1:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 client.processArgs(sys.argv[1:])
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 sys.exit(0)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 elif res < 0:
5616
adcffadf4962 Reworked some __IGNORE_WARNING__ comments to be more specific.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
162 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
163 # __IGNORE_WARNING_M801__
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 sys.exit(res)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
166
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 def excepthook(excType, excValue, tracebackobj):
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 """
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 Global function to catch unhandled exceptions.
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 @param excType exception type
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 @param excValue exception value
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 @param tracebackobj traceback object
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174 """
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
175 from UI.Info import BugAddress
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
176 import Utilities
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
177 import Globals
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
178
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 separator = '-' * 80
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3667
diff changeset
180 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
181 notice = \
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 """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
183 """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
184 """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
185 BugAddress, logFile)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 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
187
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
188 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
189 separator, Utilities.generateVersionInfo())
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 pluginVersionInfo = Utilities.generatePluginsVersionInfo()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191 if pluginVersionInfo:
433
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 265
diff changeset
192 versionInfo += "{0}\n{1}".format(separator, pluginVersionInfo)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 distroInfo = Utilities.generateDistroInfo()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 if distroInfo:
433
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 265
diff changeset
195 versionInfo += "{0}\n{1}".format(separator, distroInfo)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196
3417
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
197 if isinstance(excType, basestring):
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
198 tbinfo = tracebackobj
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
199 else:
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
200 tbinfofile = io.StringIO()
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
201 traceback.print_tb(tracebackobj, None, tbinfofile)
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
202 tbinfofile.seek(0)
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
203 tbinfo = tbinfofile.read()
4383
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
204 if sys.version_info[0] == 2:
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
205 tbinfo = tbinfo.decode(locale.getpreferredencoding())
433
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 265
diff changeset
206 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
207 sections = [separator, timeString, separator, errmsg, separator, tbinfo]
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 msg = '\n'.join(sections)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 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
210 f = open(logFile, "w", encoding="utf-8")
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 f.write(msg)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 f.write(versionInfo)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 f.close()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 except IOError:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215 pass
3417
5a93c6cdc989 Exception handling for client side implemented.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
216
4383
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
217 if inMainLoop is None:
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
218 if sys.version_info[0] == 2:
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
219 notice = notice.encode(sys.stdout.encoding, 'replace')
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
220 msg = msg.encode(sys.stdout.encoding, 'replace')
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
221 versionInfo = versionInfo.encode(sys.stdout.encoding, 'replace')
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
222 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
223 print(warning) # __IGNORE_WARNING_M801__
4383
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
224 else:
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
225 warning = notice + msg + versionInfo
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
226 # 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
227 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
228 .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
229 .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
230 .replace("<", "&lt;")
4383
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
231 if sys.version_info[0] == 2:
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
232 warning = warning.encode('utf-8', 'replace')
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
233 qWarning(warning)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
235
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 def uiStartUp():
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 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
239
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 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
241 """
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 global args, mainWindow, splash
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 if splash:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245 splash.finish(mainWindow)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 del splash
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 mainWindow.checkForErrorLog()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 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
250 mainWindow.checkProjectsWorkspace()
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 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
252 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
253 mainWindow.checkPluginUpdatesAvailable()
2237
baddb671c326 Continued with the IRC management.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2087
diff changeset
254 mainWindow.autoConnectIrc()
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
256
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 def main():
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 """
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 Main entry point into the application.
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 """
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
261 from Globals import AppInfo
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
262 import Globals
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
263
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
264 global app, args, mainWindow, splash, restartArgs, inMainLoop
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266 sys.excepthook = excepthook
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
268 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
269 ("--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
270 "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
271 ("--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
272 ("--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
273 ("--no-open",
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
274 "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
275 ("--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
276 ("--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
277 ("--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
278 "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
279 ("--plugin=plugin-file",
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
280 "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
281 ("--pyqt4",
0a86d976fef5 Added a missing eric6 help entry.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4975
diff changeset
282 "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
283 ("--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
284 "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
285 ("--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
286 ("--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
287 ("--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
288 ("--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
289 ("--",
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
290 "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
291 ("",
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
292 "(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
293 ]
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2084
diff changeset
294 appinfo = AppInfo.makeAppInfo(sys.argv,
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3667
diff changeset
295 "Eric6",
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 "[project | files... [--] [debug-options]]",
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 "A Python IDE",
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 options)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299
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
300 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
301 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
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
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317 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
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 if sys.version_info[0] == 2:
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
339 path = path.encode(sys.getfilesystemencoding())
0374f9654ac4 Improved error reporting at start up.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4364
diff changeset
340 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
341
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
342 pluginFile = None
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
343 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
344 nocrash = False
5395
56efc13e456e Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
345 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
346 disabledPlugins = []
5380
8a9c2ed7fa84 Removed support for the obsoleted '--noopen' and '--nosplash' options.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5379
diff changeset
347 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
348 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
349 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
350 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
351 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
352 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
353 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
354 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
355 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
356 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
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[:]:
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
361 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
362 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
363 # 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
364 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
365 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
366 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
367 disabledPlugins.append(pluginName)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368 for arg in sys.argv:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369 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
370 import Utilities
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
371 # 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
372 pluginFile = arg.replace("--plugin=", "").replace('"', "")
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373 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
374 ddindex -= 1
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 pluginFile = os.path.expanduser(pluginFile)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 pluginFile = Utilities.normabspath(pluginFile)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377 break
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379 # 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
380 # if so, pass them to the UI
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381 if len(sys.argv) > 1:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 args = sys.argv[1:]
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384 # 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
385 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
386 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
387 qtTransDir = QLibraryInfo.location(QLibraryInfo.TranslationsPath)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
388
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
389 # 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
390 loc = Startup.loadTranslators(qtTransDir, app, ("qscintilla",))
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
391
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
392 # 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
393 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
394 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
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3667
diff changeset
396 splash.showMessage(QCoreApplication.translate("eric6", "Starting..."))
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 45
diff changeset
397 # 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
398 # 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
399 from UI.UserInterface import UserInterface
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
401 splash.showMessage(
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3667
diff changeset
402 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
403 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
404 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
405 originalPathString)
4419
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
406 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
407 mainWindow.show()
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
408
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
409 QTimer.singleShot(0, uiStartUp)
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
410
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
411 # 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
412 from E5Gui import E5ErrorMessage
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
413 eMsg = E5ErrorMessage.qtHandler()
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
414 eMsg.setMinimumSize(600, 400)
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
415
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
416 # start the event loop
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
417 inMainLoop = True
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
418 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
419 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
420 logging.shutdown()
66be66ec3afc Removed the re-raise in the eric main() function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4411
diff changeset
421 sys.exit(res)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
422
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
423 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
424 main()

eric ide

mercurial