1 |
|
# |
2 |
|
# This file is part of GNU Enterprise. |
3 |
|
# |
4 |
|
# GNU Enterprise is free software; you can redistribute it |
5 |
|
# and/or modify it under the terms of the GNU General Public |
6 |
|
# License as published by the Free Software Foundation; either |
7 |
|
# version 2, or (at your option) any later version. |
8 |
|
# |
9 |
|
# GNU Enterprise is distributed in the hope that it will be |
10 |
|
# useful, but WITHOUT ANY WARRANTY; without even the implied |
11 |
|
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
12 |
|
# PURPOSE. See the GNU General Public License for more details. |
13 |
|
# |
14 |
|
# You should have received a copy of the GNU General Public |
15 |
|
# License along with program; see the file COPYING. If not, |
16 |
|
# write to the Free Software Foundation, Inc., 59 Temple Place |
17 |
|
# - Suite 330, Boston, MA 02111-1307, USA. |
18 |
|
# |
19 |
|
# Copyright 2000-2003 Free Software Foundation |
20 |
|
# |
21 |
|
# FILE: |
22 |
|
# uidriver/wx/common.py |
23 |
|
# |
24 |
|
# DESCRIPTION: |
25 |
|
# Common Font and Event Handler routines |
26 |
|
# Part of a wxPython based user interface driver for GNUe forms. |
27 |
|
# |
28 |
|
# NOTES: |
29 |
|
|
30 |
import string |
import string |
31 |
from wxPython.wx import * |
from wxPython.wx import * |
32 |
from gnue.common import events |
from gnue.common import events |
33 |
|
from gnue.common.apps import GDebug |
34 |
|
|
35 |
# Finishing creation of dictionary for language font encodings |
# Finishing creation of dictionary for language font encodings |
36 |
encodings = { |
encodings = { |
53 |
'koi8-r': wxFONTENCODING_KOI8, |
'koi8-r': wxFONTENCODING_KOI8, |
54 |
'cp1250': wxFONTENCODING_CP1250, |
'cp1250': wxFONTENCODING_CP1250, |
55 |
'cp1251': wxFONTENCODING_CP1251, |
'cp1251': wxFONTENCODING_CP1251, |
56 |
'cp1252': wxFONTENCODING_CP1252 |
'cp1252': wxFONTENCODING_CP1252, |
57 |
|
'big5': wxFONTENCODING_BIG5, |
58 |
|
'gb2312': wxFONTENCODING_GB2312 |
59 |
} |
} |
60 |
|
|
61 |
|
|
82 |
|
|
83 |
def initFont(widget, affectsLayout=1): |
def initFont(widget, affectsLayout=1): |
84 |
if int(gConfigForms('fixedWidthFont')): |
if int(gConfigForms('fixedWidthFont')): |
85 |
|
try: |
86 |
|
enc=encodings[gConfigForms('textEncoding')] |
87 |
|
except: |
88 |
|
GDebug.printMesg(1,_('Encoding %s is not supported by the wx UI driver') %\ |
89 |
|
gConfigForms('textEncoding')) |
90 |
|
enc=encodings['iso8859-1'] |
91 |
widget.SetFont(wxFont(getPointSize(),wxMODERN,wxNORMAL,\ |
widget.SetFont(wxFont(getPointSize(),wxMODERN,wxNORMAL,\ |
92 |
wxNORMAL,FALSE,'',encodings[gConfigForms('textEncoding')])) |
wxNORMAL,FALSE,'',enc)) |
93 |
|
|
94 |
|
|
95 |
##################################################################### |
##################################################################### |