controls can be configured ("File">"Preferences..."). Implemented comment object for including simple one-line comments and comment directives as tree nodes. No validation is performed for a valid XML string so comments must not contain "-->". Comment directive is a special comment starting with '%' character, followed by a line of python code. It is executed using 'exec' when the resource file is opened. This is useful to import plugin modules containing custom handlers which are specific to the resource file, hovewer this is of course a security hole if you use foreign XRC files. A warning is displayed if the preference option 'ask' is selected (by default). Added support for custom controls and plugin modules. Refer to this wxPythonWiki for the details: http://wiki.wxpython.org/index.cgi/XRCed#custom Tool panel sections can be collapsed/expanded by clicking on the label of a tool group. Some undo/redo and other fixes. Fixes for wxMSW (notebook highlighting, control sizes, tree Unselect). Notebook page highlighting fix. Highlight resizes when the window is resized. ParamUnit spin button detects event handler re-entry (wxGTK probably has a bug in wxSpinButton with repeated events). Fix for dealing with empty 'growable' property, using MiniFrame for properties panel, the panel is restored together with the main window. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@44949 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
74 lines
2.1 KiB
Python
74 lines
2.1 KiB
Python
# Name: globals.py
|
|
# Purpose: XRC editor, global variables
|
|
# Author: Roman Rolinsky <rolinsky@mema.ucl.ac.be>
|
|
# Created: 02.12.2002
|
|
# RCS-ID: $Id$
|
|
|
|
import wx
|
|
import wx.xrc as xrc
|
|
try:
|
|
import wx.wizard
|
|
except:
|
|
pass
|
|
import sys
|
|
|
|
# Global constants
|
|
|
|
progname = 'XRCed'
|
|
version = '0.1.8-5'
|
|
# Minimal wxWidgets version
|
|
MinWxVersion = (2,6,0)
|
|
if wx.VERSION[:3] < MinWxVersion:
|
|
print '''\
|
|
******************************* WARNING **************************************
|
|
This version of XRCed may not work correctly on your version of wxWidgets.
|
|
Please upgrade wxWidgets to %d.%d.%d or higher.
|
|
******************************************************************************''' % MinWxVersion
|
|
|
|
# Can be changed to set other default encoding different
|
|
#defaultEncoding = ''
|
|
# you comment above and can uncomment this:
|
|
defaultEncoding = wx.GetDefaultPyEncoding()
|
|
|
|
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
|
|
testWinPos = wx.DefaultPosition
|
|
currentXXX = None
|
|
currentEncoding = defaultEncoding
|
|
conf = None
|
|
|
|
def _makeFonts(self):
|
|
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)
|
|
|
|
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
|
|
|
|
|
|
g = Globals()
|