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