Patch for XRCed: makes it easier to open test mode

1 view
Skip to first unread message

Nate Silva

unread,
Jun 27, 2005, 1:52:34 PM6/27/05
to wxPyth...@lists.wxwidgets.org
This is a feature patch for XRCed.

It enhances the test mode (F5, or View > Test, or double-click an item).

If you are double-clicking a control and seeing "No view for this
item (yet)" this patch will instead open the containing frame or
dialog and display the control in context.

Regards,
Nate

Index: tree.py
===================================================================
RCS file: /pack/cvsroots/wxwidgets/wxWidgets/wxPython/wx/tools/XRCed/
tree.py,v
retrieving revision 1.17
diff -u -r1.17 tree.py
--- tree.py 2005/06/14 22:59:20 1.17
+++ tree.py 2005/06/27 17:43:48
@@ -662,15 +662,16 @@
g.testWin.highLight.item = item

def ShowTestWindow(self, item):
- 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']:
- wxLogMessage('No view for this element (yet)')
- return
+ self.Apply(self.GetPyData(item), item) # apply changes
+ availableViews = ['wxFrame', 'wxPanel', 'wxDialog',
'wxMenuBar',
+ 'wxToolBar', 'wxWizard',
'wxWizardPageSimple']
+ while self.GetPyData(item).treeObject().className not in
availableViews:
+ # walk up the tree until we find an item that has a view
+ 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)


Reply all
Reply to author
Forward
0 new messages