# Reset selection object
self.selection = None
return node
+
# Find position relative to the top-level window
def FindNodePos(self, item, obj=None):
# Root at (0,0)
if g.testWin.highLight:
g.testWin.highLight.Remove()
break
- # Find first ancestor which is a wxWindow (not a sizer)
+ # For sizers and notebooks we must select the first window-like parent
winParent = itemParent
- while self.GetPyData(winParent).isSizer:
+ while self.GetPyData(winParent).isSizer or \
+ self.GetPyData(winParent).treeObject().__class__ == xxxNotebook:
winParent = self.GetItemParent(winParent)
- # Notebook children are layed out in a little strange way
- if self.GetPyData(itemParent).treeObject().__class__ == xxxNotebook:
- parentPos = wx.Point(0,0)
- else:
- parentPos = self.FindNodePos(winParent)
+ parentPos = self.FindNodePos(winParent)
# Position (-1,-1) is really (0,0)
pos = obj.GetPosition()
if pos == (-1,-1): pos = (0,0)
# If some data was modified, apply changes
if g.panel.IsModified():
self.Apply(xxx, oldItem)
- #if conf.autoRefresh:
if g.testWin:
if g.testWin.highLight:
g.testWin.highLight.Remove()
testWin.toolBar = res.LoadToolBar(testWin, STD_NAME)
testWin.SetToolBar(testWin.toolBar)
testWin.Show(True)
+ # Catch some events, set highlight
if testWin:
testWin.item = item
wx.EVT_CLOSE(testWin, self.OnCloseTestWin)
+ wx.EVT_SIZE(testWin, self.OnSizeTestWin)
testWin.highLight = None
if highLight and not self.pendingHighLight:
self.HighLight(highLight)
def OnCloseTestWin(self, evt):
self.CloseTestWindow()
+ def OnSizeTestWin(self, evt):
+ if g.testWin.highLight:
+ self.HighLight(g.testWin.highLight.item)
+ evt.Skip()
+
# Return index in parent, for real window children
def WindowIndex(self, item):
n = 0 # index of sibling
self.PopupMenu(menu, evt.GetPosition())
menu.Destroy()
- # Redefine to force the update of font dimentions
- def SetItemBold(self, item):
- wx.TreeCtrl.SetItemBold(self, item)
- self.SetIndent(self.GetIndent())
+ # Redefine to force the update of font dimentions on wxGTK
+ if wx.Platform == '__WXGTK__':
+ def SetItemBold(self, item, state=True):
+ wx.TreeCtrl.SetItemBold(self, item, state)
+ self.SetIndent(self.GetIndent())
# Apply changes
def Apply(self, xxx, item):