src/eric7/eric7_ide.py

branch
eric7
changeset 9413
80c06d472826
parent 9399
fcf9b48d8a0e
child 9429
b2db3a67525c
equal deleted inserted replaced
9412:45e7bb09c120 9413:80c06d472826
31 "--settings", 31 "--settings",
32 "--disable-crash", 32 "--disable-crash",
33 "--disable-plugin", 33 "--disable-plugin",
34 ] 34 ]
35 restartArgs = [arg for arg in sys.argv[1:] if arg.split("=", 1)[0] in restartArgsList] 35 restartArgs = [arg for arg in sys.argv[1:] if arg.split("=", 1)[0] in restartArgsList]
36
37 if os.path.dirname(__file__) not in sys.path:
38 sys.path.insert(1, os.path.dirname(__file__))
39 36
40 try: 37 try:
41 from PyQt6.QtCore import qWarning, QLibraryInfo, QTimer, QCoreApplication 38 from PyQt6.QtCore import qWarning, QLibraryInfo, QTimer, QCoreApplication
42 except ImportError: 39 except ImportError:
43 try: 40 try:
70 del sys.argv[sys.argv.index("--debug")] 67 del sys.argv[sys.argv.index("--debug")]
71 logging.basicConfig(level=logging.DEBUG) 68 logging.basicConfig(level=logging.DEBUG)
72 69
73 for arg in sys.argv[:]: 70 for arg in sys.argv[:]:
74 if arg.startswith("--config="): 71 if arg.startswith("--config="):
75 import Globals 72 from eric7 import Globals
76 73
77 configDir = arg.replace("--config=", "") 74 configDir = arg.replace("--config=", "")
78 Globals.setConfigDir(configDir) 75 Globals.setConfigDir(configDir)
79 sys.argv.remove(arg) 76 sys.argv.remove(arg)
80 elif arg.startswith("--settings="): 77 elif arg.startswith("--settings="):
88 ) 85 )
89 sys.argv.remove(arg) 86 sys.argv.remove(arg)
90 87
91 # make Third-Party package available as a packages repository 88 # make Third-Party package available as a packages repository
92 sys.path.insert(2, os.path.join(os.path.dirname(__file__), "ThirdParty", "Jasy")) 89 sys.path.insert(2, os.path.join(os.path.dirname(__file__), "ThirdParty", "Jasy"))
93 sys.path.insert(2, os.path.join(os.path.dirname(__file__), "DebugClients", "Python")) 90
94 91 from eric7.EricWidgets.EricApplication import EricApplication
95 from EricWidgets.EricApplication import EricApplication
96 92
97 93
98 def handleSingleApplication(ddindex): 94 def handleSingleApplication(ddindex):
99 """ 95 """
100 Global function to handle the single application mode. 96 Global function to handle the single application mode.
101 97
102 @param ddindex index of a '--' option in the options list 98 @param ddindex index of a '--' option in the options list
103 """ 99 """
104 from EricWidgets.EricSingleApplication import EricSingleApplicationClient 100 from eric7.EricWidgets.EricSingleApplication import EricSingleApplicationClient
105 101
106 client = EricSingleApplicationClient() 102 client = EricSingleApplicationClient()
107 res = client.connect() 103 res = client.connect()
108 if res > 0: 104 if res > 0:
109 if "--no-splash" in sys.argv and sys.argv.index("--no-splash") < ddindex: 105 if "--no-splash" in sys.argv and sys.argv.index("--no-splash") < ddindex:
153 149
154 @param excType exception type 150 @param excType exception type
155 @param excValue exception value 151 @param excValue exception value
156 @param tracebackobj traceback object 152 @param tracebackobj traceback object
157 """ 153 """
158 from UI.Info import BugAddress 154 from eric7.UI.Info import BugAddress
159 import Utilities 155 from eric7 import Globals, Utilities
160 import Globals
161 156
162 # Workaround for a strange issue with QScintilla 157 # Workaround for a strange issue with QScintilla
163 if str(excValue) == "unable to convert a QVariant back to a Python object": 158 if str(excValue) == "unable to convert a QVariant back to a Python object":
164 return 159 return
165 160
232 227
233 def main(): 228 def main():
234 """ 229 """
235 Main entry point into the application. 230 Main entry point into the application.
236 """ 231 """
237 from Globals import AppInfo 232 from eric7 import Globals
238 import Globals 233 from eric7.Globals import AppInfo
239 234
240 global app, args, mainWindow, splash, restartArgs, inMainLoop 235 global app, args, mainWindow, splash, restartArgs, inMainLoop
241 236
242 sys.excepthook = excepthook 237 sys.excepthook = excepthook
243 multiprocessing.set_start_method("spawn") 238 multiprocessing.set_start_method("spawn")
290 exeDir = os.path.dirname(sys.executable) 285 exeDir = os.path.dirname(sys.executable)
291 if exeDir not in pathList: 286 if exeDir not in pathList:
292 pathList.insert(0, exeDir) 287 pathList.insert(0, exeDir)
293 os.environ["PATH"] = os.pathsep.join(pathList) 288 os.environ["PATH"] = os.pathsep.join(pathList)
294 289
295 from Toolbox import Startup 290 from eric7.Toolbox import Startup
296 291
297 # set the library paths for plugins 292 # set the library paths for plugins
298 Startup.setLibraryPaths() 293 Startup.setLibraryPaths()
299 294
300 if WEBENGINE_AVAILABLE: 295 if WEBENGINE_AVAILABLE:
305 300
306 app = EricApplication(sys.argv) 301 app = EricApplication(sys.argv)
307 ddindex = Startup.handleArgs(sys.argv, appinfo) 302 ddindex = Startup.handleArgs(sys.argv, appinfo)
308 303
309 logging.debug("Importing Preferences") 304 logging.debug("Importing Preferences")
310 import Preferences 305 from eric7 import Preferences
311 306
312 if Preferences.getUI("SingleApplicationMode"): 307 if Preferences.getUI("SingleApplicationMode"):
313 handleSingleApplication(ddindex) 308 handleSingleApplication(ddindex)
314 309
315 # set the application style sheet 310 # set the application style sheet
317 312
318 # set the search path for icons 313 # set the search path for icons
319 Startup.initializeResourceSearchPath(app) 314 Startup.initializeResourceSearchPath(app)
320 315
321 # generate and show a splash window, if not suppressed 316 # generate and show a splash window, if not suppressed
322 from UI.SplashScreen import SplashScreen, NoneSplashScreen 317 from eric7.UI.SplashScreen import SplashScreen, NoneSplashScreen
323 318
324 if "--no-splash" in sys.argv and sys.argv.index("--no-splash") < ddindex: 319 if "--no-splash" in sys.argv and sys.argv.index("--no-splash") < ddindex:
325 sys.argv.remove("--no-splash") 320 sys.argv.remove("--no-splash")
326 ddindex -= 1 321 ddindex -= 1
327 splash = NoneSplashScreen() 322 splash = NoneSplashScreen()
386 381
387 # Load translation files and install them 382 # Load translation files and install them
388 loc = Startup.loadTranslators(qtTransDir, app, ("qscintilla",)) 383 loc = Startup.loadTranslators(qtTransDir, app, ("qscintilla",))
389 384
390 # Initialize SSL stuff 385 # Initialize SSL stuff
391 from EricNetwork.EricSslUtilities import initSSL 386 from eric7.EricNetwork.EricSslUtilities import initSSL
392 387
393 initSSL() 388 initSSL()
394 389
395 splash.showMessage(QCoreApplication.translate("eric7_ide", "Starting...")) 390 splash.showMessage(QCoreApplication.translate("eric7_ide", "Starting..."))
396 # We can only import these after creating the EricApplication because they 391 # We can only import these after creating the EricApplication because they
397 # make Qt calls that need the EricApplication to exist. 392 # make Qt calls that need the EricApplication to exist.
398 from UI.UserInterface import UserInterface 393 from eric7.UI.UserInterface import UserInterface
399 394
400 splash.showMessage( 395 splash.showMessage(
401 QCoreApplication.translate("eric7_ide", "Generating Main Window...") 396 QCoreApplication.translate("eric7_ide", "Generating Main Window...")
402 ) 397 )
403 mainWindow = UserInterface( 398 mainWindow = UserInterface(
416 mainWindow.show() 411 mainWindow.show()
417 412
418 QTimer.singleShot(0, uiStartUp) 413 QTimer.singleShot(0, uiStartUp)
419 414
420 # generate a graphical error handler 415 # generate a graphical error handler
421 from EricWidgets import EricErrorMessage 416 from eric7.EricWidgets import EricErrorMessage
422 417
423 eMsg = EricErrorMessage.qtHandler() 418 eMsg = EricErrorMessage.qtHandler()
424 eMsg.setMinimumSize(600, 400) 419 eMsg.setMinimumSize(600, 400)
425 420
426 # start the event loop 421 # start the event loop

eric ide

mercurial