Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 import sys, os | 2 import sys, os |
3 try: | 3 try: |
4 DIR = os.path.abspath(os.path.normpath(os.path.join(__file__, | 4 DIR = os.path.abspath(os.path.normpath(os.path.join(__file__, |
5 '..', '..', 'tryton'))) | 5 '..', '..', 'tryton'))) |
6 if os.path.isdir(DIR): | 6 if os.path.isdir(DIR): |
7 sys.path.insert(0, os.path.dirname(DIR)) | 7 sys.path.insert(0, os.path.dirname(DIR)) |
8 except: | 8 except: |
9 pass | 9 pass |
10 | 10 |
11 # True only if running as a py2exe app | 11 # True only if running as a py2exe app |
12 if os.name == 'nt' and hasattr(sys,"frozen"):·· | 12 if os.name == 'nt' and hasattr(sys, "frozen"): |
ced1
2009/11/05 19:43:46
missing space after comma
timitos
2009/11/05 20:08:17
solved in patchset 3
| |
13 if not os.path.isdir(os.path.join(os.environ['APPDATA'],"Tryton")): | 13 sys.stdout = open(os.devnull, 'w') |
ced1
2009/11/05 19:43:46
Is APPDATA always set on windows?
Why not use the
timitos
2009/11/05 20:08:17
because the directory of the config file is not th
timitos
2009/11/05 20:14:59
I found a better reference for APPDATA Topic:
http
| |
14 os.makedirs(os.path.join(os.environ['APPDATA'],"Tryton")) | 14 sys.stderr = open(os.devnull, 'w') |
15 sys.stdout = open(os.path.join(os.environ['APPDATA'],"Tryton", | |
16 "tryton_stdout.log"), "a") | |
17 sys.stderr = open(os.path.join(os.environ['APPDATA'],"Tryton", | |
18 "tryton_stderr.log"), "a") | |
19 | 15 |
20 if os.name == 'mac' or \ | 16 if os.name == 'mac' or \ |
21 (hasattr(os, 'uname') and os.uname()[0] == 'Darwin'): | 17 (hasattr(os, 'uname') and os.uname()[0] == 'Darwin'): |
22 resources = os.path.join(os.path.dirname(sys.argv[0]), '..', 'Resources') | 18 resources = os.path.join(os.path.dirname(sys.argv[0]), '..', 'Resources') |
23 gtkrc = os.path.join(resources, 'gtkrc') | 19 gtkrc = os.path.join(resources, 'gtkrc') |
24 pixbuf_loader = os.path.join(resources, 'gdk-pixbuf.loaders') | 20 pixbuf_loader = os.path.join(resources, 'gdk-pixbuf.loaders') |
25 pangorc = os.path.join(resources, 'pangorc') | 21 pangorc = os.path.join(resources, 'pangorc') |
26 if os.path.isdir(resources): | 22 if os.path.isdir(resources): |
27 os.environ['GTK2_RC_FILES'] = gtkrc | 23 os.environ['GTK2_RC_FILES'] = gtkrc |
28 os.environ['GTK_EXE_PREFIX'] = resources | 24 os.environ['GTK_EXE_PREFIX'] = resources |
29 os.environ['GTK_DATA_PREFIX'] = resources | 25 os.environ['GTK_DATA_PREFIX'] = resources |
30 os.environ['GDK_PIXBUF_MODULE_FILE'] = pixbuf_loader | 26 os.environ['GDK_PIXBUF_MODULE_FILE'] = pixbuf_loader |
31 os.environ['PANGO_RC_FILE'] = pangorc | 27 os.environ['PANGO_RC_FILE'] = pangorc |
32 | 28 |
33 import tryton.client | 29 import tryton.client |
34 tryton.client.TrytonClient().run() | 30 tryton.client.TrytonClient().run() |
LEFT | RIGHT |