src/eric7/eric7_plugininstall.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
17 sys.path.insert(1, os.path.dirname(__file__)) 17 sys.path.insert(1, os.path.dirname(__file__))
18 18
19 for arg in sys.argv[:]: 19 for arg in sys.argv[:]:
20 if arg.startswith("--config="): 20 if arg.startswith("--config="):
21 import Globals 21 import Globals
22
22 configDir = arg.replace("--config=", "") 23 configDir = arg.replace("--config=", "")
23 Globals.setConfigDir(configDir) 24 Globals.setConfigDir(configDir)
24 sys.argv.remove(arg) 25 sys.argv.remove(arg)
25 elif arg.startswith("--settings="): 26 elif arg.startswith("--settings="):
26 from PyQt6.QtCore import QSettings 27 from PyQt6.QtCore import QSettings
28
27 settingsDir = os.path.expanduser(arg.replace("--settings=", "")) 29 settingsDir = os.path.expanduser(arg.replace("--settings=", ""))
28 if not os.path.isdir(settingsDir): 30 if not os.path.isdir(settingsDir):
29 os.makedirs(settingsDir) 31 os.makedirs(settingsDir)
30 QSettings.setPath( 32 QSettings.setPath(
31 QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) 33 QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir
34 )
32 sys.argv.remove(arg) 35 sys.argv.remove(arg)
33 36
34 from Globals import AppInfo 37 from Globals import AppInfo
35 38
36 from Toolbox import Startup 39 from Toolbox import Startup
37 40
38 41
39 def createMainWidget(argv): 42 def createMainWidget(argv):
40 """ 43 """
41 Function to create the main widget. 44 Function to create the main widget.
42 45
43 @param argv list of commandline parameters (list of strings) 46 @param argv list of commandline parameters (list of strings)
44 @return reference to the main widget (QWidget) 47 @return reference to the main widget (QWidget)
45 """ 48 """
46 from PluginManager.PluginInstallDialog import PluginInstallWindow 49 from PluginManager.PluginInstallDialog import PluginInstallWindow
50
47 return PluginInstallWindow(argv[1:]) 51 return PluginInstallWindow(argv[1:])
48 52
49 53
50 def main(): 54 def main():
51 """ 55 """
52 Main entry point into the application. 56 Main entry point into the application.
53 """ 57 """
54 from PyQt6.QtGui import QGuiApplication 58 from PyQt6.QtGui import QGuiApplication
59
55 QGuiApplication.setDesktopFileName("eric7_plugininstall.desktop") 60 QGuiApplication.setDesktopFileName("eric7_plugininstall.desktop")
56 61
57 options = [ 62 options = [
58 ("--config=configDir", 63 (
59 "use the given directory as the one containing the config files"), 64 "--config=configDir",
60 ("--settings=settingsDir", 65 "use the given directory as the one containing the config files",
61 "use the given directory to store the settings files"), 66 ),
62 ("", "names of plugins to install") 67 (
68 "--settings=settingsDir",
69 "use the given directory to store the settings files",
70 ),
71 ("", "names of plugins to install"),
63 ] 72 ]
64 appinfo = AppInfo.makeAppInfo(sys.argv, 73 appinfo = AppInfo.makeAppInfo(
65 "eric Plugin Installer", 74 sys.argv,
66 "", 75 "eric Plugin Installer",
67 "Plugin installation utility for eric", 76 "",
68 options) 77 "Plugin installation utility for eric",
69 res = Startup.simpleAppStartup(sys.argv, 78 options,
70 appinfo, 79 )
71 createMainWidget) 80 res = Startup.simpleAppStartup(sys.argv, appinfo, createMainWidget)
72 sys.exit(res) 81 sys.exit(res)
73 82
74 if __name__ == '__main__': 83
84 if __name__ == "__main__":
75 main() 85 main()

eric ide

mercurial