Fix cursor refresh when GraphicViewer canvas is resized
authorlaurent
Sun, 01 Apr 2012 17:08:49 +0200
changeset 668 e858ff2f7862
parent 667 baab9eb5b8ad
child 669 4d02a5f4e766
Fix cursor refresh when GraphicViewer canvas is resized
GraphicViewer.py
--- a/GraphicViewer.py	Sun Apr 01 15:51:39 2012 +0200
+++ b/GraphicViewer.py	Sun Apr 01 17:08:49 2012 +0200
@@ -117,6 +117,7 @@
         self.Canvas.canvas.Bind(wx.EVT_LEFT_UP, self.OnCanvasLeftUp)
         self.Canvas.canvas.Bind(wx.EVT_MOTION, self.OnCanvasMotion)
         self.Canvas.canvas.Bind(wx.EVT_MOUSEWHEEL, self.OnCanvasMouseWheel)
+        self.Canvas.canvas.Bind(wx.EVT_SIZE, self.OnCanvasResize)
         
         self.staticbox1 = wx.StaticText(id=ID_GRAPHICVIEWERSTATICTEXT1,
               label=_('Range:'), name='staticText1', parent=self.Editor,
@@ -191,7 +192,7 @@
         self.YCenter = 0
         self.CurrentZoom = 1
         self.Fixed = False
-        self.Ticktime = 0#self.DataProducer.GetTicktime()
+        self.Ticktime = self.DataProducer.GetTicktime()
         self.RefreshCanvasRange()
         
         for zoom_txt, zoom in ZOOM_VALUES:
@@ -310,7 +311,6 @@
         return self.InstancePath == tagname
     
     def NewValue(self, tick, value, forced=False):
-        print tick, value
         self.Datas.append((float(tick), {True:1., False:0.}.get(value, float(value))))
         if self.MinValue is None:
             self.MinValue = value
@@ -447,6 +447,11 @@
                     wx.CallAfter(self.NewDataAvailable, True)
         event.Skip()
 
+    def OnCanvasResize(self, event):
+        self.ResetLastCursor()
+        wx.CallAfter(self.RefreshCursor)
+        event.Skip()
+
     ## Reset the last cursor
     def ResetLastCursor(self):
         self.LastCursor = None