1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2004 - 2012 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Eric4 Re
This is the main Python script that performs the necessary initialization
of the PyRegExp wizard module and starts the Qt event loop. This is a standalone
version of the integrated PyRegExp wizard.
"""
import sys
import os
# disable the usage of KDE widgets, if requested
sys.e4nokde = False
if "--nokde" in sys.argv:
del sys.argv[sys.argv.index("--nokde")]
sys.e4nokde = True
else:
sys.e4nokde = os.getenv("e4nokde") is not None and os.getenv("e4nokde") == "1"
for arg in sys.argv:
if arg.startswith("--config="):
import Utilities
configDir = arg.replace("--config=", "")
Utilities.setConfigDir(configDir)
sys.argv.remove(arg)
break
from Utilities import Startup
def createMainWidget(argv):
"""
Function to create the main widget.
@param argv list of commandline parameters (list of strings)
@return reference to the main widget (QWidget)
"""
from Plugins.WizardPlugins.PyRegExpWizard.PyRegExpWizardDialog import \
PyRegExpWizardWindow
return PyRegExpWizardWindow()
def main():
"""
Main entry point into the application.
"""
options = [\
("--config=configDir",
"use the given directory as the one containing the config files"),
("--nokde" , "don't use KDE widgets"),
]
appinfo = Startup.makeAppInfo(sys.argv,
"Eric4 RE",
"",
"Regexp editor for the Python re module",
options)
res = Startup.simpleAppStartup(sys.argv,
appinfo,
createMainWidget)
sys.exit(res)
if __name__ == '__main__':
main()
|