src/eric7/eric7_plugininstall.py

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8881
54e42bc2437a
child 9221
bf71ee032bb4
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3
4 # Copyright (c) 2007 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
5 #
6
7 """
8 eric Plugin Installer.
9
10 This is the main Python script to install eric plugins from outside of the
11 IDE.
12 """
13
14 import sys
15 import os
16
17 sys.path.insert(1, os.path.dirname(__file__))
18
19 for arg in sys.argv[:]:
20 if arg.startswith("--config="):
21 import Globals
22 configDir = arg.replace("--config=", "")
23 Globals.setConfigDir(configDir)
24 sys.argv.remove(arg)
25 elif arg.startswith("--settings="):
26 from PyQt6.QtCore import QSettings
27 settingsDir = os.path.expanduser(arg.replace("--settings=", ""))
28 if not os.path.isdir(settingsDir):
29 os.makedirs(settingsDir)
30 QSettings.setPath(
31 QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir)
32 sys.argv.remove(arg)
33
34 from Globals import AppInfo
35
36 from Toolbox import Startup
37
38
39 def createMainWidget(argv):
40 """
41 Function to create the main widget.
42
43 @param argv list of commandline parameters (list of strings)
44 @return reference to the main widget (QWidget)
45 """
46 from PluginManager.PluginInstallDialog import PluginInstallWindow
47 return PluginInstallWindow(argv[1:])
48
49
50 def main():
51 """
52 Main entry point into the application.
53 """
54 from PyQt6.QtGui import QGuiApplication
55 QGuiApplication.setDesktopFileName("eric7_plugininstall.desktop")
56
57 options = [
58 ("--config=configDir",
59 "use the given directory as the one containing the config files"),
60 ("--settings=settingsDir",
61 "use the given directory to store the settings files"),
62 ("", "names of plugins to install")
63 ]
64 appinfo = AppInfo.makeAppInfo(sys.argv,
65 "eric Plugin Installer",
66 "",
67 "Plugin installation utility for eric",
68 options)
69 res = Startup.simpleAppStartup(sys.argv,
70 appinfo,
71 createMainWidget)
72 sys.exit(res)
73
74 if __name__ == '__main__':
75 main()

eric ide

mercurial