2003-11-12 16:34:20 -05:00
|
|
|
# Name: globals.py
|
|
|
|
# Purpose: XRC editor, global variables
|
|
|
|
# Author: Roman Rolinsky <rolinsky@mema.ucl.ac.be>
|
|
|
|
# Created: 02.12.2002
|
|
|
|
# RCS-ID: $Id$
|
2003-07-02 19:13:10 -04:00
|
|
|
|
2006-05-16 23:57:57 -04:00
|
|
|
import wx
|
|
|
|
import wx.xrc as xrc
|
2005-04-26 14:49:44 -04:00
|
|
|
try:
|
2006-05-16 23:57:57 -04:00
|
|
|
import wx.wizard
|
2005-04-26 14:49:44 -04:00
|
|
|
except:
|
|
|
|
pass
|
2003-11-12 16:34:20 -05:00
|
|
|
import sys
|
2003-07-02 19:13:10 -04:00
|
|
|
|
2003-11-12 16:34:20 -05:00
|
|
|
# Global constants
|
|
|
|
|
|
|
|
progname = 'XRCed'
|
2006-06-05 12:04:37 -04:00
|
|
|
version = '0.1.7-5'
|
2006-05-16 23:57:57 -04:00
|
|
|
# Minimal wxWidgets version
|
2005-11-10 19:23:31 -05:00
|
|
|
MinWxVersion = (2,6,0)
|
2006-05-16 23:57:57 -04:00
|
|
|
if wx.VERSION[:3] < MinWxVersion:
|
2005-11-10 19:23:31 -05:00
|
|
|
print '''\
|
|
|
|
******************************* WARNING **************************************
|
2006-04-08 02:17:11 -04:00
|
|
|
This version of XRCed may not work correctly on your version of wxWidgets.
|
2006-05-16 23:57:57 -04:00
|
|
|
Please upgrade wxWidgets to %d.%d.%d or higher.
|
2005-11-10 19:23:31 -05:00
|
|
|
******************************************************************************''' % MinWxVersion
|
|
|
|
|
2004-10-10 20:00:31 -04:00
|
|
|
# Can be changed to set other default encoding different
|
2005-06-14 18:59:21 -04:00
|
|
|
#defaultEncoding = ''
|
2005-05-25 21:10:05 -04:00
|
|
|
# you comment above and can uncomment this:
|
2006-05-16 23:57:57 -04:00
|
|
|
defaultEncoding = wx.GetDefaultPyEncoding()
|
2003-11-12 16:34:20 -05:00
|
|
|
|
|
|
|
try:
|
|
|
|
True
|
|
|
|
except NameError:
|
|
|
|
True = 1==1
|
|
|
|
False = 1==0
|
|
|
|
|
|
|
|
# Global variables
|
|
|
|
|
|
|
|
class Globals:
|
|
|
|
panel = None
|
|
|
|
tree = None
|
|
|
|
frame = None
|
|
|
|
tools = None
|
|
|
|
undoMan = None
|
|
|
|
testWin = None
|
2006-05-16 23:57:57 -04:00
|
|
|
testWinPos = wx.DefaultPosition
|
2003-11-12 16:34:20 -05:00
|
|
|
currentXXX = None
|
2004-10-10 20:00:31 -04:00
|
|
|
currentEncoding = defaultEncoding
|
2003-11-12 16:34:20 -05:00
|
|
|
|
2004-01-17 22:05:02 -05:00
|
|
|
def _makeFonts(self):
|
2006-05-16 23:57:57 -04:00
|
|
|
self._sysFont = wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT)
|
|
|
|
self._labelFont = wx.Font(self._sysFont.GetPointSize(), wx.DEFAULT, wx.NORMAL, wx.BOLD)
|
|
|
|
self._modernFont = wx.Font(self._sysFont.GetPointSize(), wx.MODERN, wx.NORMAL, wx.NORMAL)
|
|
|
|
self._smallerFont = wx.Font(self._sysFont.GetPointSize()-2, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
|
2004-01-17 22:05:02 -05:00
|
|
|
|
|
|
|
def sysFont(self):
|
|
|
|
if not hasattr(self, "_sysFont"): self._makeFonts()
|
|
|
|
return self._sysFont
|
|
|
|
def labelFont(self):
|
|
|
|
if not hasattr(self, "_labelFont"): self._makeFonts()
|
|
|
|
return self._labelFont
|
|
|
|
def modernFont(self):
|
|
|
|
if not hasattr(self, "_modernFont"): self._makeFonts()
|
|
|
|
return self._modernFont
|
|
|
|
def smallerFont(self):
|
|
|
|
if not hasattr(self, "_smallerFont"): self._makeFonts()
|
|
|
|
return self._smallerFont
|
|
|
|
|
|
|
|
|
2003-11-12 16:34:20 -05:00
|
|
|
g = Globals()
|