[GRASS-SVN] r72386 - grass/trunk/gui/wxpython/datacatalog

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Mar 18 14:03:29 PDT 2018


Author: martinl
Date: 2018-03-18 14:03:29 -0700 (Sun, 18 Mar 2018)
New Revision: 72386

Modified:
   grass/trunk/gui/wxpython/datacatalog/tree.py
Log:
wxGUI/datacatalog: zoom to first added map (sync with lmgr behaviour)

Modified: grass/trunk/gui/wxpython/datacatalog/tree.py
===================================================================
--- grass/trunk/gui/wxpython/datacatalog/tree.py	2018-03-18 20:18:00 UTC (rev 72385)
+++ grass/trunk/gui/wxpython/datacatalog/tree.py	2018-03-18 21:03:29 UTC (rev 72386)
@@ -825,14 +825,15 @@
             layerName.append(string)
             label = _("Displaying {name}...").format(name=string)
             self.showNotification.emit(message=label)
+            self._giface.lmgr.AddMaps(
+                layerName, self.selected_type.label, True)
+
+            if len(self._giface.GetLayerList()) == 1:
+                # zoom to map if there is only one map layer
+                self._giface.GetMapWindow().ZoomToMap()
+
             label = "d." + self.selected_type.label[:4] + " --q map=" + string + \
                     _(" -- completed. Go to Layers tab for further operations.")
-            if self.selected_type.label == 'vector':
-                self._giface.lmgr.AddMaps(layerName, 'vector', True)
-            elif self.selected_type.label == 'raster':
-                self._giface.lmgr.AddMaps(layerName, 'raster', True)
-            else:
-                self._giface.lmgr.AddMaps(layerName, 'raster_3d', True)
             self.showNotification.emit(message=label)
             Debug.msg(1, "LAYER " + self.selected_layer.label + " DISPLAYED")
         else:



More information about the grass-commit mailing list