15 from __future__ import unicode_literals |
15 from __future__ import unicode_literals |
16 |
16 |
17 import Toolbox.PyQt4ImportHook # __IGNORE_WARNING__ |
17 import Toolbox.PyQt4ImportHook # __IGNORE_WARNING__ |
18 |
18 |
19 try: # Only for Py2 |
19 try: # Only for Py2 |
20 import Utilities.compatibility_fixes # __IGNORE_WARNING__ |
20 import Globals.compatibility_fixes # __IGNORE_WARNING__ |
21 except (ImportError): |
21 except (ImportError): |
22 pass |
22 pass |
23 |
23 |
24 import sys |
24 import sys |
|
25 import os |
25 |
26 |
26 for arg in sys.argv: |
27 for arg in sys.argv[:]: |
27 if arg.startswith("--config="): |
28 if arg.startswith("--config="): |
28 import Globals |
29 import Globals |
29 configDir = arg.replace("--config=", "") |
30 configDir = arg.replace("--config=", "") |
30 Globals.setConfigDir(configDir) |
31 Globals.setConfigDir(configDir) |
31 sys.argv.remove(arg) |
32 sys.argv.remove(arg) |
32 break |
33 elif arg.startswith("--settings="): |
|
34 from PyQt5.QtCore import QSettings |
|
35 settingsDir = os.path.expanduser(arg.replace("--settings=", "")) |
|
36 if not os.path.isdir(settingsDir): |
|
37 os.makedirs(settingsDir) |
|
38 QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, |
|
39 settingsDir) |
|
40 sys.argv.remove(arg) |
33 |
41 |
34 from Globals import AppInfo |
42 from Globals import AppInfo |
35 |
43 |
36 from Toolbox import Startup |
44 from Toolbox import Startup |
37 |
45 |
53 Main entry point into the application. |
61 Main entry point into the application. |
54 """ |
62 """ |
55 options = [ |
63 options = [ |
56 ("--config=configDir", |
64 ("--config=configDir", |
57 "use the given directory as the one containing the config files"), |
65 "use the given directory as the one containing the config files"), |
|
66 ("--settings=settingsDir", |
|
67 "use the given directory to store the settings files"), |
58 ] |
68 ] |
59 appinfo = AppInfo.makeAppInfo(sys.argv, |
69 appinfo = AppInfo.makeAppInfo(sys.argv, |
60 "Eric6 QRegExp", |
70 "Eric6 QRegExp", |
61 "", |
71 "", |
62 "Regexp editor for Qt's QRegExp class", |
72 "Regexp editor for Qt's QRegExp class", |