]>
Commit | Line | Data |
---|---|---|
1 | # Name: globals.py | |
2 | # Purpose: XRC editor, global variables | |
3 | # Author: Roman Rolinsky <rolinsky@mema.ucl.ac.be> | |
4 | # Created: 02.12.2002 | |
5 | # RCS-ID: $Id$ | |
6 | ||
7 | import wx | |
8 | from wxPython.wx import * | |
9 | from wxPython.xrc import * | |
10 | try: | |
11 | from wxPython.wizard import * | |
12 | except: | |
13 | pass | |
14 | import sys | |
15 | ||
16 | # Global constants | |
17 | ||
18 | progname = 'XRCed' | |
19 | version = '0.1.5-2' | |
20 | # Can be changed to set other default encoding different | |
21 | #defaultEncoding = sys.getdefaultencoding() | |
22 | defaultEncoding = wx.GetDefaultPyEncoding() | |
23 | ||
24 | try: | |
25 | True | |
26 | except NameError: | |
27 | True = 1==1 | |
28 | False = 1==0 | |
29 | ||
30 | # Global variables | |
31 | ||
32 | class Globals: | |
33 | panel = None | |
34 | tree = None | |
35 | frame = None | |
36 | tools = None | |
37 | undoMan = None | |
38 | testWin = None | |
39 | testWinPos = wxDefaultPosition | |
40 | currentXXX = None | |
41 | currentEncoding = defaultEncoding | |
42 | ||
43 | def _makeFonts(self): | |
44 | self._sysFont = wxSystemSettings_GetFont(wxSYS_SYSTEM_FONT) | |
45 | self._labelFont = wxFont(self._sysFont.GetPointSize(), wxDEFAULT, wxNORMAL, wxBOLD) | |
46 | self._modernFont = wxFont(self._sysFont.GetPointSize(), wxMODERN, wxNORMAL, wxNORMAL) | |
47 | self._smallerFont = wxFont(self._sysFont.GetPointSize()-2, wxDEFAULT, wxNORMAL, wxNORMAL) | |
48 | ||
49 | def sysFont(self): | |
50 | if not hasattr(self, "_sysFont"): self._makeFonts() | |
51 | return self._sysFont | |
52 | def labelFont(self): | |
53 | if not hasattr(self, "_labelFont"): self._makeFonts() | |
54 | return self._labelFont | |
55 | def modernFont(self): | |
56 | if not hasattr(self, "_modernFont"): self._makeFonts() | |
57 | return self._modernFont | |
58 | def smallerFont(self): | |
59 | if not hasattr(self, "_smallerFont"): self._makeFonts() | |
60 | return self._smallerFont | |
61 | ||
62 | ||
63 | g = Globals() |