[GRASS-SVN] r51401 - grass/trunk/gui/wxpython/gcp

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Apr 12 14:07:08 EDT 2012


Author: mmetz
Date: 2012-04-12 11:07:08 -0700 (Thu, 12 Apr 2012)
New Revision: 51401

Modified:
   grass/trunk/gui/wxpython/gcp/manager.py
   grass/trunk/gui/wxpython/gcp/mapdisplay.py
Log:
wxGUI GCP manager: add OnIdle after resizing

Modified: grass/trunk/gui/wxpython/gcp/manager.py
===================================================================
--- grass/trunk/gui/wxpython/gcp/manager.py	2012-04-12 18:04:47 UTC (rev 51400)
+++ grass/trunk/gui/wxpython/gcp/manager.py	2012-04-12 18:07:08 UTC (rev 51401)
@@ -28,6 +28,7 @@
 import os
 import sys
 import shutil
+import time
 
 import wx
 from wx.lib.mixins.listctrl import CheckListCtrlMixin, ColumnSorterMixin, ListCtrlAutoWidthMixin
@@ -795,6 +796,9 @@
         #
         self.parent = parent # GMFrame
         self.parent.gcpmanagement = self
+        
+        # window resized
+        self.resize = False
 
         self.grassdatabase = self.grwiz.grassdatabase
 
@@ -925,7 +929,9 @@
         # bindings
         #
         self.Bind(wx.EVT_ACTIVATE, self.OnFocus)
-        self.Bind(wx.EVT_CLOSE, self.OnQuit)
+        self.Bind(wx.EVT_SIZE,     self.OnSize)
+        self.Bind(wx.EVT_IDLE,     self.OnIdle)
+        self.Bind(wx.EVT_CLOSE,    self.OnQuit)
 
     def __del__(self):
         """!Disable GCP manager mode"""
@@ -1867,20 +1873,31 @@
         self.PopupMenu(zoommenu)
         zoommenu.Destroy()
         
-    def OnDispResize(self, event):
+    def OnSize(self, event):
+        """!Adjust Map Windows after GCP Map Display has been resized
+        """
+        # re-render image on idle
+        self.resize = time.clock()
+
+    def OnIdle(self, event):
         """!GCP Map Display resized, adjust Map Windows
         """
         if self.GetMapToolbar():
-            srcwidth, srcheight = self.SrcMapWindow.GetSize()
-            tgtwidth, tgtheight = self.TgtMapWindow.GetSize()
-            srcwidth = (srcwidth + tgtwidth) / 2
-            self._mgr.GetPane("target").Hide()
-            self._mgr.Update()
-            self._mgr.GetPane("source").BestSize((srcwidth, srcheight))
-            self._mgr.GetPane("target").BestSize((srcwidth, tgtheight))
-            if self.show_target:
-                self._mgr.GetPane("target").Show()
-            self._mgr.Update()
+            if self.resize and self.resize + 0.2 < time.clock():
+                srcwidth, srcheight = self.SrcMapWindow.GetSize()
+                tgtwidth, tgtheight = self.TgtMapWindow.GetSize()
+                srcwidth = (srcwidth + tgtwidth) / 2
+                if self.show_target:
+                    self._mgr.GetPane("target").Hide()
+                    self._mgr.Update()
+                self._mgr.GetPane("source").BestSize((srcwidth, srcheight))
+                self._mgr.GetPane("target").BestSize((srcwidth, tgtheight))
+                if self.show_target:
+                    self._mgr.GetPane("target").Show()
+                self._mgr.Update()
+                self.resize = False
+            elif self.resize:
+                event.RequestMore()
         pass
 
 class GCPList(wx.ListCtrl,

Modified: grass/trunk/gui/wxpython/gcp/mapdisplay.py
===================================================================
--- grass/trunk/gui/wxpython/gcp/mapdisplay.py	2012-04-12 18:04:47 UTC (rev 51400)
+++ grass/trunk/gui/wxpython/gcp/mapdisplay.py	2012-04-12 18:07:08 UTC (rev 51401)
@@ -133,9 +133,7 @@
         #
         # Bind various events
         #
-        self.Bind(wx.EVT_ACTIVATE, self.OnFocus)
         self.Bind(EVT_UPDATE_PRGBAR, self.OnUpdateProgress)
-        self.Bind(wx.EVT_SIZE,     self.OnDispResize)
         self.activemap.Bind(wx.EVT_CHOICE, self.OnUpdateActive)
         
         #



More information about the grass-commit mailing list