]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wx/tools/XRCed/tree.py
Patch from Eli Golovinsky. Adds generation of _() code for gettext
[wxWidgets.git] / wxPython / wx / tools / XRCed / tree.py
index de22265b1a66003acdb7a52fdf9605f414614683..3cb4c990c93efbee1aebcdcb20d1e99cc98533c3 100644 (file)
@@ -654,7 +654,7 @@ class XML_Tree(wxTreeCtrl):
         # Top-level sizer? return window's sizer
         if xxx.isSizer and isinstance(parentWin, wxWindow):
             return parentWin.GetSizer()
-        elif xxx.__class__ in [xxxStatusBar, xxxMenu, xxxMenuItem, xxxSeparator]:  return None
+        elif xxx.__class__ in [xxxMenu, xxxMenuItem, xxxSeparator]:  return None
         elif xxx.__class__ in [xxxToolBar, xxxMenuBar]:
             # If it's the main toolbar or menubar, we can't really select it
             if xxx.parent.__class__ == xxxFrame:  return None
@@ -671,15 +671,12 @@ class XML_Tree(wxTreeCtrl):
             # 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)]
+        child = parentWin.GetChildren()[self.WindowIndex(item)]
         # Return window or sizer for sizer items
         if child.GetClassName() == 'wxSizerItem':
             if child.IsWindow(): child = child.GetWindow()
             elif child.IsSizer():
                 child = child.GetSizer()
-                # Test for notebook sizers (deprecated)
-                if isinstance(child, wxNotebookSizer):
-                    child = child.GetNotebook()        
         return child
 
     def OnSelChanged(self, evt):
@@ -741,7 +738,9 @@ class XML_Tree(wxTreeCtrl):
             return
         # Get window/sizer object
         obj = self.FindNodeObject(item)
-        if not obj: return
+        if not obj:
+            if g.testWin.highLight: g.testWin.highLight.Remove()
+            return
         pos = self.FindNodePos(item, obj)
         size = obj.GetSize()
         # Highlight
@@ -982,6 +981,17 @@ class XML_Tree(wxTreeCtrl):
     def OnCloseTestWin(self, evt):
         self.CloseTestWindow()
 
+    # Return index in parent, for real window children
+    def WindowIndex(self, item):
+        n = 0                           # index of sibling
+        prev = self.GetPrevSibling(item)
+        while prev.IsOk():
+            # MenuBar is not a child
+            if not isinstance(self.GetPyData(prev), xxxMenuBar):
+                n += 1
+            prev = self.GetPrevSibling(prev)
+        return n
+
     # Return item index in parent
     def ItemIndex(self, item):
         n = 0                           # index of sibling