eric5_qregularexpression.py

branch
Py2 comp.
changeset 2791
a9577f248f04
parent 2736
86cd4d14b58e
child 3057
10516539f238
equal deleted inserted replaced
2790:6686a3326df8 2791:a9577f248f04
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3
4 # Copyright (c) 2013 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 a standalone
12 version of the integrated QRegularExpression wizard.
13 """
14
15 from __future__ import unicode_literals # __IGNORE_WARNING__
16
17 try: # Only for Py2
18 import sip
19 sip.setapi('QString', 2)
20 sip.setapi('QVariant', 2)
21 sip.setapi('QTextStream', 2)
22 import Utilities.compatibility_fixes # __IGNORE_WARNING__
23 except (ImportError):
24 pass
25
26 import sys
27
28 for arg in sys.argv:
29 if arg.startswith("--config="):
30 import Globals
31 configDir = arg.replace("--config=", "")
32 Globals.setConfigDir(configDir)
33 sys.argv.remove(arg)
34 break
35
36 from Globals import AppInfo
37
38 from Toolbox import Startup
39
40
41 def createMainWidget(argv):
42 """
43 Function to create the main widget.
44
45 @param argv list of commandline parameters (list of strings)
46 @return reference to the main widget (QWidget)
47 """
48 from Plugins.WizardPlugins.QRegularExpressionWizard.QRegularExpressionWizardDialog \
49 import QRegularExpressionWizardWindow
50 return QRegularExpressionWizardWindow()
51
52
53 def main():
54 """
55 Main entry point into the application.
56 """
57 options = [\
58 ("--config=configDir",
59 "use the given directory as the one containing the config files"),
60 ]
61 appinfo = AppInfo.makeAppInfo(sys.argv,
62 "Eric5 QRegularExpression",
63 "",
64 "Regexp editor for Qt's QRegularExpression class",
65 options)
66 res = Startup.simpleAppStartup(sys.argv,
67 appinfo,
68 createMainWidget)
69 sys.exit(res)
70
71 if __name__ == '__main__':
72 main()

eric ide

mercurial