src/eric7/eric7_re.py

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8881
54e42bc2437a
child 9221
bf71ee032bb4
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3
4 # Copyright (c) 2004 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
5 #
6
7 """
8 eric Re.
9
10 This is the main Python script that performs the necessary initialization
11 of the PyRegExp wizard module and starts the Qt event loop. This is a
12 standalone version of the integrated PyRegExp wizard.
13 """
14
15 import sys
16 import os
17
18 sys.path.insert(1, os.path.dirname(__file__))
19
20 for arg in sys.argv[:]:
21 if arg.startswith("--config="):
22 import Globals
23 configDir = arg.replace("--config=", "")
24 Globals.setConfigDir(configDir)
25 sys.argv.remove(arg)
26 elif arg.startswith("--settings="):
27 from PyQt6.QtCore import QSettings
28 settingsDir = os.path.expanduser(arg.replace("--settings=", ""))
29 if not os.path.isdir(settingsDir):
30 os.makedirs(settingsDir)
31 QSettings.setPath(
32 QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir)
33 sys.argv.remove(arg)
34
35 from Globals import AppInfo
36
37 from Toolbox import Startup
38
39
40 def createMainWidget(argv):
41 """
42 Function to create the main widget.
43
44 @param argv list of commandline parameters (list of strings)
45 @return reference to the main widget (QWidget)
46 """
47 from Plugins.WizardPlugins.PyRegExpWizard.PyRegExpWizardDialog import (
48 PyRegExpWizardWindow
49 )
50 return PyRegExpWizardWindow()
51
52
53 def main():
54 """
55 Main entry point into the application.
56 """
57 from PyQt6.QtGui import QGuiApplication
58 QGuiApplication.setDesktopFileName("eric7_re.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 RE",
68 "",
69 "Regexp editor for the Python re module",
70 options)
71 res = Startup.simpleAppStartup(sys.argv,
72 appinfo,
73 createMainWidget)
74 sys.exit(res)
75
76 if __name__ == '__main__':
77 main()

eric ide

mercurial