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 print(sys.argv) |
|
28 for arg in sys.argv[:]: |
27 if arg.startswith("--config="): |
29 if arg.startswith("--config="): |
28 import Globals |
30 import Globals |
29 configDir = arg.replace("--config=", "") |
31 configDir = arg.replace("--config=", "") |
30 Globals.setConfigDir(configDir) |
32 Globals.setConfigDir(configDir) |
31 sys.argv.remove(arg) |
33 sys.argv.remove(arg) |
32 break |
34 elif arg.startswith("--settings="): |
|
35 from PyQt5.QtCore import QSettings |
|
36 settingsDir = os.path.expanduser(arg.replace("--settings=", "")) |
|
37 if not os.path.isdir(settingsDir): |
|
38 os.makedirs(settingsDir) |
|
39 QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, |
|
40 settingsDir) |
|
41 sys.argv.remove(arg) |
|
42 print(sys.argv) |
33 |
43 |
34 from Globals import AppInfo |
44 from Globals import AppInfo |
35 |
45 |
36 from Toolbox import Startup |
46 from Toolbox import Startup |
37 |
47 |
59 Main entry point into the application. |
69 Main entry point into the application. |
60 """ |
70 """ |
61 options = [ |
71 options = [ |
62 ("--config=configDir", |
72 ("--config=configDir", |
63 "use the given directory as the one containing the config files"), |
73 "use the given directory as the one containing the config files"), |
|
74 ("--settings=settingsDir", |
|
75 "use the given directory to store the settings files"), |
64 ("", "name of file to edit") |
76 ("", "name of file to edit") |
65 ] |
77 ] |
66 appinfo = AppInfo.makeAppInfo(sys.argv, |
78 appinfo = AppInfo.makeAppInfo(sys.argv, |
67 "Eric6 Icon Editor", |
79 "Eric6 Icon Editor", |
68 "", |
80 "", |