16 sys.path.insert(1, os.path.dirname(__file__)) |
16 sys.path.insert(1, os.path.dirname(__file__)) |
17 |
17 |
18 for arg in sys.argv[:]: |
18 for arg in sys.argv[:]: |
19 if arg.startswith("--config="): |
19 if arg.startswith("--config="): |
20 import Globals |
20 import Globals |
|
21 |
21 configDir = arg.replace("--config=", "") |
22 configDir = arg.replace("--config=", "") |
22 Globals.setConfigDir(configDir) |
23 Globals.setConfigDir(configDir) |
23 sys.argv.remove(arg) |
24 sys.argv.remove(arg) |
24 elif arg.startswith("--settings="): |
25 elif arg.startswith("--settings="): |
25 from PyQt6.QtCore import QSettings |
26 from PyQt6.QtCore import QSettings |
|
27 |
26 settingsDir = os.path.expanduser(arg.replace("--settings=", "")) |
28 settingsDir = os.path.expanduser(arg.replace("--settings=", "")) |
27 if not os.path.isdir(settingsDir): |
29 if not os.path.isdir(settingsDir): |
28 os.makedirs(settingsDir) |
30 os.makedirs(settingsDir) |
29 QSettings.setPath( |
31 QSettings.setPath( |
30 QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) |
32 QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir |
|
33 ) |
31 sys.argv.remove(arg) |
34 sys.argv.remove(arg) |
32 |
35 |
33 from Globals import AppInfo |
36 from Globals import AppInfo |
34 |
37 |
35 from Toolbox import Startup |
38 from Toolbox import Startup |
36 |
39 |
37 |
40 |
38 def createMainWidget(argv): |
41 def createMainWidget(argv): |
39 """ |
42 """ |
40 Function to create the main widget. |
43 Function to create the main widget. |
41 |
44 |
42 @param argv list of commandline parameters (list of strings) |
45 @param argv list of commandline parameters (list of strings) |
43 @return reference to the main widget (QWidget) |
46 @return reference to the main widget (QWidget) |
44 """ |
47 """ |
45 from Preferences.ConfigurationDialog import ConfigurationWindow |
48 from Preferences.ConfigurationDialog import ConfigurationWindow |
|
49 |
46 w = ConfigurationWindow() |
50 w = ConfigurationWindow() |
47 w.show() |
51 w.show() |
48 w.showConfigurationPageByName("empty") |
52 w.showConfigurationPageByName("empty") |
49 return w |
53 return w |
50 |
54 |
52 def main(): |
56 def main(): |
53 """ |
57 """ |
54 Main entry point into the application. |
58 Main entry point into the application. |
55 """ |
59 """ |
56 from PyQt6.QtGui import QGuiApplication |
60 from PyQt6.QtGui import QGuiApplication |
|
61 |
57 QGuiApplication.setDesktopFileName("eric7_configure.desktop") |
62 QGuiApplication.setDesktopFileName("eric7_configure.desktop") |
58 |
63 |
59 options = [ |
64 options = [ |
60 ("--config=configDir", |
65 ( |
61 "use the given directory as the one containing the config files"), |
66 "--config=configDir", |
62 ("--settings=settingsDir", |
67 "use the given directory as the one containing the config files", |
63 "use the given directory to store the settings files"), |
68 ), |
|
69 ( |
|
70 "--settings=settingsDir", |
|
71 "use the given directory to store the settings files", |
|
72 ), |
64 ] |
73 ] |
65 appinfo = AppInfo.makeAppInfo(sys.argv, |
74 appinfo = AppInfo.makeAppInfo( |
66 "eric Configure", |
75 sys.argv, "eric Configure", "", "Configuration editor for eric", options |
67 "", |
76 ) |
68 "Configuration editor for eric", |
77 res = Startup.simpleAppStartup(sys.argv, appinfo, createMainWidget) |
69 options) |
|
70 res = Startup.simpleAppStartup(sys.argv, |
|
71 appinfo, |
|
72 createMainWidget) |
|
73 sys.exit(res) |
78 sys.exit(res) |
74 |
79 |
75 if __name__ == '__main__': |
80 |
|
81 if __name__ == "__main__": |
76 main() |
82 main() |