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

eric ide

mercurial