/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/view.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/UI/view.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 302 by bh, Mon Sep 2 15:59:11 2002 UTC revision 303 by bh, Mon Sep 2 16:47:53 2002 UTC
# Line 279  class MapCanvas(wxWindow, Publisher): Line 279  class MapCanvas(wxWindow, Publisher):
279          # if the mouse is outside the window.          # if the mouse is outside the window.
280          self.current_position = None          self.current_position = None
281    
         # If true, OnIdle will call do_redraw to do the actual  
         # redrawing. Set by OnPaint to avoid some unnecessary redraws.  
         # To force a redraw call full_redraw().  
         self.redraw_on_idle = 0  
   
282          # the bitmap serving as backing store          # the bitmap serving as backing store
283          self.bitmap = None          self.bitmap = None
284    
# Line 303  class MapCanvas(wxWindow, Publisher): Line 298  class MapCanvas(wxWindow, Publisher):
298          EVT_MOTION(self, self.OnMotion)          EVT_MOTION(self, self.OnMotion)
299          EVT_LEAVE_WINDOW(self, self.OnLeaveWindow)          EVT_LEAVE_WINDOW(self, self.OnLeaveWindow)
300          wx.EVT_SIZE(self, self.OnSize)          wx.EVT_SIZE(self, self.OnSize)
         wx.EVT_IDLE(self, self.OnIdle)  
301    
302      def __del__(self):      def __del__(self):
303          wxWindow.__del__(self)          wxWindow.__del__(self)
# Line 312  class MapCanvas(wxWindow, Publisher): Line 306  class MapCanvas(wxWindow, Publisher):
306      def OnPaint(self, event):      def OnPaint(self, event):
307          dc = wxPaintDC(self)          dc = wxPaintDC(self)
308          if self.map is not None and self.map.HasLayers():          if self.map is not None and self.map.HasLayers():
309              # We have a non-empty map. Redraw it in idle time              self.do_redraw()
             self.redraw_on_idle = 1  
310          else:          else:
311              # If we've got no map or if the map is empty, simply clear              # If we've got no map or if the map is empty, simply clear
312              # the screen.              # the screen.
# Line 583  class MapCanvas(wxWindow, Publisher): Line 576  class MapCanvas(wxWindow, Publisher):
576      def OnLeaveWindow(self, event):      def OnLeaveWindow(self, event):
577          self.set_current_position(None)          self.set_current_position(None)
578    
     def OnIdle(self, event):  
         if self.redraw_on_idle:  
             self.do_redraw()  
         self.redraw_on_idle = 0  
   
579      def OnSize(self, event):      def OnSize(self, event):
580          # the window's size has changed. We have to get a new bitmap. If          # the window's size has changed. We have to get a new bitmap. If
581          # we want to be clever we could try to get by without throwing          # we want to be clever we could try to get by without throwing

Legend:
Removed from v.302  
changed lines
  Added in v.303

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26