eric6_uipreviewer.py

changeset 3669
ac84ac3c0f05
parent 3656
441956d8fce5
child 3670
f0cb7579c0b4
equal deleted inserted replaced
3668:0e83d06e5429 3669:ac84ac3c0f05
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3
4 # Copyright (c) 2004 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
5 #
6
7 """
8 Eric5 UI Previewer.
9
10 This is the main Python script that performs the necessary initialization
11 of the ui previewer and starts the Qt event loop. This is a standalone version
12 of the integrated ui previewer.
13 """
14
15 from __future__ import unicode_literals
16 try: # Only for Py2
17 import Utilities.compatibility_fixes # __IGNORE_WARNING__
18 except (ImportError):
19 pass
20
21 import sys
22
23 for arg in sys.argv:
24 if arg.startswith("--config="):
25 import Globals
26 configDir = arg.replace("--config=", "")
27 Globals.setConfigDir(configDir)
28 sys.argv.remove(arg)
29 break
30
31 from Globals import AppInfo
32
33 from Toolbox import Startup
34
35
36 def createMainWidget(argv):
37 """
38 Function to create the main widget.
39
40 @param argv list of commandline parameters (list of strings)
41 @return reference to the main widget (QWidget)
42 """
43 from Tools.UIPreviewer import UIPreviewer
44
45 if len(argv) > 1:
46 fn = argv[1]
47 else:
48 fn = None
49
50 previewer = UIPreviewer(fn, None, 'UIPreviewer')
51 return previewer
52
53
54 def main():
55 """
56 Main entry point into the application.
57 """
58 options = [
59 ("--config=configDir",
60 "use the given directory as the one containing the config files"),
61 ]
62 appinfo = AppInfo.makeAppInfo(sys.argv,
63 "Eric5 UI Previewer",
64 "file",
65 "UI file previewer",
66 options)
67 res = Startup.simpleAppStartup(sys.argv,
68 appinfo,
69 createMainWidget)
70 sys.exit(res)
71
72 if __name__ == '__main__':
73 main()

eric ide

mercurial