|
1 #!/usr/bin/env python3 |
|
2 # -*- coding: utf-8 -*- |
|
3 |
|
4 # Copyright (c) 2006 - 2014 Detlev Offenbach <detlev@die-offenbachs.de> |
|
5 # |
|
6 |
|
7 """ |
|
8 Eric5 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 eric5 IDE and the eric5 tools. |
|
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.TrayStarter import TrayStarter |
|
44 return TrayStarter() |
|
45 |
|
46 |
|
47 def main(): |
|
48 """ |
|
49 Main entry point into the application. |
|
50 """ |
|
51 options = [ |
|
52 ("--config=configDir", |
|
53 "use the given directory as the one containing the config files"), |
|
54 ] |
|
55 appinfo = AppInfo.makeAppInfo(sys.argv, |
|
56 "Eric5 Tray", |
|
57 "", |
|
58 "Traystarter for eric5", |
|
59 options) |
|
60 res = Startup.simpleAppStartup(sys.argv, |
|
61 appinfo, |
|
62 createMainWidget, |
|
63 quitOnLastWindowClosed=False, |
|
64 raiseIt=False) |
|
65 sys.exit(res) |
|
66 |
|
67 if __name__ == '__main__': |
|
68 main() |