[GRASS-SVN] r72435 - grass/branches/releasebranch_7_4/gui/wxpython/datacatalog

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Mar 20 12:03:08 PDT 2018


Author: martinl
Date: 2018-03-20 12:03:07 -0700 (Tue, 20 Mar 2018)
New Revision: 72435

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

Modified: grass/branches/releasebranch_7_4/gui/wxpython/datacatalog/tree.py
===================================================================
--- grass/branches/releasebranch_7_4/gui/wxpython/datacatalog/tree.py	2018-03-20 19:00:45 UTC (rev 72434)
+++ grass/branches/releasebranch_7_4/gui/wxpython/datacatalog/tree.py	2018-03-20 19:03:07 UTC (rev 72435)
@@ -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