1 |
bh |
230 |
# Copyright (c) 2001, 2002 by Intevation GmbH |
2 |
bh |
6 |
# Authors: |
3 |
|
|
# Bernhard Herzog <[email protected]> |
4 |
|
|
# |
5 |
|
|
# This program is free software under the GPL (>=v2) |
6 |
|
|
# Read the file COPYING coming with Thuban for details. |
7 |
bh |
230 |
|
8 |
|
|
|
9 |
|
|
# Work-around for a locale related bug in wxPython (which is fixed in |
10 |
|
|
# 2.3) |
11 |
|
|
# |
12 |
|
|
# we can probably safely assume that any program that imports the |
13 |
|
|
# Thuban.UI module will use wxPython, so we put the fix here. |
14 |
|
|
# |
15 |
|
|
# Import wxPython.wx here to get the side effects of the wxPython |
16 |
|
|
# import, especially setting the locale to the user's defaults throught |
17 |
|
|
# GTK. We then set the locale again to the user's defaults, but this |
18 |
|
|
# time we're going through the standard python locale module, so all the |
19 |
|
|
# magic necessary to make python work properly is done. Without this, |
20 |
|
|
# something harmless like float("1.2") may fail when run under a non-C |
21 |
|
|
# locale like de_DE |
22 |
|
|
import wxPython.wx |
23 |
|
|
del wxPython |
24 |
|
|
try: |
25 |
|
|
import locale |
26 |
|
|
locale.setlocale(locale.LC_ALL, "") |
27 |
|
|
del locale |
28 |
|
|
except ImportError: |
29 |
|
|
# the locale module may not be available on some systems |
30 |
|
|
pass |
31 |
|
|
|