# HG changeset patch # User laurent # Date 1324492706 -3600 # Node ID fdb9501e5cc8630b854cc4df6aab2a644d291ace # Parent 9d24fa46523f350a3475fb6d2a75eaaa62eb1dc5 Fixing bug in Debug with ToolTip for wire value disappearing on Windows diff -r 9d24fa46523f -r fdb9501e5cc8 graphics/GraphicCommons.py --- a/graphics/GraphicCommons.py Tue Dec 20 23:37:26 2011 +0100 +++ b/graphics/GraphicCommons.py Wed Dec 21 19:38:26 2011 +0100 @@ -507,9 +507,11 @@ class ToolTip(wx.PopupWindow): - # Create a rubberband by indicated on which window it must be drawn def __init__(self, parent, tip): wx.PopupWindow.__init__(self, parent) + + self.CurrentPosition = wx.Point(0, 0) + self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) self.SetTip(tip) @@ -518,12 +520,16 @@ def SetTip(self, tip): self.Tip = tip wx.CallAfter(self.RefreshTip) - + + def MoveToolTip(self, pos): + self.CurrentPosition = pos + self.SetPosition(pos) + def RefreshTip(self): if self: - dc = wx.ClientDC(self) - w, h = dc.GetTextExtent(self.Tip) + w, h = self.GetTextExtent(self.Tip) self.SetSize(wx.Size(w + 4, h + 4)) + self.SetPosition(self.CurrentPosition) self.Refresh() def OnPaint(self, event): @@ -1807,12 +1813,12 @@ else: computed_value = str(self.Value) self.ToolTip = ToolTip(self.Parent, computed_value) - self.ToolTip.SetPosition(pos) + self.ToolTip.MoveToolTip(pos) self.ToolTip.Show() def MoveToolTip(self, pos): if self.ToolTip is not None: - self.ToolTip.SetPosition(pos) + self.ToolTip.MoveToolTip(pos) def ClearToolTip(self): if self.ToolTip is not None: