|
1 #!/usr/bin/env python3 |
|
2 # -*- coding: utf-8 -*- |
|
3 |
|
4 # Copyright (c) 2007 - 2014 Detlev Offenbach <detlev@die-offenbachs.de> |
|
5 # |
|
6 |
|
7 """ |
|
8 Eric5 Plugin Installer. |
|
9 |
|
10 This is the main Python script to install eric5 plugins from outside of the |
|
11 IDE. |
|
12 """ |
|
13 |
|
14 from __future__ import unicode_literals |
|
15 try: # Only for Py2 |
|
16 import Utilities.compatibility_fixes # __IGNORE_WARNING__ |
|
17 except (ImportError): |
|
18 pass |
|
19 |
|
20 import sys |
|
21 |
|
22 for arg in sys.argv: |
|
23 if arg.startswith("--config="): |
|
24 import Globals |
|
25 configDir = arg.replace("--config=", "") |
|
26 Globals.setConfigDir(configDir) |
|
27 sys.argv.remove(arg) |
|
28 break |
|
29 |
|
30 from Globals import AppInfo |
|
31 |
|
32 from Toolbox import Startup |
|
33 |
|
34 |
|
35 def createMainWidget(argv): |
|
36 """ |
|
37 Function to create the main widget. |
|
38 |
|
39 @param argv list of commandline parameters (list of strings) |
|
40 @return reference to the main widget (QWidget) |
|
41 """ |
|
42 from PluginManager.PluginInstallDialog import PluginInstallWindow |
|
43 return PluginInstallWindow(argv[1:]) |
|
44 |
|
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 ("", "names of plugins to install") |
|
54 ] |
|
55 appinfo = AppInfo.makeAppInfo(sys.argv, |
|
56 "Eric5 Plugin Installer", |
|
57 "", |
|
58 "Plugin installation utility for eric5", |
|
59 options) |
|
60 res = Startup.simpleAppStartup(sys.argv, |
|
61 appinfo, |
|
62 createMainWidget) |
|
63 sys.exit(res) |
|
64 |
|
65 if __name__ == '__main__': |
|
66 main() |