eric5_iconeditor.py

changeset 896
f855351d5e98
parent 791
9ec2ac20e54e
child 945
8cd4d08fa9f6
child 1510
e75ecf2bd9dd
equal deleted inserted replaced
894:eab7b8d39807 896:f855351d5e98
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3
4 # Copyright (c) 2009 - 2011 Detlev Offenbach <detlev@die-offenbachs.de>
5 #
6
7 """
8 Eric5 Icon Editor
9
10 This is the main Python script that performs the necessary initialization
11 of the icon editor and starts the Qt event loop. This is a standalone version
12 of the integrated icon editor.
13 """
14
15 import sys
16
17 for arg in sys.argv:
18 if arg.startswith("--config="):
19 import Utilities
20 configDir = arg.replace("--config=", "")
21 Utilities.setConfigDir(configDir)
22 sys.argv.remove(arg)
23 break
24
25 from Utilities import Startup
26
27 def createMainWidget(argv):
28 """
29 Function to create the main widget.
30
31 @param argv list of commandline parameters (list of strings)
32 @return reference to the main widget (QWidget)
33 """
34 from IconEditor.IconEditorWindow import IconEditorWindow
35
36 try:
37 fileName = argv[1]
38 except IndexError:
39 fileName = ""
40
41 editor = IconEditorWindow(fileName, None)
42 return editor
43
44 def main():
45 """
46 Main entry point into the application.
47 """
48 options = [\
49 ("--config=configDir",
50 "use the given directory as the one containing the config files"),
51 ("", "name of file to edit")
52 ]
53 appinfo = Startup.makeAppInfo(sys.argv,
54 "Eric5 Icon Editor",
55 "",
56 "Little tool to edit icon files.",
57 options)
58 res = Startup.simpleAppStartup(sys.argv,
59 appinfo,
60 createMainWidget)
61 sys.exit(res)
62
63 if __name__ == '__main__':
64 main()

eric ide

mercurial