eric6/eric6_pluginrepository.py

changeset 6942
2602857055c5
parent 6645
ad476851d7e0
child 6949
a5255f1ba3f0
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3
4 # Copyright (c) 2007 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
5 #
6
7 """
8 Eric6 Plugin Installer.
9
10 This is the main Python script to install eric6 plugins from outside of the
11 IDE.
12 """
13
14 from __future__ import unicode_literals
15
16 import Toolbox.PyQt4ImportHook # __IGNORE_WARNING__
17
18 try: # Only for Py2
19 import Globals.compatibility_fixes # __IGNORE_WARNING__
20 except (ImportError):
21 pass
22
23 import sys
24 import os
25
26 for arg in sys.argv[:]:
27 if arg.startswith("--config="):
28 import Globals
29 configDir = arg.replace("--config=", "")
30 Globals.setConfigDir(configDir)
31 sys.argv.remove(arg)
32 elif arg.startswith("--settings="):
33 from PyQt5.QtCore import QSettings
34 settingsDir = os.path.expanduser(arg.replace("--settings=", ""))
35 if not os.path.isdir(settingsDir):
36 os.makedirs(settingsDir)
37 QSettings.setPath(QSettings.IniFormat, QSettings.UserScope,
38 settingsDir)
39 sys.argv.remove(arg)
40
41 from Globals import AppInfo
42
43 from Toolbox import Startup
44
45
46 def createMainWidget(argv):
47 """
48 Function to create the main widget.
49
50 @param argv list of commandline parameters (list of strings)
51 @return reference to the main widget (QWidget)
52 """
53 from PluginManager.PluginRepositoryDialog import PluginRepositoryWindow
54 return PluginRepositoryWindow(None)
55
56
57 def main():
58 """
59 Main entry point into the application.
60 """
61 options = [
62 ("--config=configDir",
63 "use the given directory as the one containing the config files"),
64 ("--settings=settingsDir",
65 "use the given directory to store the settings files"),
66 ]
67 appinfo = AppInfo.makeAppInfo(sys.argv,
68 "Eric6 Plugin Repository",
69 "",
70 "Utility to show the contents of the eric6"
71 " Plugin repository.",
72 options)
73 res = Startup.simpleAppStartup(sys.argv,
74 appinfo,
75 createMainWidget)
76 sys.exit(res)
77
78 if __name__ == '__main__':
79 main()

eric ide

mercurial