eric4-iconeditor.py

changeset 0
de9c2efb9d02
child 7
c679fb30c8f3
equal deleted inserted replaced
-1:000000000000 0:de9c2efb9d02
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 # Copyright (c) 2009 Detlev Offenbach <detlev@die-offenbachs.de>
5 #
6
7 """
8 Eric4 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 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 import Utilities
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 IconEditor.IconEditorWindow import IconEditorWindow
40
41 try:
42 fileName = argv[1]
43 except IndexError:
44 fileName = ""
45
46 editor = IconEditorWindow(fileName, None)
47 return editor
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 ("", "name of file to edit")
57 ]
58 appinfo = Startup.makeAppInfo(sys.argv,
59 "Eric4 Icon Editor",
60 "",
61 "Little tool to edit icon files.",
62 options)
63 res = Startup.simpleAppStartup(sys.argv,
64 appinfo,
65 createMainWidget)
66 sys.exit(res)
67
68 if __name__ == '__main__':
69 main()

eric ide

mercurial