[GRASS-SVN] r59312 - in grass/trunk/gui/wxpython: mapdisp mapwin nviz

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Mar 24 10:42:50 PDT 2014


Author: turek
Date: 2014-03-24 10:42:50 -0700 (Mon, 24 Mar 2014)
New Revision: 59312

Modified:
   grass/trunk/gui/wxpython/mapdisp/frame.py
   grass/trunk/gui/wxpython/mapwin/base.py
   grass/trunk/gui/wxpython/mapwin/buffered.py
   grass/trunk/gui/wxpython/nviz/mapwindow.py
Log:
wxgui:fix wms in vdigit

Modified: grass/trunk/gui/wxpython/mapdisp/frame.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/frame.py	2014-03-24 16:28:00 UTC (rev 59311)
+++ grass/trunk/gui/wxpython/mapdisp/frame.py	2014-03-24 17:42:50 UTC (rev 59312)
@@ -292,7 +292,7 @@
                           CloseButton(False).DestroyOnClose(True).
                           Layer(0))
         
-        self.MapWindow = self.MapWindowVDigit
+        self._switchMapWindow(self.MapWindowVDigit)
         
         if self._mgr.GetPane('2d').IsShown():
             self._mgr.GetPane('2d').Hide()
@@ -362,7 +362,7 @@
                                         Map = self.Map, tree = self.tree, lmgr = self._layerManager)
             self._setUpMapWindow(self.MapWindow3D)
             self.MapWindow3D.mapQueried.connect(self.Query)
-            self.MapWindow = self.MapWindow3D
+            self._switchMapWindow(self.MapWindow3D)
             self.MapWindow.SetNamedCursor('default')
 
             # here was AddNvizTools in lmgr
@@ -382,7 +382,7 @@
             self.MapWindow3D.overlayHidden.connect(self._hideOverlay)
             self.legend.overlayChanged.connect(self.MapWindow3D.UpdateOverlays)
         else:
-            self.MapWindow = self.MapWindow3D
+            self._switchMapWindow(self.MapWindow3D)
             os.environ['GRASS_REGION'] = self.Map.SetRegion(windres = True, windres3 = True)
             self.MapWindow3D.GetDisplay().Init()
             del os.environ['GRASS_REGION']
@@ -436,7 +436,7 @@
         self._mgr.GetPane('2d').Show()
         self._mgr.GetPane('3d').Hide()
 
-        self.MapWindow = self.MapWindow2D
+        self._switchMapWindow(self.MapWindow2D)
         # here was RemoveNvizTools form lmgr
         self.ending3dMode.emit()
         try:
@@ -503,7 +503,7 @@
         if name == 'vdigit':
             self._mgr.GetPane('vdigit').Hide()
             self._mgr.GetPane('2d').Show()
-            self.MapWindow = self.MapWindow2D
+            self._switchMapWindow(self.MapWindow2D)
             
         self.toolbars['map'].combo.SetValue(_("2D view"))
         self.toolbars['map'].Enable2D(True)
@@ -1334,3 +1334,10 @@
         handler).
         """
         self.GetMapToolbar().SelectDefault()
+
+    def _switchMapWindow(self, map_win):
+        """!Notifies activated and disactivated map_wins."""
+        self.MapWindow.DisactivateWin()
+        map_win.ActivateWin()
+
+        self.MapWindow = map_win

Modified: grass/trunk/gui/wxpython/mapwin/base.py
===================================================================
--- grass/trunk/gui/wxpython/mapwin/base.py	2014-03-24 16:28:00 UTC (rev 59311)
+++ grass/trunk/gui/wxpython/mapwin/base.py	2014-03-24 17:42:50 UTC (rev 59312)
@@ -383,3 +383,11 @@
         self.zoomtype = zoomType
         self.pen = wx.Pen(colour='Red', width=2, style=wx.SHORT_DASH)
         self.SetNamedCursor('cross')
+
+    def DisactivateWin(self):
+        """!Use when the class instance is hidden in MapFrame."""
+        raise NotImplementedError()
+
+    def ActivateWin(self):
+        """!Used when the class instance is activated in MapFrame."""
+        raise NotImplementedError()

Modified: grass/trunk/gui/wxpython/mapwin/buffered.py
===================================================================
--- grass/trunk/gui/wxpython/mapwin/buffered.py	2014-03-24 16:28:00 UTC (rev 59311)
+++ grass/trunk/gui/wxpython/mapwin/buffered.py	2014-03-24 17:42:50 UTC (rev 59312)
@@ -175,8 +175,9 @@
         self._buffer = wx.EmptyBitmap(max(1, self.Map.width), max(1, self.Map.height))
         
         self.Bind(wx.EVT_ERASE_BACKGROUND, lambda x:None)
+
         # rerender when Map reports change
-        self.Map.layerChanged.connect(lambda: self.UpdateMap())
+        self.Map.layerChanged.connect(self.OnUpdateMap)
         
         # vars for handling mouse clicks
         self.dragid   = -1
@@ -184,7 +185,20 @@
         
         # list for registration of graphics to draw
         self.graphicsSetList = []
-  
+
+    def OnUpdateMap(self):
+        # before lambda func was used, however it was problem 
+        # to disconnect it from signal
+        self.UpdateMap()
+
+    def DisactivateWin(self):
+        """!Use when the class instance is hidden in MapFrame."""
+        self.Map.layerChanged.disconnect(self.OnUpdateMap)
+
+    def ActivateWin(self):
+        """!Used when the class instance is activated in MapFrame."""
+        self.Map.layerChanged.connect(self.OnUpdateMap)
+
     def _definePseudoDC(self):
         """!Define PseudoDC objects to use
         """

Modified: grass/trunk/gui/wxpython/nviz/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/mapwindow.py	2014-03-24 16:28:00 UTC (rev 59311)
+++ grass/trunk/gui/wxpython/nviz/mapwindow.py	2014-03-24 17:42:50 UTC (rev 59312)
@@ -2590,3 +2590,11 @@
         @param textinfo text metadata (text, font, color, rotation)
         """
         return self.parent.MapWindow2D.TextBounds(textinfo, relcoords = True)
+
+    def DisactivateWin(self):
+        """!Use when the class instance is hidden in MapFrame."""
+        pass
+
+    def ActivateWin(self):
+        """!Used when the class instance is activated in MapFrame."""
+        pass



More information about the grass-commit mailing list