]> git.saurik.com Git - wxWidgets.git/blob - wxPython/wx/tools/XRCed/globals.py
drop highlight color fix
[wxWidgets.git] / wxPython / wx / tools / XRCed / globals.py
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 import wx.xrc as xrc
9 try:
10 import wx.wizard
11 except:
12 pass
13 import sys
14
15 # Global constants
16
17 progname = 'XRCed'
18 version = '0.1.8-5'
19 # Minimal wxWidgets version
20 MinWxVersion = (2,6,0)
21 if wx.VERSION[:3] < MinWxVersion:
22 print '''\
23 ******************************* WARNING **************************************
24 This version of XRCed may not work correctly on your version of wxWidgets.
25 Please upgrade wxWidgets to %d.%d.%d or higher.
26 ******************************************************************************''' % MinWxVersion
27
28 # Can be changed to set other default encoding different
29 #defaultEncoding = ''
30 # you comment above and can uncomment this:
31 defaultEncoding = wx.GetDefaultPyEncoding()
32
33 try:
34 True
35 except NameError:
36 True = 1==1
37 False = 1==0
38
39 # Global variables
40
41 class Globals:
42 panel = None
43 tree = None
44 frame = None
45 tools = None
46 undoMan = None
47 testWin = None
48 testWinPos = wx.DefaultPosition
49 currentXXX = None
50 currentEncoding = defaultEncoding
51 conf = None
52
53 def _makeFonts(self):
54 self._sysFont = wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT)
55 self._labelFont = wx.Font(self._sysFont.GetPointSize(), wx.DEFAULT, wx.NORMAL, wx.BOLD)
56 self._modernFont = wx.Font(self._sysFont.GetPointSize(), wx.MODERN, wx.NORMAL, wx.NORMAL)
57 self._smallerFont = wx.Font(self._sysFont.GetPointSize()-2, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
58
59 def sysFont(self):
60 if not hasattr(self, "_sysFont"): self._makeFonts()
61 return self._sysFont
62 def labelFont(self):
63 if not hasattr(self, "_labelFont"): self._makeFonts()
64 return self._labelFont
65 def modernFont(self):
66 if not hasattr(self, "_modernFont"): self._makeFonts()
67 return self._modernFont
68 def smallerFont(self):
69 if not hasattr(self, "_smallerFont"): self._makeFonts()
70 return self._smallerFont
71
72
73 g = Globals()
74
75
76 class MyDataObject(wx.PyDataObjectSimple):
77 def __init__(self):
78 wx.PyDataObjectSimple.__init__(self, wx.CustomDataFormat('XRCed_DND'))
79 self.data = ''
80 def GetDataSize(self):
81 return len(self.data)
82 def GetDataHere(self):
83 return self.data # returns a string
84 def SetData(self, data):
85 self.data = data
86 return True