Fix bug with ToolTip staying on screen when compiling project with shortcut and mouse over a block
authorlaurent
Tue, 07 Feb 2012 19:12:25 +0100
changeset 641 e9295622ce9b
parent 640 c32c169b8f63
child 642 f2325ebd67f4
Fix bug with ToolTip staying on screen when compiling project with shortcut and mouse over a block
Viewer.py
graphics/LD_Objects.py
graphics/SFC_Objects.py
--- a/Viewer.py	Thu Feb 02 16:12:26 2012 +0100
+++ b/Viewer.py	Tue Feb 07 19:12:25 2012 +0100
@@ -540,7 +540,7 @@
         self.Editor.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheelWindow)
         self.Editor.Bind(wx.EVT_SIZE, self.OnMoveWindow)
         self.Editor.Bind(wx.EVT_MOUSE_EVENTS, self.OnViewerMouseEvent)
-    
+        
     def __del__(self):
         DebugViewer.__del__(self)
         self.RefreshHighlightsTimer.Stop()
@@ -910,6 +910,10 @@
     def RefreshView(self, variablepanel=True, selection=None):
         EditorPanel.RefreshView(self, variablepanel)
         
+        if self.ToolTipElement is not None:
+            self.ToolTipElement.ClearToolTip()
+            self.ToolTipElement = None
+        
         self.Inhibit(True)
         self.current_id = 0
         # Start by reseting Viewer
@@ -1423,7 +1427,7 @@
                 tooltip_pos.y += 10
                 self.ToolTipElement.CreateToolTip(tooltip_pos)
         event.Skip()
-
+    
     def OnViewerLeftDown(self, event):
         if self.Mode == MODE_SELECTION:
             dc = self.GetLogicalDC()
--- a/graphics/LD_Objects.py	Thu Feb 02 16:12:26 2012 +0100
+++ b/graphics/LD_Objects.py	Tue Feb 07 19:12:25 2012 +0100
@@ -152,7 +152,7 @@
             for connect in self.Connectors:
                 connect_pos = connect.GetRelPosition()
                 connect.SetPosition(wx.Point(connect_pos.x, connect_pos.y - miny))
-        self.Connectors.sort(lambda x, y: x.Pos.y.__cmp__(y.Pos.y))
+        self.Connectors.sort(lambda x, y: cmp(x.Pos.y, y.Pos.y))
         maxy = 0
         for connect in self.Connectors:
             connect_pos = connect.GetRelPosition()
--- a/graphics/SFC_Objects.py	Thu Feb 02 16:12:26 2012 +0100
+++ b/graphics/SFC_Objects.py	Tue Feb 07 19:12:25 2012 +0100
@@ -1222,8 +1222,8 @@
             for output in self.Outputs:
                 output_pos = output.GetRelPosition()
                 output.SetPosition(wx.Point(output_pos.x - minx, output_pos.y))
-        self.Inputs.sort(lambda x, y: x.Pos.x.__cmp__(y.Pos.x))
-        self.Outputs.sort(lambda x, y: x.Pos.x.__cmp__(y.Pos.x))
+        self.Inputs.sort(lambda x, y: cmp(x.Pos.x, y.Pos.x))
+        self.Outputs.sort(lambda x, y: cmp(x.Pos.x, y.Pos.x))
         self.Pos.x += minx
         self.Size[0] = maxx - minx
         connector.MoveConnected()