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.PluginRepositoryDialog import PluginRepositoryWindow |
49 from PluginManager.PluginRepositoryDialog import PluginRepositoryWindow |
|
50 |
47 return PluginRepositoryWindow(None) |
51 return PluginRepositoryWindow(None) |
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_pluginrepository.desktop") |
60 QGuiApplication.setDesktopFileName("eric7_pluginrepository.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 ), |
|
67 ( |
|
68 "--settings=settingsDir", |
|
69 "use the given directory to store the settings files", |
|
70 ), |
62 ] |
71 ] |
63 appinfo = AppInfo.makeAppInfo(sys.argv, |
72 appinfo = AppInfo.makeAppInfo( |
64 "eric Plugin Repository", |
73 sys.argv, |
65 "", |
74 "eric Plugin Repository", |
66 "Utility to show the contents of the eric" |
75 "", |
67 " Plugin repository.", |
76 "Utility to show the contents of the eric" " Plugin repository.", |
68 options) |
77 options, |
69 res = Startup.simpleAppStartup(sys.argv, |
78 ) |
70 appinfo, |
79 res = Startup.simpleAppStartup(sys.argv, appinfo, createMainWidget) |
71 createMainWidget) |
|
72 sys.exit(res) |
80 sys.exit(res) |
73 |
81 |
74 if __name__ == '__main__': |
82 |
|
83 if __name__ == "__main__": |
75 main() |
84 main() |