|
1 #!/usr/bin/env python3 |
|
2 # -*- coding: utf-8 -*- |
|
3 |
|
4 # Copyright (c) 2006 - 2014 Detlev Offenbach <detlev@die-offenbachs.de> |
|
5 # |
|
6 |
|
7 """ |
|
8 Eric5 Configure. |
|
9 |
|
10 This is the main Python script to configure the eric5 IDE from the outside. |
|
11 """ |
|
12 |
|
13 from __future__ import unicode_literals |
|
14 try: # Only for Py2 |
|
15 import Utilities.compatibility_fixes # __IGNORE_WARNING__ |
|
16 except (ImportError): |
|
17 pass |
|
18 |
|
19 import sys |
|
20 import os |
|
21 |
|
22 for arg in sys.argv: |
|
23 if arg.startswith("--config="): |
|
24 import Globals |
|
25 configDir = arg.replace("--config=", "") |
|
26 Globals.setConfigDir(configDir) |
|
27 sys.argv.remove(arg) |
|
28 break |
|
29 |
|
30 # make ThirdParty package available as a packages repository |
|
31 sys.path.insert(2, os.path.join(os.path.dirname(__file__), |
|
32 "ThirdParty", "Pygments")) |
|
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 Preferences.ConfigurationDialog import ConfigurationWindow |
|
47 w = ConfigurationWindow() |
|
48 w.show() |
|
49 w.showConfigurationPageByName("empty") |
|
50 return w |
|
51 |
|
52 |
|
53 def main(): |
|
54 """ |
|
55 Main entry point into the application. |
|
56 """ |
|
57 options = [ |
|
58 ("--config=configDir", |
|
59 "use the given directory as the one containing the config files"), |
|
60 ] |
|
61 appinfo = AppInfo.makeAppInfo(sys.argv, |
|
62 "Eric5 Configure", |
|
63 "", |
|
64 "Configuration editor for eric5", |
|
65 options) |
|
66 res = Startup.simpleAppStartup(sys.argv, |
|
67 appinfo, |
|
68 createMainWidget) |
|
69 sys.exit(res) |
|
70 |
|
71 if __name__ == '__main__': |
|
72 main() |