|
1 #!/usr/bin/env python3 |
|
2 # -*- coding: utf-8 -*- |
|
3 |
|
4 # Copyright (c) 2013 - 2014 Detlev Offenbach <detlev@die-offenbachs.de> |
|
5 # |
|
6 |
|
7 """ |
|
8 Eric5 QRegularExpression. |
|
9 |
|
10 This is the main Python script that performs the necessary initialization |
|
11 of the QRegularExpression wizard module and starts the Qt event loop. This is |
|
12 a standalone version of the integrated QRegularExpression wizard. |
|
13 """ |
|
14 |
|
15 from __future__ import unicode_literals |
|
16 |
|
17 try: # Only for Py2 |
|
18 import Utilities.compatibility_fixes # __IGNORE_WARNING__ |
|
19 except (ImportError): |
|
20 pass |
|
21 |
|
22 import sys |
|
23 |
|
24 for arg in sys.argv: |
|
25 if arg.startswith("--config="): |
|
26 import Globals |
|
27 configDir = arg.replace("--config=", "") |
|
28 Globals.setConfigDir(configDir) |
|
29 sys.argv.remove(arg) |
|
30 break |
|
31 |
|
32 from Globals import AppInfo |
|
33 |
|
34 from Toolbox import Startup |
|
35 |
|
36 |
|
37 def createMainWidget(argv): |
|
38 """ |
|
39 Function to create the main widget. |
|
40 |
|
41 @param argv list of commandline parameters (list of strings) |
|
42 @return reference to the main widget (QWidget) |
|
43 """ |
|
44 from Plugins.WizardPlugins.QRegularExpressionWizard\ |
|
45 .QRegularExpressionWizardDialog import QRegularExpressionWizardWindow |
|
46 return QRegularExpressionWizardWindow() |
|
47 |
|
48 |
|
49 def main(): |
|
50 """ |
|
51 Main entry point into the application. |
|
52 """ |
|
53 options = [ |
|
54 ("--config=configDir", |
|
55 "use the given directory as the one containing the config files"), |
|
56 ] |
|
57 appinfo = AppInfo.makeAppInfo( |
|
58 sys.argv, |
|
59 "Eric5 QRegularExpression", |
|
60 "", |
|
61 "Regexp editor for Qt's QRegularExpression class", |
|
62 options) |
|
63 res = Startup.simpleAppStartup(sys.argv, |
|
64 appinfo, |
|
65 createMainWidget) |
|
66 sys.exit(res) |
|
67 |
|
68 if __name__ == '__main__': |
|
69 main() |