eric7/eric7_shell.py

branch
eric7
changeset 8312
800c432b34c8
parent 8143
2c730d5fd177
child 8314
e3642a6a1e71
equal deleted inserted replaced
8311:4e8b98454baa 8312:800c432b34c8
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3
4 # Copyright (c) 2017 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
5 #
6
7 """
8 eric Shell.
9
10 This is the main Python script that performs the necessary initialization
11 of the ShellWindow module and starts the Qt event loop.
12 """
13
14 import sys
15 import os
16
17 originalPathString = os.getenv("PATH")
18
19 sys.path.insert(1, os.path.dirname(__file__))
20
21 for arg in sys.argv[:]:
22 if arg.startswith("--config="):
23 import Globals
24 configDir = arg.replace("--config=", "")
25 Globals.setConfigDir(configDir)
26 sys.argv.remove(arg)
27 elif arg.startswith("--settings="):
28 from PyQt5.QtCore import QSettings
29 settingsDir = os.path.expanduser(arg.replace("--settings=", ""))
30 if not os.path.isdir(settingsDir):
31 os.makedirs(settingsDir)
32 QSettings.setPath(
33 QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir)
34 sys.argv.remove(arg)
35
36 from Globals import AppInfo
37
38 from Toolbox import Startup
39
40
41 def createMainWidget(argv):
42 """
43 Function to create the main widget.
44
45 @param argv list of commandline parameters (list of strings)
46 @return reference to the main widget (QWidget)
47 """
48 from QScintilla.ShellWindow import ShellWindow
49
50 return ShellWindow(originalPathString)
51
52
53 def main():
54 """
55 Main entry point into the application.
56 """
57 from PyQt5.QtGui import QGuiApplication
58 QGuiApplication.setDesktopFileName("eric6_shell.desktop")
59
60 options = [
61 ("--config=configDir",
62 "use the given directory as the one containing the config files"),
63 ("--settings=settingsDir",
64 "use the given directory to store the settings files"),
65 ]
66 appinfo = AppInfo.makeAppInfo(sys.argv,
67 "eric Shell",
68 "",
69 "Stand alone version of the eric"
70 " interpreter shell",
71 options)
72 res = Startup.simpleAppStartup(sys.argv,
73 appinfo,
74 createMainWidget)
75 sys.exit(res)
76
77 if __name__ == '__main__':
78 main()

eric ide

mercurial