src/eric7/Toolbox/Startup.py

Sat, 23 Dec 2023 15:48:12 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 23 Dec 2023 15:48:12 +0100
branch
eric7
changeset 10439
21c28b0f9e41
parent 10431
64157aeb0312
child 10671
f2d75784e574
permissions
-rw-r--r--

Updated copyright for 2024.

2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
10439
21c28b0f9e41 Updated copyright for 2024.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10431
diff changeset
3 # Copyright (c) 2002 - 2024 Detlev Offenbach <detlev@die-offenbachs.de>
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2683
diff changeset
7 Module implementing some startup helper funcions.
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 import os
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 import sys
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9448
diff changeset
13 from PyQt6.QtCore import QDir, QLibraryInfo, QLocale, QTranslator
8318
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8314
diff changeset
14 from PyQt6.QtWidgets import QApplication
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9448
diff changeset
16 from eric7 import Globals
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9448
diff changeset
17 from eric7.EricGui import EricPixmapCache
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
18 from eric7.EricWidgets.EricApplication import EricApplication
9448
ea215f7afab3 Fixed an issue importing the eric7config module.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
19 from eric7.Globals import getConfig
9624
b47dfa7a137d Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9482
diff changeset
20 from eric7.SystemUtilities import QtUtilities
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
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
22 application = None
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
23
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24
7461
1f239d5f89b8 Added code to include the Breeze icons depending on window lightness factor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
25 def initializeResourceSearchPath(application):
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 """
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 Module function to initialize the default mime source factory.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
28
7493
1696e91a5393 Added vector icons for the mercurial and subversion plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7461
diff changeset
29 @param application reference to the application object
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
30 @type EricApplication
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 """
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
32 from eric7 import Preferences
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
33
7527
b2ae47eaf0ae Startup: added some forgotten code to apply the user selected default icon set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7521
diff changeset
34 defaultIconPaths = getDefaultIconPaths(application)
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 iconPaths = Preferences.getIcons("Path")
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 for iconPath in iconPaths:
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 if iconPath:
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
38 EricPixmapCache.addSearchPath(iconPath)
2217
e80c74f2a25a Added some icons to the "Languages" and "End-of-Line Type" context menus of the editor and changed the status labels for programming language and end-of-line type of the main window to show an icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2087
diff changeset
39 for defaultIconPath in defaultIconPaths:
3621
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3539
diff changeset
40 if defaultIconPath not in iconPaths:
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
41 EricPixmapCache.addSearchPath(defaultIconPath)
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43
7527
b2ae47eaf0ae Startup: added some forgotten code to apply the user selected default icon set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7521
diff changeset
44 def getDefaultIconPaths(application):
b2ae47eaf0ae Startup: added some forgotten code to apply the user selected default icon set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7521
diff changeset
45 """
b2ae47eaf0ae Startup: added some forgotten code to apply the user selected default icon set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7521
diff changeset
46 Module function to determine the default icon paths.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
47
7527
b2ae47eaf0ae Startup: added some forgotten code to apply the user selected default icon set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7521
diff changeset
48 @param application reference to the application object
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
49 @type EricApplication
7527
b2ae47eaf0ae Startup: added some forgotten code to apply the user selected default icon set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7521
diff changeset
50 @return list of default icon paths
b2ae47eaf0ae Startup: added some forgotten code to apply the user selected default icon set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7521
diff changeset
51 @rtype list of str
b2ae47eaf0ae Startup: added some forgotten code to apply the user selected default icon set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7521
diff changeset
52 """
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
53 from eric7 import Preferences
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
54
7527
b2ae47eaf0ae Startup: added some forgotten code to apply the user selected default icon set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7521
diff changeset
55 defaultIconsPath = Preferences.getIcons("DefaultIconsPath")
b2ae47eaf0ae Startup: added some forgotten code to apply the user selected default icon set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7521
diff changeset
56 if defaultIconsPath == "automatic":
b2ae47eaf0ae Startup: added some forgotten code to apply the user selected default icon set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7521
diff changeset
57 if application.usesDarkPalette():
b2ae47eaf0ae Startup: added some forgotten code to apply the user selected default icon set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7521
diff changeset
58 # dark desktop
b2ae47eaf0ae Startup: added some forgotten code to apply the user selected default icon set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7521
diff changeset
59 defaultIconsPath = "breeze-dark"
b2ae47eaf0ae Startup: added some forgotten code to apply the user selected default icon set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7521
diff changeset
60 else:
b2ae47eaf0ae Startup: added some forgotten code to apply the user selected default icon set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7521
diff changeset
61 # light desktop
b2ae47eaf0ae Startup: added some forgotten code to apply the user selected default icon set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7521
diff changeset
62 defaultIconsPath = "breeze-light"
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
63
7527
b2ae47eaf0ae Startup: added some forgotten code to apply the user selected default icon set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7521
diff changeset
64 return [
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
65 os.path.join(getConfig("ericIconDir"), defaultIconsPath),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
66 os.path.join(getConfig("ericIconDir"), defaultIconsPath, "languages"),
7527
b2ae47eaf0ae Startup: added some forgotten code to apply the user selected default icon set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7521
diff changeset
67 ]
b2ae47eaf0ae Startup: added some forgotten code to apply the user selected default icon set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7521
diff changeset
68
b2ae47eaf0ae Startup: added some forgotten code to apply the user selected default icon set.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7521
diff changeset
69
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 def setLibraryPaths():
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 """
8718
3456fb2a2cb0 Corrected a source docu string.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8709
diff changeset
72 Module function to set the Qt library paths correctly.
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 """
8709
41a9ecc5b17b Added code for all platforms to adjust the Qt library paths array.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8459
diff changeset
74 libPaths = (
9624
b47dfa7a137d Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9482
diff changeset
75 os.path.join(QtUtilities.getPyQt6ModulesDirectory(), "plugins"),
b47dfa7a137d Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9482
diff changeset
76 os.path.join(QtUtilities.getPyQt6ModulesDirectory(), "Qt6", "plugins"),
8709
41a9ecc5b17b Added code for all platforms to adjust the Qt library paths array.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8459
diff changeset
77 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
78
8709
41a9ecc5b17b Added code for all platforms to adjust the Qt library paths array.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8459
diff changeset
79 libraryPaths = QApplication.libraryPaths()
41a9ecc5b17b Added code for all platforms to adjust the Qt library paths array.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8459
diff changeset
80 for libPath in libPaths:
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 if os.path.exists(libPath):
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 libPath = QDir.fromNativeSeparators(libPath)
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 if libPath not in libraryPaths:
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 libraryPaths.insert(0, libPath)
8709
41a9ecc5b17b Added code for all platforms to adjust the Qt library paths array.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8459
diff changeset
85 QApplication.setLibraryPaths(libraryPaths)
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
87
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 # the translator must not be deleted, therefore we save them here
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 loaded_translators = {}
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 def loadTranslators(qtTransDir, app, translationFiles=()):
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 """
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 Module function to load all required translations.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
95
10303
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
96 @param qtTransDir directory of the Qt translations files
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
97 @type str
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
98 @param app reference to the application object
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
99 @type QApplication
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 @param translationFiles tuple of additional translations to
10303
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
101 be loaded
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
102 @type tuple of str
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
103 @return the requested locale
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
104 @rtype str
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 """
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
106 from eric7 import Preferences
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
107
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 global loaded_translators
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
109
7795
a4c2f0081879 Fixed an issue related to the splitting of the Qt translation files. Just loading the qt.qm file is not working.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7790
diff changeset
110 translations = (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
111 "qt",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
112 "qt_help",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
113 "qtbase",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
114 "qtmultimedia",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
115 "qtserialport",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
116 "qtwebengine",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
117 "qtwebsockets",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
118 "eric7",
7795
a4c2f0081879 Fixed an issue related to the splitting of the Qt translation files. Just loading the qt.qm file is not working.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7790
diff changeset
119 ) + translationFiles
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 loc = Preferences.getUILanguage()
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 if loc is None:
6891
93f82da09f22 Fixed some code style issues detected by the new 'return' checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6775
diff changeset
122 return ""
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 if loc == "System":
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 loc = QLocale.system().name()
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 if loc != "C":
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
127 dirs = [getConfig("ericTranslationsDir"), Globals.getConfigDir()]
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 if qtTransDir is not None:
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 dirs.append(qtTransDir)
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 loca = loc
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 for tf in ["{0}_{1}".format(tr, loc) for tr in translations]:
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 translator, ok = loadTranslatorForLocale(dirs, tf)
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 loaded_translators[tf] = translator
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 if ok:
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 app.installTranslator(translator)
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 else:
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
138 if tf.startswith("eric7"):
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 loca = None
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 loc = loca
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 else:
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 loc = None
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 return loc
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145
10303
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
146 def loadTranslatorForLocale(dirs, tn):
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
147 """
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
148 Module function to find and load a specific translation.
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
149
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
150 @param dirs searchpath for the translations
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
151 @type list of str
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
152 @param tn translation to be loaded
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
153 @type str
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
154 @return tuple containing a status flag and the loaded translator
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
155 @rtype tuple of (int, QTranslator)
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
156 """
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
157 trans = QTranslator(None)
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
158 for directory in dirs:
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
159 loaded = trans.load(tn, directory)
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
160 if loaded:
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
161 return (trans, True)
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
162
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
163 print("Warning: translation file '" + tn + "'could not be loaded.")
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
164 print("Using default.")
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
165 return (None, False)
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
166
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
167
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
168 def appStartup(
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
169 args,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
170 mwFactory,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
171 quitOnLastWindowClosed=True,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
172 app=None,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
173 raiseIt=True,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
174 installErrorHandler=False,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
175 ):
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 """
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2683
diff changeset
177 Module function to start up an application that doesn't need a specialized
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2683
diff changeset
178 start up.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
179
7960
e8fc383322f7 Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
180 This function is used by all of eric's helper programs.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
181
10303
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
182 @param args namespace object created by ArgumentParser.parse_args() containing
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
183 the parsed command line arguments
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
184 @type argparse.Namespace
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 @param mwFactory factory function generating the main widget. This
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 function must accept the following parameter.
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 <dl>
10303
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
188 <dt>args</dt>
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
189 <dd>parsed command line arguments (argparse.Namespace)</dd>
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 </dl>
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10303
diff changeset
191 @type function
7900
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7795
diff changeset
192 @param quitOnLastWindowClosed flag indicating to quit the application,
10303
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
193 if the last window was closed
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
194 @type bool
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
195 @param app reference to the application object
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
196 @type QApplication or None
7900
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7795
diff changeset
197 @param raiseIt flag indicating to raise the generated application
10303
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
198 window
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
199 @type bool
7900
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7795
diff changeset
200 @param installErrorHandler flag indicating to install an error
10303
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
201 handler dialog
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
202 @type bool
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
203 @return exit result
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
204 @rtype int
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 """
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
206 global application
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
207
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
208 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
209 del os.environ["__PYVENV_LAUNCHER__"]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
210
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 if app is None:
4035
c38be891d0ab Fixed startup issues on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
212 # set the library paths for plugins
c38be891d0ab Fixed startup issues on Windows platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
213 setLibraryPaths()
10303
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
214 app = EricApplication(sys.argv)
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
215 application = app
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 app.setQuitOnLastWindowClosed(quitOnLastWindowClosed)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
217
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 # the following code depends upon a valid application object
9482
a2bc06a54d9d Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
219 from eric7 import Preferences # __IGNORE_WARNING_I101__
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
220
8837
6b4b2acc5324 Added capability to configure the eric application palette via a QSS file (handled internally by eric).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8718
diff changeset
221 # set the application style sheet
6b4b2acc5324 Added capability to configure the eric application palette via a QSS file (handled internally by eric).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8718
diff changeset
222 app.setStyleSheetFile(Preferences.getUI("StyleSheet"))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
223
7461
1f239d5f89b8 Added code to include the Breeze icons depending on window lightness factor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
224 initializeResourceSearchPath(app)
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
225 QApplication.setWindowIcon(EricPixmapCache.getIcon("eric"))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
226
4714
03c5936c79e5 Change the prefference for the Qt translations directory because it still reflected Qt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
227 qtTransDir = Preferences.getQtTranslationsDir()
03c5936c79e5 Change the prefference for the Qt translations directory because it still reflected Qt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
228 if not qtTransDir:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
229 qtTransDir = QLibraryInfo.path(QLibraryInfo.LibraryPath.TranslationsPath)
4714
03c5936c79e5 Change the prefference for the Qt translations directory because it still reflected Qt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
230 loadTranslators(qtTransDir, app, ("qscintilla",))
03c5936c79e5 Change the prefference for the Qt translations directory because it still reflected Qt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
231 # qscintilla needed for web browser
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
232
10303
ee1aadab1215 Changed code to use the 'argparse' module to parse the command line parameters instead of using own code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9674
diff changeset
233 w = mwFactory(args)
5283
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4714
diff changeset
234 if w is None:
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4714
diff changeset
235 return 100
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
236
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 if quitOnLastWindowClosed:
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238 app.lastWindowClosed.connect(app.quit)
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239 w.show()
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 if raiseIt:
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241 w.raise_()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
242
2683
ef93fc7332a2 Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2614
diff changeset
243 if installErrorHandler:
ef93fc7332a2 Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2614
diff changeset
244 # generate a graphical error handler
9482
a2bc06a54d9d Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
245 from eric7.EricWidgets import EricErrorMessage # __IGNORE_WARNING_I101__
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
246
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
247 eMsg = EricErrorMessage.qtHandler()
2683
ef93fc7332a2 Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2614
diff changeset
248 eMsg.setMinimumSize(600, 400)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
249
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
250 return app.exec()
4566
a2e8f3c420ec Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4035
diff changeset
251
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
252
4566
a2e8f3c420ec Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4035
diff changeset
253 #
a2e8f3c420ec Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4035
diff changeset
254 # eflag: noqa = M801

eric ide

mercurial