[GRASS-SVN] r70241 - grass/trunk/gui/wxpython/lmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jan 4 04:55:34 PST 2017


Author: martinl
Date: 2017-01-04 04:55:34 -0800 (Wed, 04 Jan 2017)
New Revision: 70241

Modified:
   grass/trunk/gui/wxpython/lmgr/layertree.py
Log:
wxGUI/lmgr: OnSetCompRegFromMap() run command from main thread, unused OnSetCompRegFromRaster() removed

Modified: grass/trunk/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/layertree.py	2017-01-04 12:38:21 UTC (rev 70240)
+++ grass/trunk/gui/wxpython/lmgr/layertree.py	2017-01-04 12:55:34 UTC (rev 70241)
@@ -898,20 +898,6 @@
         # print output to command log area
         self._giface.RunCmd(cmd)
 
-    def OnSetCompRegFromRaster(self, event):
-        """Set computational region from selected raster map (ignore NULLs).
-        Unused, removed item from layer context menu"""
-        mapLayer = self.GetLayerInfo(self.layer_selected, key='maplayer')
-
-        cmd = ['g.region', 'raster=%s' % mapLayer.GetName(),
-               'zoom=%s' % mapLayer.GetName()]
-
-        # print output to command log area
-        self._giface.RunCmd(cmd, notification=Notification.NO_NOTIFICATION)
-
-        # re-render map display
-        self._giface.GetMapWindow().UpdateMap(render=False)
-
     def OnSetCompRegFromMap(self, event):
         """Set computational region from selected raster/vector map
         """
@@ -932,20 +918,20 @@
                 for rname in mapLayer.GetName().splitlines():
                     rast.append(rname)
 
-        cmd = ['g.region']
+        kwargs = {}
         if rast:
-            cmd.append('raster=%s' % ','.join(rast))
+            kwargs['raster'] = ','.join(rast)
         if vect:
-            cmd.append('vector=%s' % ','.join(vect))
+            kwargs['vector'] = ','.join(vect)
         if rast3d:
-            cmd.append('raster_3d=%s' % ','.join(rast3d))
+            kwargs['raster_3d'] = ','.join(rast3d)
 
         # print output to command log area
-        if len(cmd) > 1:
-            if mltype == 'raster_3d':
-                cmd.append('-3')
-            self._giface.RunCmd(cmd, compReg=False,
-                                notification=Notification.NO_NOTIFICATION)
+        if kwargs:
+            # command must run in main thread otherwise it can be
+            # launched after rendering is done (region extent will
+            # remain untouched)
+            RunCommand('g.region', **kwargs)
 
         # re-render map display
         self._giface.GetMapWindow().UpdateMap(render=False)



More information about the grass-commit mailing list