+0.1.7-0
+-------
+
+Added new controls (Choicebook, Listbook, StatusBar, DatePicker), and
+completed style flags. Test window is opened for an available parent
+control if no specific view defined. Better handling of exceptions
+(highlighting does not 'stick' anymore). Tested on wxGTK 2.6.1.0.
+
0.1.6-7
-------
System requirements
-------------------
-XRCed requires wxWindows and wxPython greater or equal to 2.3.3, and
-Python 2.2 or newer (it may work with earlier version, but was not tested).
+wxPython version must be recent enough to support all features (a warning
+message is shown if not).
-wxPython must be compiled with XRC support.
+
+User requirements
+-----------------
+
+To use XRCed it is really important to be familiar with wxWindows class names
+and at least partially with XRC resource format (read
+wxWindows/doc/tech/tn0014.txt for reference).
Short manual
All properties can be edited as text, and some are supplied with special
editing controls.
+When no 'Edit' button is provided for editing a property's value, it is
+supposed to be copied verbatim to XRC file.
+
The names of the properties are exactly as in XRC file, and it's usually not
-hard to guess what they do. XML ID is the name of the window, and must be
+hard to guess what they do. "XML ID" is the name of the window, and must be
present for top-level windows (though this is not enforced by XRCed).
To display the preview window double-click a top-level object (you should
becomes highlighted, and if you change it, preview is updated when you select
another item or press Ctrl-R (refresh). To turn off automatic update, toggle
"View->Auto-refresh" or toolbar auto-refresh button (to the right of the
-refresh button).
+refresh button). If you double-click a non-window object (a button for
+example), then test view is created for a closest ancestor which is a window.
+
+
+Bugs
+----
+
+- Some combinations of parent/child windows are not valid but possible to put
+ into XML tree by using XRCed. Usually this produces a meaningful error
+ message from XRC library when test view is opened.
+
+- Be careful when replacing a non-empty container control with another class,
+ and check parameters which can be copied from the previous object but not
+ valid for the new one. Is it not possible to undo replacement yet.
+
--------------------------------------------------------------------------------
-Copyright 2001-2003 Roman Rolinsky <rollrom@xrced.sourceforge.net>
+Copyright 2001-2005 Roman Rolinsky <rollrom@xrced.sourceforge.net>
# Global constants
progname = 'XRCed'
-version = '0.1.6-7'
+version = '0.1.7-0'
+# Minimal wxWindows version
+MinWxVersion = (2,6,0)
+if wxVERSION[:3] < MinWxVersion:
+ print '''\
+******************************* WARNING **************************************
+ This version of XRCed may not work correctly on your version of wxWindows.
+ Please upgrade wxWindows to %d.%d.%d or higher.
+******************************************************************************''' % MinWxVersion
+
# Can be changed to set other default encoding different
#defaultEncoding = ''
# you comment above and can uncomment this:
self.box = wxStaticBox(self, -1, label)
self.box.SetFont(g.labelFont())
topSizer = wxStaticBoxSizer(self.box, wxVERTICAL)
- sizer = wxFlexGridSizer(len(xxx.allParams), 2, 1, 1)
+ sizer = wxFlexGridSizer(len(xxx.allParams), 2, 0, 1)
sizer.AddGrowableCol(1)
if xxx.hasName:
label = wxStaticText(self, -1, 'XML ID:', size=(LABEL_WIDTH,-1))
control = ParamText(self, 'XML_name', 200)
sizer.AddMany([ (label, 0, wxALIGN_CENTER_VERTICAL),
- (control, 0, wxALIGN_CENTER_VERTICAL | wxBOTTOM | wxGROW, 5) ])
+ (control, 0, wxALIGN_CENTER_VERTICAL | wxBOTTOM | wxGROW, 10) ])
self.controlName = control
for param in xxx.allParams:
present = xxx.params.has_key(param)
box = wxStaticBox(self, -1, label)
box.SetFont(g.labelFont())
topSizer = wxStaticBoxSizer(box, wxVERTICAL)
- sizer = wxFlexGridSizer(len(xxx.styles), 2, 1, 1)
+ sizer = wxFlexGridSizer(len(xxx.styles), 2, 0, 1)
sizer.AddGrowableCol(1)
for param in xxx.styles:
present = xxx.params.has_key(param)
from wxPython.xrc import *
genericStyles = [
- 'wxSIMPLE_BORDER', 'wxDOUBLE_BORDER', 'wxSUNKEN_BORDER',
+ 'wxSIMPLE_BORDER', 'wxSUNKEN_BORDER', 'wxDOUBLE_BORDER',
'wxRAISED_BORDER', 'wxSTATIC_BORDER', 'wxNO_BORDER',
- 'wxTRANSPARENT_WINDOW', 'wxTAB_TRAVERSAL',
- 'wxWANTS_CHARS',
- 'wxNO_FULL_REPAINT_ON_RESIZE',
- 'wxVSCROLL', 'wxHSCROLL', 'wxALWAYS_SHOW_SB',
- 'wxCLIP_CHILDREN',
- 'wxFULL_REPAINT_ON_RESIZE'
+ 'wxCLIP_CHILDREN', 'wxTRANSPARENT_WINDOW', 'wxWANTS_CHARS',
+ 'wxNO_FULL_REPAINT_ON_RESIZE', 'wxFULL_REPAINT_ON_RESIZE'
]
genericExStyles = [
# Something strange is going on with enable so we make sure...
for w in self.GetChildren():
w.Enable(value)
- wxPanel.Enable(self, value)
+ #wxPanel.Enable(self, value)
def SetModified(self):
self.modified = True
g.panel.SetModified(True)
class ParamFlag(ParamBinaryOr):
values = ['wxTOP', 'wxBOTTOM', 'wxLEFT', 'wxRIGHT', 'wxALL',
- 'wxEXPAND', 'wxGROW', 'wxSHAPED', 'wxALIGN_CENTRE', 'wxALIGN_RIGHT',
- 'wxFIXED_MINSIZE',
- 'wxALIGN_BOTTOM', 'wxALIGN_CENTRE_VERTICAL',
- 'wxALIGN_CENTRE_HORIZONTAL',
+ 'wxEXPAND', 'wxGROW', 'wxSHAPED', 'wxSTRETCH_NOT',
+ 'wxALIGN_CENTRE', 'wxALIGN_LEFT', 'wxALIGN_RIGHT',
+ 'wxALIGN_TOP', 'wxALIGN_BOTTOM',
+ 'wxALIGN_CENTRE_VERTICAL', 'wxALIGN_CENTRE_HORIZONTAL',
+ 'wxADJUST_MINSIZE', 'wxFIXED_MINSIZE'
]
equal = {'wxALIGN_CENTER': 'wxALIGN_CENTRE',
'wxALIGN_CENTER_VERTICAL': 'wxALIGN_CENTRE_VERTICAL',
- 'wxALIGN_CENTER_HORIZONTAL': 'wxALIGN_CENTRE_HORIZONTAL'}
+ 'wxALIGN_CENTER_HORIZONTAL': 'wxALIGN_CENTRE_HORIZONTAL',
+ 'wxUP': 'wxTOP', 'wxDOWN': 'wxBOTTOM', 'wxNORTH': 'wxTOP',
+ 'wxSOUTH': 'wxBOTTOM', 'wxWEST': 'wxLEFT', 'wxEAST': 'wxRIGHT'}
def __init__(self, parent, name):
ParamBinaryOr.__init__(self, parent, name)
self.ID_TEXT_CTRL = wxNewId()
self.ID_BUTTON = wxNewId()
sizer = wxBoxSizer()
- self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=(65,-1))
- sizer.Add(self.text, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5)
- self.button = wxPanel(self, self.ID_BUTTON, wxDefaultPosition, wxSize(20, 1))
- sizer.Add(self.button, 0, wxGROW | wxALIGN_CENTER_VERTICAL)
+ self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=(80,-1))
+ sizer.Add(self.text, 0, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM, 2)
+ self.button = wxPanel(self, self.ID_BUTTON, wxDefaultPosition, wxSize(20, 20))
+ sizer.Add(self.button, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 5)
self.SetAutoLayout(True)
self.SetSizer(sizer)
sizer.Fit(self)
PPanel.OnChange(self, evt)
self.textModified = True
def _defaultValue(self):
- return ['12', 'default', 'normal', 'normal', '0', '', '']
+ return [`g._sysFont.GetPointSize()`, 'default', 'normal', 'normal', '0', '', '']
def GetValue(self):
if self.textModified: # text has newer value
try:
self.value = self._defaultValue()
# Make initial font
# Default values
- size = 12
+ size = g._sysFont.GetPointSize()
family = wxDEFAULT
style = weight = wxNORMAL
underlined = 0
self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=wxSize(textWidth,-1))
if textWidth == -1: option = 1
else: option = 0
- sizer.Add(self.text, option, wxALIGN_CENTER_VERTICAL)
+ sizer.Add(self.text, option, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM, 2)
self.SetAutoLayout(True)
self.SetSizer(sizer)
sizer.Fit(self)
'fg': ParamColour, 'bg': ParamColour, 'font': ParamFont,
'enabled': ParamBool, 'focused': ParamBool, 'hidden': ParamBool,
'tooltip': ParamText, 'bitmap': ParamBitmap, 'icon': ParamBitmap,
- 'encoding': ParamEncoding
+ 'encoding': ParamEncoding, 'borders': ParamUnit
}
ID_NEW.MENU_ITEM,
ID_NEW.SEPARATOR ],
False)
- if state == STATE_STDDLGBTN:
+ elif state == STATE_STDDLGBTN:
pass # nothing can be added from toolbar
elif state == STATE_MENUBAR:
self.EnableGroup(GROUP_MENUS)
False)
self.EnableGroup(GROUP_SIZERS)
self.EnableGroup(GROUP_CONTROLS)
- # Special case for notebook (always executed)
+ # Special case for *book (always executed)
if state == STATE_ELSE:
- if xxx.__class__ == xxxNotebook:
+ if xxx.__class__ in [xxxNotebook, xxxChoicebook, xxxListbook]:
self.EnableGroup(GROUP_SIZERS, False)
else:
self.EnableGroup(GROUP_SIZERS)
TOOL = wxNewId()
MENU_BAR = wxNewId()
MENU = wxNewId()
+ STATUS_BAR = wxNewId()
STATIC_TEXT = wxNewId()
TEXT_CTRL = wxNewId()
LIST_CTRL = wxNewId()
CHECK_LIST = wxNewId()
NOTEBOOK = wxNewId()
+ CHOICEBOOK = wxNewId()
+ LISTBOOK = wxNewId()
SPLITTER_WINDOW = wxNewId()
SCROLLED_WINDOW = wxNewId()
HTML_WINDOW = wxNewId()
CALENDAR_CTRL = wxNewId()
+ DATE_CTRL = wxNewId()
GENERIC_DIR_CTRL = wxNewId()
SPIN_CTRL = wxNewId()
UNKNOWN = wxNewId()
WIZARD = wxNewId()
WIZARD_PAGE = wxNewId()
WIZARD_PAGE_SIMPLE = wxNewId()
+ BITMAP = wxNewId()
+ ICON = wxNewId()
STATUS_BAR = wxNewId()
BOX_SIZER = wxNewId()
ID_NEW.WIZARD_PAGE_SIMPLE: 'wxWizardPageSimple',
ID_NEW.TOOL_BAR: 'wxToolBar',
ID_NEW.TOOL: 'tool',
+ ID_NEW.STATUS_BAR: 'wxStatusBar',
ID_NEW.MENU_BAR: 'wxMenuBar',
ID_NEW.MENU: 'wxMenu',
ID_NEW.MENU_ITEM: 'wxMenuItem',
+ ID_NEW.BITMAP: 'wxBitmap',
+ ID_NEW.ICON: 'wxIcon',
ID_NEW.SEPARATOR: 'separator',
ID_NEW.STATIC_TEXT: 'wxStaticText',
ID_NEW.RADIO_BOX: 'wxRadioBox',
ID_NEW.COMBO_BOX: 'wxComboBox',
ID_NEW.LIST_BOX: 'wxListBox',
+ ID_NEW.CHECK_LIST: 'wxCheckListBox',
ID_NEW.STATIC_LINE: 'wxStaticLine',
ID_NEW.STATIC_BITMAP: 'wxStaticBitmap',
ID_NEW.SCROLL_BAR: 'wxScrollBar',
ID_NEW.TREE_CTRL: 'wxTreeCtrl',
ID_NEW.LIST_CTRL: 'wxListCtrl',
- ID_NEW.CHECK_LIST: 'wxCheckListBox',
ID_NEW.NOTEBOOK: 'wxNotebook',
+ ID_NEW.CHOICEBOOK: 'wxChoicebook',
+ ID_NEW.LISTBOOK: 'wxListbook',
ID_NEW.SPLITTER_WINDOW: 'wxSplitterWindow',
ID_NEW.SCROLLED_WINDOW: 'wxScrolledWindow',
ID_NEW.HTML_WINDOW: 'wxHtmlWindow',
ID_NEW.CALENDAR_CTRL: 'wxCalendarCtrl',
+ ID_NEW.DATE_CTRL: 'wxDatePickerCtrl',
ID_NEW.GENERIC_DIR_CTRL: 'wxGenericDirCtrl',
ID_NEW.SPIN_CTRL: 'wxSpinCtrl',
None,
(ID_NEW.TOOL_BAR, 'ToolBar', 'Create toolbar'),
(ID_NEW.MENU_BAR, 'MenuBar', 'Create menubar'),
- (ID_NEW.MENU, 'Menu', 'Create menu')
+ (ID_NEW.MENU, 'Menu', 'Create menu'),
+ None,
+ (ID_NEW.BITMAP, 'Bitmap', 'Create bitmap'),
+ (ID_NEW.ICON, 'Icon', 'Create icon'),
]
self.containers = [
(ID_NEW.PANEL, 'Panel', 'Create panel'),
(ID_NEW.NOTEBOOK, 'Notebook', 'Create notebook control'),
+ (ID_NEW.CHOICEBOOK, 'Choicebook', 'Create choicebook control'),
+ (ID_NEW.LISTBOOK, 'Listbook', 'Create listbook control'),
(ID_NEW.SPLITTER_WINDOW, 'SplitterWindow', 'Create splitter window'),
(ID_NEW.TOOL_BAR, 'ToolBar', 'Create toolbar'),
+ (ID_NEW.STATUS_BAR, 'StatusBar', 'Create status bar'),
# (ID_NEW.WIZARD_PAGE, 'WizardPage', 'Create wizard page'),
(ID_NEW.WIZARD_PAGE_SIMPLE, 'WizardPageSimple', 'Create simple wizard page'),
]
(ID_NEW.SCROLL_BAR, 'ScrollBar', 'Create scroll bar'),
(ID_NEW.TREE_CTRL, 'TreeCtrl', 'Create tree'),
(ID_NEW.LIST_CTRL, 'ListCtrl', 'Create list'),
- (ID_NEW.CHECK_LIST, 'CheckList', 'Create check list'),
(ID_NEW.SCROLLED_WINDOW, 'ScrolledWindow', 'Create scrolled window'),
(ID_NEW.HTML_WINDOW, 'HtmlWindow', 'Create HTML window'),
(ID_NEW.CALENDAR_CTRL, 'CalendarCtrl', 'Create calendar control'),
+ (ID_NEW.DATE_CTRL, 'DatePickerCtrl', 'Create date picker control'),
(ID_NEW.GENERIC_DIR_CTRL, 'GenericDirCtrl', 'Create generic dir control'),
(ID_NEW.UNKNOWN, 'Unknown', 'Create custom control placeholder'),
],
(ID_NEW.RADIO_BOX, 'RadioBox', 'Create radio box'),
(ID_NEW.COMBO_BOX, 'ComboBox', 'Create combo box'),
(ID_NEW.LIST_BOX, 'ListBox', 'Create list box'),
+ (ID_NEW.CHECK_LIST, 'CheckListBox', 'Create checklist box'),
],
['container', 'Containers',
(ID_NEW.PANEL, 'Panel', 'Create panel'),
(ID_NEW.NOTEBOOK, 'Notebook', 'Create notebook control'),
+ (ID_NEW.CHOICEBOOK, 'Choicebook', 'Create choicebook control'),
+ (ID_NEW.LISTBOOK, 'Listbook', 'Create listbook control'),
(ID_NEW.SPLITTER_WINDOW, 'SplitterWindow', 'Create splitter window'),
(ID_NEW.TOOL_BAR, 'ToolBar', 'Create toolbar'),
+ (ID_NEW.STATUS_BAR, 'StatusBar', 'Create status bar'),
# (ID_NEW.WIZARD_PAGE, 'Wizard Page', 'Create wizard page'),
(ID_NEW.WIZARD_PAGE_SIMPLE, 'WizardPageSimple', 'Create simple wizard page'),
],
(ID_NEW.GAUGE, 'Gauge', 'Create gauge'),
(ID_NEW.SCROLL_BAR, 'ScrollBar', 'Create scroll bar'),
(ID_NEW.LIST_CTRL, 'ListCtrl', 'Create list control'),
- (ID_NEW.CHECK_LIST, 'CheckList', 'Create check list'),
],
['button', 'Buttons',
(ID_NEW.BUTTON, 'Button', 'Create button'),
(ID_NEW.RADIO_BOX, 'RadioBox', 'Create radio box'),
(ID_NEW.COMBO_BOX, 'ComboBox', 'Create combo box'),
(ID_NEW.LIST_BOX, 'ListBox', 'Create list box'),
+ (ID_NEW.CHECK_LIST, 'CheckListBox', 'Create checklist box'),
],
]
self.stdButtons = [
# Root at (0,0)
if item == g.testWin.item: return wxPoint(0, 0)
itemParent = self.GetItemParent(item)
- # Select NB page
+ # Select book page
if not obj: obj = self.FindNodeObject(item)
- if self.GetPyData(itemParent).treeObject().__class__ == xxxNotebook:
- notebook = self.FindNodeObject(itemParent)
+ if self.GetPyData(itemParent).treeObject().__class__ in \
+ [xxxNotebook, xxxChoicebook, xxxListbook]:
+ book = self.FindNodeObject(itemParent)
# Find position
- for i in range(notebook.GetPageCount()):
- if notebook.GetPage(i) == obj:
- if notebook.GetSelection() != i:
- notebook.SetSelection(i)
+ for i in range(book.GetPageCount()):
+ if book.GetPage(i) == obj:
+ if book.GetSelection() != i:
+ book.SetSelection(i)
# Remove highlight - otherwise highlight window won't be visible
if g.testWin.highLight:
g.testWin.highLight.Remove()
# Top-level sizer? return window's sizer
if xxx.isSizer and isinstance(parentWin, wxWindow):
return parentWin.GetSizer()
+ elif isinstance(xxx, xxxStatusBar): return None
elif isinstance(xxx, xxxToolBar):
# If it's the main toolbar, we can't really select it
if xxx.parent.__class__ == xxxFrame: return None
if ch.GetWindow() and ch.GetWindow().GetName() == xxx.name:
return ch.GetWindow()
return None
+ elif xxx.parent.__class__ in [xxxChoicebook, xxxListbook]:
+ # First window is controld
+ return parentWin.GetChildren()[self.ItemIndex(item)+1]
# Otherwise get parent's object and it's child
child = parentWin.GetChildren()[self.ItemIndex(item)]
# Return window or sizer for sizer items
if child.IsWindow(): child = child.GetWindow()
elif child.IsSizer():
child = child.GetSizer()
- # Test for notebook sizers
+ # Test for notebook sizers (deprecated)
if isinstance(child, wxNotebookSizer):
- child = child.GetNotebook()
+ child = child.GetNotebook()
return child
def OnSelChanged(self, evt):
xxx = self.GetPyData(item)
if g.panel.IsModified():
self.Apply(xxx, item) # apply changes
- treeObj = xxx.treeObject()
- if treeObj.className not in ['wxFrame', 'wxPanel', 'wxDialog',
- 'wxMenuBar', 'wxToolBar', 'wxWizard',
- 'wxWizardPageSimple']:
+ availableViews = ['wxFrame', 'wxPanel', 'wxDialog',
+ 'wxMenuBar', 'wxToolBar', 'wxWizard',
+ 'wxWizardPageSimple']
+ originalItem = item
+ # Walk up the tree until we find an item that has a view
+ while item and self.GetPyData(item).treeObject().className not in availableViews:
+ item = self.GetItemParent(item)
+ if not item or not item.IsOk():
wxLogMessage('No view for this element (yet)')
return
# Show item in bold
if g.testWin: # Reset old
self.SetItemBold(g.testWin.item, False)
- self.CreateTestWin(item)
+ try:
+ wxBeginBusyCursor()
+ self.CreateTestWin(item)
+ finally:
+ wxEndBusyCursor()
# Maybe an error occurred, so we need to test
- if g.testWin: self.SetItemBold(g.testWin.item)
+ if g.testWin:
+ self.SetItemBold(g.testWin.item)
+ # Select original item
+ self.ChangeSelection(originalItem)
# Double-click on Linux
def OnItemActivated(self, evt):
# self.CreateTestWin(child)
# return
- wxBeginBusyCursor()
# Close old window, remember where it was
highLight = None
if testWin:
res.LoadOnFrame(testWin, g.frame, STD_NAME)
# Create status bar
testWin.panel = testWin
- testWin.CreateStatusBar()
+ #testWin.CreateStatusBar()
testWin.SetClientSize(testWin.GetBestSize())
testWin.SetPosition(pos)
testWin.Show(True)
wxLogError(traceback.format_exception(inf[0], inf[1], None)[-1])
wxLogError('Error loading resource')
wxMemoryFSHandler_RemoveFile('xxx.xrc')
- wxEndBusyCursor()
def CloseTestWindow(self):
if not g.testWin: return
SetMenu(m, pullDownMenu.stdButtons)
else:
SetMenu(m, pullDownMenu.controls)
- if xxx.__class__ == xxxNotebook:
+ if xxx.__class__ in [xxxNotebook, xxxChoicebook, xxxListbook]:
m.Enable(m.FindItem('sizer'), False)
elif not (xxx.isSizer or xxx.parent and xxx.parent.isSizer):
m.Enable(ID_NEW.SPACER, False)
xxx = g.tree.GetPyData(item)
# Replace with old element
parent = xxx.parent.element
- if xxx is self.xxx: # sizeritem or notebookpage - replace child
+ if xxx is self.xxx: # sizeritem or notebookpage - replace child
parent.replaceChild(self.xxx.child.element, xxx.child.element)
else:
parent.replaceChild(self.xxx.element, xxx.element)
defaultIDs = {xxxPanel:'PANEL', xxxDialog:'DIALOG', xxxFrame:'FRAME',
xxxMenuBar:'MENUBAR', xxxMenu:'MENU', xxxToolBar:'TOOLBAR',
- xxxWizard:'WIZARD'}
+ xxxWizard:'WIZARD', xxxBitmap:'BITMAP', xxxIcon:'ICON'}
defaultName = 'UNTITLED.xrc'
'Refresh', 'Refresh view')
tb.AddSimpleTool(self.ID_AUTO_REFRESH, images.getAutoRefreshBitmap(),
'Auto-refresh', 'Toggle auto-refresh mode', True)
- if wxPlatform == '__WXGTK__':
- tb.AddSeparator() # otherwise auto-refresh sticks in status line
+# if wxPlatform == '__WXGTK__':
+# tb.AddSeparator() # otherwise auto-refresh sticks in status line
tb.ToggleTool(self.ID_AUTO_REFRESH, conf.autoRefresh)
tb.Realize()
if not parent.__class__ in [xxxMainNode, xxxMenuBar, xxxMenu]: error = True
elif x.__class__ == xxxMenuItem:
if not parent.__class__ in [xxxMenuBar, xxxMenu]: error = True
- elif x.isSizer and parent.__class__ == xxxNotebook: error = True
+ elif x.isSizer and parent.__class__ in [xxxNotebook, xxxChoicebook, xxxListbook]:
+ error = True
else: # normal controls can be almost anywhere
if parent.__class__ == xxxMainNode or \
parent.__class__ in [xxxMenuBar, xxxMenu]: error = True
# If parent is sizer or notebook, child is of wrong class or
# parent is normal window, child is child container then detach child.
isChildContainer = isinstance(xxx, xxxChildContainer)
+ parentIsBook = parent.__class__ in [xxxNotebook, xxxChoicebook, xxxListbook]
if isChildContainer and \
((parent.isSizer and not isinstance(xxx, xxxSizerItem)) or \
- (isinstance(parent, xxxNotebook) and not isinstance(xxx, xxxNotebookPage)) or \
- not (parent.isSizer or isinstance(parent, xxxNotebook))):
+ (parentIsBook and not isinstance(xxx, xxxPage)) or \
+ not (parent.isSizer or parentIsBook)):
elem.removeChild(xxx.child.element) # detach child
elem.unlink() # delete child container
elem = xxx.child.element # replace
pageElem = MakeEmptyDOM('notebookpage')
pageElem.appendChild(elem)
elem = pageElem
+ elif isinstance(parent, xxxChoicebook) and not isChildContainer:
+ pageElem = MakeEmptyDOM('choicebookpage')
+ pageElem.appendChild(elem)
+ elem = pageElem
+ elif isinstance(parent, xxxListbook) and not isChildContainer:
+ pageElem = MakeEmptyDOM('listbookpage')
+ pageElem.appendChild(elem)
+ elem = pageElem
# Insert new node, register undo
newItem = tree.InsertNode(parentLeaf, parent, elem, nextItem)
undoMan.RegisterUndo(UndoPasteCreate(parentLeaf, parent, newItem, selected))
def OnIdle(self, evt):
if self.inIdle: return # Recursive call protection
self.inIdle = True
- if tree.needUpdate:
- if conf.autoRefresh:
- if g.testWin:
- self.SetStatusText('Refreshing test window...')
- # (re)create
- tree.CreateTestWin(g.testWin.item)
- self.SetStatusText('')
- tree.needUpdate = False
- elif tree.pendingHighLight:
- tree.HighLight(tree.pendingHighLight)
- else:
- evt.Skip()
- self.inIdle = False
+ try:
+ if tree.needUpdate:
+ if conf.autoRefresh:
+ if g.testWin:
+ self.SetStatusText('Refreshing test window...')
+ # (re)create
+ tree.CreateTestWin(g.testWin.item)
+ self.SetStatusText('')
+ tree.needUpdate = False
+ elif tree.pendingHighLight:
+ try:
+ tree.HighLight(tree.pendingHighLight)
+ except:
+ # Remove highlight if any problem
+ if g.testWin.highLight:
+ g.testWin.highLight.Remove()
+ tree.pendingHighLight = None
+ raise
+ else:
+ evt.Skip()
+ finally:
+ self.inIdle = False
# We don't let close panel window
def OnCloseMiniFrame(self, evt):
g.testWin = None
# Numbers for new controls
self.maxIDs = {}
- self.maxIDs[xxxPanel] = self.maxIDs[xxxDialog] = self.maxIDs[xxxFrame] = \
- self.maxIDs[xxxMenuBar] = self.maxIDs[xxxMenu] = self.maxIDs[xxxToolBar] = \
- self.maxIDs[xxxWizard] = 0
+ for cl in [xxxPanel, xxxDialog, xxxFrame,
+ xxxMenuBar, xxxMenu, xxxToolBar,
+ xxxWizard, xxxBitmap, xxxIcon]:
+ self.maxIDs[cl] = 0
def SetModified(self, state=True):
self.modified = state
class App(wxApp):
def OnInit(self):
+ # Check version
+ if wxVERSION[:3] < MinWxVersion:
+ wxLogWarning('''\
+This version of XRCed may not work correctly on your version of wxWindows. \
+Please upgrade wxWindows to %d.%d.%d or higher.''' % MinWxVersion)
global debug
# Process comand-line
opts = args = None
class xxxPanel(xxxContainer):
allParams = ['pos', 'size', 'style']
+ winStyles = ['wxNO_3D', 'wxTAB_TRAVERSAL']
styles = ['fg', 'bg', 'font', 'enabled', 'focused', 'hidden', 'exstyle',
'tooltip']
paramDict = {'centered': ParamBool}
required = ['title']
default = {'title': ''}
- winStyles = ['wxDEFAULT_DIALOG_STYLE',
- 'wxCAPTION', 'wxMINIMIZE_BOX', 'wxMAXIMIZE_BOX', 'wxCLOSE_BOX',
- 'wxSTAY_ON_TOP',
- 'wxTHICK_FRAME',
- 'wxNO_3D', 'wxDIALOG_NO_PARENT']
+ winStyles = ['wxDEFAULT_DIALOG_STYLE', 'wxCAPTION',
+ 'wxSTAY_ON_TOP', 'wxSYSTEM_MENU', 'wxTHICK_FRAME',
+ 'wxRESIZE_BORDER', 'wxRESIZE_BOX', 'wxCLOSE_BOX',
+ 'wxMAXIMIZE_BOX', 'wxMINIMIZE_BOX',
+ 'wxDIALOG_MODAL', 'wxDIALOG_MODELESS', 'wxDIALOG_NO_PARENT'
+ 'wxNO_3D', 'wxTAB_TRAVERSAL']
+ exStyles = ['wxWS_EX_VALIDATE_RECURSIVELY', 'wxDIALOG_EX_METAL']
styles = ['fg', 'bg', 'font', 'enabled', 'focused', 'hidden', 'exstyle',
'tooltip']
paramDict = {'centered': ParamBool}
required = ['title']
default = {'title': ''}
- winStyles = ['wxDEFAULT_FRAME_STYLE',
- 'wxCAPTION', 'wxMINIMIZE_BOX', 'wxMAXIMIZE_BOX', 'wxCLOSE_BOX',
- 'wxSTAY_ON_TOP',
- 'wxSYSTEM_MENU', 'wxRESIZE_BORDER',
- 'wxFRAME_TOOL_WINDOW', 'wxFRAME_NO_TASKBAR',
- 'wxFRAME_FLOAT_ON_PARENT', 'wxFRAME_SHAPED'
- ]
+ winStyles = ['wxDEFAULT_FRAME_STYLE', 'wxDEFAULT_DIALOG_STYLE', 'wxCAPTION',
+ 'wxSTAY_ON_TOP', 'wxSYSTEM_MENU', 'wxTHICK_FRAME',
+ 'wxRESIZE_BORDER', 'wxRESIZE_BOX', 'wxCLOSE_BOX',
+ 'wxMAXIMIZE_BOX', 'wxMINIMIZE_BOX',
+ 'wxFRAME_NO_TASKBAR', 'wxFRAME_SHAPED', 'wxFRAME_TOOL_WINDOW',
+ 'wxFRAME_FLOAT_ON_PARENT',
+ 'wxNO_3D', 'wxTAB_TRAVERSAL']
+ exStyles = ['wxWS_EX_VALIDATE_RECURSIVELY', 'wxFRAME_EX_METAL']
styles = ['fg', 'bg', 'font', 'enabled', 'focused', 'hidden', 'exstyle',
'tooltip']
'wxTB_3DBUTTONS','wxTB_TEXT', 'wxTB_NOICONS', 'wxTB_NODIVIDER',
'wxTB_NOALIGN', 'wxTB_HORZ_LAYOUT', 'wxTB_HORZ_TEXT']
+class xxxStatusBar(xxxObject):
+ hasStyle = False
+ allParams = ['fields', 'widths', 'styles', 'style']
+ paramDict = {'fields': ParamIntNN, 'widths': ParamText, 'styles': ParamText,
+ 'style': ParamNonGenericStyle}
+ winStyles = ['wxST_SIZEGRIP']
+
class xxxWizard(xxxContainer):
allParams = ['title', 'bitmap', 'pos']
required = ['title']
class xxxTextCtrl(xxxObject):
allParams = ['value', 'pos', 'size', 'style']
- winStyles = ['wxTE_PROCESS_ENTER', 'wxTE_PROCESS_TAB', 'wxTE_MULTILINE',
- 'wxTE_PASSWORD', 'wxTE_READONLY', 'wxHSCROLL']
+ winStyles = ['wxTE_NO_VSCROLL',
+ 'wxTE_AUTO_SCROLL',
+ 'wxTE_PROCESS_ENTER',
+ 'wxTE_PROCESS_TAB',
+ 'wxTE_MULTILINE',
+ 'wxTE_PASSWORD',
+ 'wxTE_READONLY',
+ 'wxHSCROLL',
+ 'wxTE_RICH',
+ 'wxTE_RICH2',
+ 'wxTE_AUTO_URL',
+ 'wxTE_NOHIDESEL',
+ 'wxTE_LEFT',
+ 'wxTE_CENTRE',
+ 'wxTE_RIGHT',
+ 'wxTE_DONTWRAP',
+ 'wxTE_LINEWRAP',
+ 'wxTE_WORDWRAP']
paramDict = {'value': ParamMultilineText}
class xxxChoice(xxxObject):
class xxxListCtrl(xxxObject):
allParams = ['pos', 'size', 'style']
winStyles = ['wxLC_LIST', 'wxLC_REPORT', 'wxLC_ICON', 'wxLC_SMALL_ICON',
- 'wxLC_ALIGN_TOP', 'wxLC_ALIGN_LEFT', 'wxLC_AUTOARRANGE',
- 'wxLC_USER_TEXT', 'wxLC_EDIT_LABELS', 'wxLC_NO_HEADER',
- 'wxLC_SINGLE_SEL', 'wxLC_SORT_ASCENDING', 'wxLC_SORT_DESCENDING']
+ 'wxLC_ALIGN_TOP', 'wxLC_ALIGN_LEFT', 'wxLC_AUTOARRANGE',
+ 'wxLC_USER_TEXT', 'wxLC_EDIT_LABELS', 'wxLC_NO_HEADER',
+ 'wxLC_SINGLE_SEL', 'wxLC_SORT_ASCENDING', 'wxLC_SORT_DESCENDING',
+ 'wxLC_VIRTUAL', 'wxLC_HRULES', 'wxLC_VRULES', 'wxLC_NO_SORT_HEADER']
class xxxTreeCtrl(xxxObject):
allParams = ['pos', 'size', 'style']
- winStyles = ['wxTR_HAS_BUTTONS', 'wxTR_NO_LINES', 'wxTR_LINES_AT_ROOT',
- 'wxTR_EDIT_LABELS', 'wxTR_MULTIPLE']
+ winStyles = ['wxTR_EDIT_LABELS',
+ 'wxTR_NO_BUTTONS',
+ 'wxTR_HAS_BUTTONS',
+ 'wxTR_TWIST_BUTTONS',
+ 'wxTR_NO_LINES',
+ 'wxTR_FULL_ROW_HIGHLIGHT',
+ 'wxTR_LINES_AT_ROOT',
+ 'wxTR_HIDE_ROOT',
+ 'wxTR_ROW_LINES',
+ 'wxTR_HAS_VARIABLE_ROW_HEIGHT',
+ 'wxTR_SINGLE',
+ 'wxTR_MULTIPLE',
+ 'wxTR_EXTENDED',
+ 'wxTR_DEFAULT_STYLE']
class xxxHtmlWindow(xxxObject):
allParams = ['pos', 'size', 'style', 'borders', 'url', 'htmlcode']
- paramDict = {'borders': ParamUnit, 'htmlcode':ParamMultilineText}
- winStyles = ['wxHW_SCROLLBAR_NEVER', 'wxHW_SCROLLBAR_AUTO']
+ paramDict = {'htmlcode':ParamMultilineText}
+ winStyles = ['wxHW_SCROLLBAR_NEVER', 'wxHW_SCROLLBAR_AUTO', 'wxHW_NO_SELECTION']
class xxxCalendarCtrl(xxxObject):
allParams = ['pos', 'size', 'style']
+ winStyles = ['wxCAL_SUNDAY_FIRST', 'wxCAL_MONDAY_FIRST', 'wxCAL_SHOW_HOLIDAYS',
+ 'wxCAL_NO_YEAR_CHANGE', 'wxCAL_NO_MONTH_CHANGE',
+ 'wxCAL_SEQUENTIAL_MONTH_SELECTION', 'wxCAL_SHOW_SURROUNDING_WEEKS']
class xxxNotebook(xxxContainer):
- allParams = ['usenotebooksizer', 'pos', 'size', 'style']
- paramDict = {'usenotebooksizer': ParamBool}
- winStyles = ['wxNB_FIXEDWIDTH', 'wxNB_LEFT', 'wxNB_RIGHT', 'wxNB_BOTTOM']
+ allParams = ['pos', 'size', 'style']
+ winStyles = ['wxNB_DEFAULT', 'wxNB_LEFT', 'wxNB_RIGHT', 'wxNB_BOTTOM',
+ 'wxNB_FIXEDWIDTH', 'wxNB_MULTILINE', 'wxNB_NOPAGETHEME']
+class xxxChoicebook(xxxContainer):
+ allParams = ['pos', 'size', 'style']
+ winStyles = ['wxCHB_DEFAULT', 'wxCHB_LEFT', 'wxCHB_RIGHT', 'wxCHB_TOP', 'wxCHB_BOTTOM']
+
+class xxxListbook(xxxContainer):
+ allParams = ['pos', 'size', 'style']
+ winStyles = ['wxLB_DEFAULT', 'wxLB_LEFT', 'wxLB_RIGHT', 'wxLB_TOP', 'wxLB_BOTTOM']
+
class xxxSplitterWindow(xxxContainer):
allParams = ['orientation', 'sashpos', 'minsize', 'pos', 'size', 'style']
paramDict = {'orientation': ParamOrientation, 'sashpos': ParamUnit, 'minsize': ParamUnit }
- winStyles = ['wxSP_3D', 'wxSP_3DSASH', 'wxSP_3DBORDER', 'wxSP_BORDER',
- 'wxSP_NOBORDER', 'wxSP_PERMIT_UNSPLIT', 'wxSP_LIVE_UPDATE',
- 'wxSP_NO_XP_THEME' ]
+ winStyles = ['wxSP_3D', 'wxSP_3DSASH', 'wxSP_3DBORDER',
+ 'wxSP_FULLSASH', 'wxSP_NOBORDER', 'wxSP_PERMIT_UNSPLIT', 'wxSP_LIVE_UPDATE',
+ 'wxSP_NO_XP_THEME' ]
class xxxGenericDirCtrl(xxxObject):
allParams = ['defaultfolder', 'filter', 'defaultfilter', 'pos', 'size', 'style']
paramDict = {'defaultfilter': ParamIntNN}
winStyles = ['wxDIRCTRL_DIR_ONLY', 'wxDIRCTRL_3D_INTERNAL', 'wxDIRCTRL_SELECT_FIRST',
- 'wxDIRCTRL_SHOW_FILTERS', 'wxDIRCTRL_EDIT_LABELS']
+ 'wxDIRCTRL_SHOW_FILTERS']
class xxxScrolledWindow(xxxContainer):
allParams = ['pos', 'size', 'style']
- winStyles = ['wxHSCROLL', 'wxVSCROLL']
+ winStyles = ['wxHSCROLL', 'wxVSCROLL', 'wxNO_3D', 'wxTAB_TRAVERSAL']
+
+class xxxDateCtrl(xxxObject):
+ allParams = ['pos', 'size', 'style', 'borders']
+ winStyles = ['wxDP_DEFAULT', 'wxDP_SPIN', 'wxDP_DROPDOWN',
+ 'wxDP_ALLOWNONE', 'wxDP_SHOWCENTURY']
################################################################################
# Buttons
allParams = ['label', 'default', 'pos', 'size', 'style']
paramDict = {'default': ParamBool}
required = ['label']
- winStyles = ['wxBU_LEFT', 'wxBU_TOP', 'wxBU_RIGHT', 'wxBU_BOTTOM']
+ winStyles = ['wxBU_LEFT', 'wxBU_TOP', 'wxBU_RIGHT', 'wxBU_BOTTOM', 'wxBU_EXACTFIT']
class xxxBitmapButton(xxxObject):
allParams = ['bitmap', 'selected', 'focus', 'disabled', 'default',
'pos', 'size', 'style']
required = ['bitmap']
- winStyles = ['wxBU_AUTODRAW', 'wxBU_LEFT', 'wxBU_TOP',
- 'wxBU_RIGHT', 'wxBU_BOTTOM']
+ winStyles = ['wxBU_AUTODRAW', 'wxBU_LEFT', 'wxBU_RIGHT',
+ 'wxBU_TOP', 'wxBU_BOTTOM', 'wxBU_EXACTFIT']
class xxxRadioButton(xxxObject):
allParams = ['label', 'value', 'pos', 'size', 'style']
paramDict = {'value': ParamBool}
required = ['label']
- winStyles = ['wxRB_GROUP']
+ winStyles = ['wxRB_GROUP', 'wxRB_SINGLE']
class xxxSpinButton(xxxObject):
allParams = ['value', 'min', 'max', 'pos', 'size', 'style']
paramDict = {'dimension': ParamIntNN}
required = ['label', 'content']
default = {'content': '[]'}
- winStyles = ['wxRA_SPECIFY_ROWS', 'wxRA_SPECIFY_COLS']
+ winStyles = ['wxRA_SPECIFY_ROWS', 'wxRA_SPECIFY_COLS', 'wxRA_HORIZONTAL',
+ 'wxRA_VERTICAL']
class xxxCheckBox(xxxObject):
allParams = ['label', 'checked', 'pos', 'size', 'style']
required = ['content']
default = {'content': '[]'}
winStyles = ['wxLB_SINGLE', 'wxLB_MULTIPLE', 'wxLB_EXTENDED', 'wxLB_HSCROLL',
- 'wxLB_ALWAYS_SB', 'wxLB_NEEDED_SB', 'wxLB_SORT']
+ 'wxLB_ALWAYS_SB', 'wxLB_NEEDED_SB', 'wxLB_SORT']
class xxxCheckList(xxxObject):
allParams = ['content', 'pos', 'size', 'style']
required = ['content']
default = {'content': '[]'}
- winStyles = ['wxLC_LIST', 'wxLC_REPORT', 'wxLC_ICON', 'wxLC_SMALL_ICON',
- 'wxLC_ALIGN_TOP', 'wxLC_ALIGN_LEFT', 'wxLC_AUTOARRANGE',
- 'wxLC_USER_TEXT', 'wxLC_EDIT_LABELS', 'wxLC_NO_HEADER',
- 'wxLC_SINGLE_SEL', 'wxLC_SORT_ASCENDING', 'wxLC_SORT_DESCENDING']
+ winStyles = ['wxLB_SINGLE', 'wxLB_MULTIPLE', 'wxLB_EXTENDED', 'wxLB_HSCROLL',
+ 'wxLB_ALWAYS_SB', 'wxLB_NEEDED_SB', 'wxLB_SORT']
paramDict = {'content': ParamContentCheckList}
################################################################################
class xxxFlexGridSizer(xxxGridSizer):
specials = ['growablecols', 'growablerows']
allParams = ['cols', 'rows', 'vgap', 'hgap'] + specials
- paramDict = {'growablecols':ParamIntList, 'growablerows':ParamIntList}
+ paramDict = {'growablecols': ParamIntList, 'growablerows': ParamIntList}
# Special processing for growable* parameters
# (they are represented by several nodes)
def special(self, tag, node):
self.child.allParams = self.child.allParams[:]
self.child.allParams.remove('pos')
-class xxxNotebookPage(xxxChildContainer):
+class xxxPage(xxxChildContainer):
allParams = ['label', 'selected']
paramDict = {'selected': ParamBool}
required = ['label']
class xxxUnknown(xxxObject):
allParams = ['pos', 'size', 'style']
+ winStyles = ['wxNO_FULL_REPAINT_ON_RESIZE']
################################################################################
'wxFrame': xxxFrame,
'tool': xxxTool,
'wxToolBar': xxxToolBar,
+ 'wxStatusBar': xxxStatusBar,
'wxWizard': xxxWizard,
'wxWizardPage': xxxWizardPage,
'wxWizardPageSimple': xxxWizardPageSimple,
'wxTreeCtrl': xxxTreeCtrl,
'wxListCtrl': xxxListCtrl,
'wxCheckListBox': xxxCheckList,
+ 'notebookpage': xxxPage,
+ 'choicebookpage': xxxPage,
+ 'listbookpage': xxxPage,
'wxNotebook': xxxNotebook,
+ 'wxChoicebook': xxxChoicebook,
+ 'wxListbook': xxxListbook,
'wxSplitterWindow': xxxSplitterWindow,
- 'notebookpage': xxxNotebookPage,
'wxHtmlWindow': xxxHtmlWindow,
'wxCalendarCtrl': xxxCalendarCtrl,
'wxGenericDirCtrl': xxxGenericDirCtrl,
'wxSpinCtrl': xxxSpinCtrl,
'wxScrolledWindow': xxxScrolledWindow,
+ 'wxDatePickerCtrl': xxxDateCtrl,
'wxBoxSizer': xxxBoxSizer,
'wxStaticBoxSizer': xxxStaticBoxSizer,
pageElem = MakeEmptyDOM('notebookpage')
pageElem.appendChild(elem)
elem = pageElem
+ elif isinstance(parent, xxxChoicebook):
+ pageElem = MakeEmptyDOM('choicebookpage')
+ pageElem.appendChild(elem)
+ elem = pageElem
+ elif isinstance(parent, xxxListbook):
+ pageElem = MakeEmptyDOM('listbookpage')
+ pageElem.appendChild(elem)
+ elem = pageElem
# Now just make object
return MakeXXXFromDOM(parent, elem)
pageElem = MakeEmptyDOM('notebookpage')
pageElem.appendChild(elem)
elem = pageElem
+ elif isinstance(parent, xxxChoicebook):
+ pageElem = MakeEmptyDOM('choicebookpage')
+ pageElem.appendChild(elem)
+ elem = pageElem
+ elif isinstance(parent, xxxListbook):
+ pageElem = MakeEmptyDOM('listbookpage')
+ pageElem.appendChild(elem)
+ elem = pageElem
# Now just make object
return MakeXXXFromDOM(parent, elem)