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