eric5-iconeditor.py

changeset 15
f6ccc31d6e72
child 18
3b1f5d872fd7
equal deleted inserted replaced
14:092aa8fafa4e 15:f6ccc31d6e72
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3
4 # Copyright (c) 2009 - 2010 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 for arg in sys.argv:
19 if arg.startswith("--config="):
20 import Utilities
21 configDir = arg.replace("--config=", "")
22 Utilities.setConfigDir(configDir)
23 sys.argv.remove(arg)
24 break
25
26 from Utilities import Startup
27 import Utilities
28
29 def createMainWidget(argv):
30 """
31 Function to create the main widget.
32
33 @param argv list of commandline parameters (list of strings)
34 @return reference to the main widget (QWidget)
35 """
36 from IconEditor.IconEditorWindow import IconEditorWindow
37
38 try:
39 fileName = argv[1]
40 except IndexError:
41 fileName = ""
42
43 editor = IconEditorWindow(fileName, None)
44 return editor
45
46 def main():
47 """
48 Main entry point into the application.
49 """
50 options = [\
51 ("--config=configDir",
52 "use the given directory as the one containing the config files"),
53 ("", "name of file to edit")
54 ]
55 appinfo = Startup.makeAppInfo(sys.argv,
56 "Eric4 Icon Editor",
57 "",
58 "Little tool to edit icon files.",
59 options)
60 res = Startup.simpleAppStartup(sys.argv,
61 appinfo,
62 createMainWidget)
63 sys.exit(res)
64
65 if __name__ == '__main__':
66 main()

eric ide

mercurial