src/eric7/eric7_re.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
18 sys.path.insert(1, os.path.dirname(__file__)) 18 sys.path.insert(1, os.path.dirname(__file__))
19 19
20 for arg in sys.argv[:]: 20 for arg in sys.argv[:]:
21 if arg.startswith("--config="): 21 if arg.startswith("--config="):
22 import Globals 22 import Globals
23
23 configDir = arg.replace("--config=", "") 24 configDir = arg.replace("--config=", "")
24 Globals.setConfigDir(configDir) 25 Globals.setConfigDir(configDir)
25 sys.argv.remove(arg) 26 sys.argv.remove(arg)
26 elif arg.startswith("--settings="): 27 elif arg.startswith("--settings="):
27 from PyQt6.QtCore import QSettings 28 from PyQt6.QtCore import QSettings
29
28 settingsDir = os.path.expanduser(arg.replace("--settings=", "")) 30 settingsDir = os.path.expanduser(arg.replace("--settings=", ""))
29 if not os.path.isdir(settingsDir): 31 if not os.path.isdir(settingsDir):
30 os.makedirs(settingsDir) 32 os.makedirs(settingsDir)
31 QSettings.setPath( 33 QSettings.setPath(
32 QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) 34 QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir
35 )
33 sys.argv.remove(arg) 36 sys.argv.remove(arg)
34 37
35 from Globals import AppInfo 38 from Globals import AppInfo
36 39
37 from Toolbox import Startup 40 from Toolbox import Startup
38 41
39 42
40 def createMainWidget(argv): 43 def createMainWidget(argv):
41 """ 44 """
42 Function to create the main widget. 45 Function to create the main widget.
43 46
44 @param argv list of commandline parameters (list of strings) 47 @param argv list of commandline parameters (list of strings)
45 @return reference to the main widget (QWidget) 48 @return reference to the main widget (QWidget)
46 """ 49 """
47 from Plugins.WizardPlugins.PyRegExpWizard.PyRegExpWizardDialog import ( 50 from Plugins.WizardPlugins.PyRegExpWizard.PyRegExpWizardDialog import (
48 PyRegExpWizardWindow 51 PyRegExpWizardWindow,
49 ) 52 )
53
50 return PyRegExpWizardWindow() 54 return PyRegExpWizardWindow()
51 55
52 56
53 def main(): 57 def main():
54 """ 58 """
55 Main entry point into the application. 59 Main entry point into the application.
56 """ 60 """
57 from PyQt6.QtGui import QGuiApplication 61 from PyQt6.QtGui import QGuiApplication
62
58 QGuiApplication.setDesktopFileName("eric7_re.desktop") 63 QGuiApplication.setDesktopFileName("eric7_re.desktop")
59 64
60 options = [ 65 options = [
61 ("--config=configDir", 66 (
62 "use the given directory as the one containing the config files"), 67 "--config=configDir",
63 ("--settings=settingsDir", 68 "use the given directory as the one containing the config files",
64 "use the given directory to store the settings files"), 69 ),
70 (
71 "--settings=settingsDir",
72 "use the given directory to store the settings files",
73 ),
65 ] 74 ]
66 appinfo = AppInfo.makeAppInfo(sys.argv, 75 appinfo = AppInfo.makeAppInfo(
67 "eric RE", 76 sys.argv, "eric RE", "", "Regexp editor for the Python re module", options
68 "", 77 )
69 "Regexp editor for the Python re module", 78 res = Startup.simpleAppStartup(sys.argv, appinfo, createMainWidget)
70 options)
71 res = Startup.simpleAppStartup(sys.argv,
72 appinfo,
73 createMainWidget)
74 sys.exit(res) 79 sys.exit(res)
75 80
76 if __name__ == '__main__': 81
82 if __name__ == "__main__":
77 main() 83 main()

eric ide

mercurial