|
1 #!/usr/bin/env python3 |
|
2 # -*- coding: utf-8 -*- |
|
3 |
|
4 # Copyright (c) 2006 - 2011 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 import sys |
|
14 import os |
|
15 |
|
16 for arg in sys.argv: |
|
17 if arg.startswith("--config="): |
|
18 import Utilities |
|
19 configDir = arg.replace("--config=", "") |
|
20 Utilities.setConfigDir(configDir) |
|
21 sys.argv.remove(arg) |
|
22 break |
|
23 |
|
24 # make ThirdParty package available as a packages repository |
|
25 try: |
|
26 import pygments # __IGNORE_WARNING__ |
|
27 except ImportError: |
|
28 sys.path.insert(2, os.path.join(os.path.dirname(__file__), "ThirdParty", "Pygments")) |
|
29 |
|
30 from Utilities import Startup |
|
31 |
|
32 def createMainWidget(argv): |
|
33 """ |
|
34 Function to create the main widget. |
|
35 |
|
36 @param argv list of commandline parameters (list of strings) |
|
37 @return reference to the main widget (QWidget) |
|
38 """ |
|
39 from Preferences.ConfigurationDialog import ConfigurationWindow |
|
40 w = ConfigurationWindow() |
|
41 w.show() |
|
42 w.showConfigurationPageByName("empty") |
|
43 return w |
|
44 |
|
45 def main(): |
|
46 """ |
|
47 Main entry point into the application. |
|
48 """ |
|
49 options = [\ |
|
50 ("--config=configDir", |
|
51 "use the given directory as the one containing the config files"), |
|
52 ] |
|
53 appinfo = Startup.makeAppInfo(sys.argv, |
|
54 "Eric5 Configure", |
|
55 "", |
|
56 "Configuration editor for eric5", |
|
57 options) |
|
58 res = Startup.simpleAppStartup(sys.argv, |
|
59 appinfo, |
|
60 createMainWidget) |
|
61 sys.exit(res) |
|
62 |
|
63 if __name__ == '__main__': |
|
64 main() |