eric4-tray.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) 2006 - 2009 Detlev Offenbach <detlev@die-offenbachs.de>
5 #
6
7 """
8 Eric4 Tray
9
10 This is the main Python script that performs the necessary initialization
11 of the system-tray application. This acts as a quickstarter by providing a
12 context menu to start the eric4 IDE and the eric4 tools.
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
31 def createMainWidget(argv):
32 """
33 Function to create the main widget.
34
35 @param argv list of commandline parameters (list of strings)
36 @return reference to the main widget (QWidget)
37 """
38 from Tools.TrayStarter import TrayStarter
39 return TrayStarter()
40
41 def main():
42 """
43 Main entry point into the application.
44 """
45 options = [\
46 ("--config=configDir",
47 "use the given directory as the one containing the config files"),
48 ]
49 appinfo = Startup.makeAppInfo(sys.argv,
50 "Eric4 Tray",
51 "",
52 "Traystarter for eric4",
53 options)
54 res = Startup.simpleAppStartup(sys.argv,
55 appinfo,
56 createMainWidget,
57 quitOnLastWindowClosed = False)
58 sys.exit(res)
59
60 if __name__ == '__main__':
61 main()

eric ide

mercurial