[GRASS-SVN] r59007 - in grass/trunk/gui: icons/grass wxpython/lmgr wxpython/vdigit

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Feb 12 10:39:30 PST 2014


Author: martinl
Date: 2014-02-12 10:39:29 -0800 (Wed, 12 Feb 2014)
New Revision: 59007

Added:
   grass/trunk/gui/icons/grass/layer-bottom.png
Modified:
   grass/trunk/gui/wxpython/lmgr/layertree.py
   grass/trunk/gui/wxpython/vdigit/toolbars.py
Log:
wxGUI/vdigit: use special icon for background map 


Added: grass/trunk/gui/icons/grass/layer-bottom.png
===================================================================
(Binary files differ)


Property changes on: grass/trunk/gui/icons/grass/layer-bottom.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Modified: grass/trunk/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/layertree.py	2014-02-12 07:53:27 UTC (rev 59006)
+++ grass/trunk/gui/wxpython/lmgr/layertree.py	2014-02-12 18:39:29 UTC (rev 59007)
@@ -103,8 +103,10 @@
                             label = _('Add WMS layer.')),
     'layerOptions'  : MetaIcon(img = 'options',
                                label = _('Set options')),
-    'layerEdited'     : MetaIcon(img = 'edit',
-                               label = _("Editing mode"))
+    'layerEdited'     : MetaIcon(img = 'layer-edit',
+                               label = _("Editing mode")),
+    'layerBgmap'     : MetaIcon(img = 'layer-bottom',
+                               label = _("Background vector map"))
     }
 
 class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
@@ -217,7 +219,7 @@
                          "layerRastnum", "layerVector", "layerThememap",
                          "layerThemechart", "layerGrid", "layerGeodesic",
                          "layerRhumb", "layerLabels", "layerCmd",
-                         "layerWms", "layerEdited"):
+                         "layerWms", "layerEdited", "layerBgmap"):
             iconKey = iconName[len("layer"):].lower()
             icon = LMIcons[iconName].GetBitmap(self.bmpsize)
             self._icon[iconKey] = il.Add(icon)
@@ -893,23 +895,20 @@
         self.SetItemIcon(layerItem)
         self.RefreshLine(layerItem)
 
-    ### unused since r58937
-    # def OnSetBgMap(self, event):
-    #     """!Set background vector map for editing sesstion"""
-    #     digit = self.mapdisplay.GetWindow().digit
-    #     if event.IsChecked():
-    #         mapName = self.GetLayerInfo(self.layer_selected, key = 'maplayer').GetName()
-    #         UserSettings.Set(group = 'vdigit', key = 'bgmap', subkey = 'value',
-    #                          value = str(mapName), internal = True)
-    #         digit.OpenBackgroundMap(mapName)
-    #         self._setGradient('bgmap')
-    #     else:
-    #         UserSettings.Set(group = 'vdigit', key = 'bgmap', subkey = 'value',
-    #                          value = '', internal = True)
-    #         digit.CloseBackgroundMap()
-    #         self._setGradient()
+    def SetBgMapForEditing(self, mapName, unset=False):
+        try:
+            layerItem = self.FindItemByData('name', mapName)[0]
+        except IndexError:
+             return
         
-    #     self.RefreshLine(self.layer_selected)
+        if not unset:
+            self._setGradient('bgmap')
+            self.SetItemIcon(layerItem, 'bgmap')
+        else:
+            self._setGradient()
+            self.SetItemIcon(layerItem)
+        
+        self.RefreshLine(layerItem)
 
     def OnPopupProperties (self, event):
         """!Popup properties dialog"""

Modified: grass/trunk/gui/wxpython/vdigit/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/vdigit/toolbars.py	2014-02-12 07:53:27 UTC (rev 59006)
+++ grass/trunk/gui/wxpython/vdigit/toolbars.py	2014-02-12 18:39:29 UTC (rev 59007)
@@ -45,11 +45,13 @@
         
         self.editingStarted = Signal("VDigitToolbar.editingStarted")
         self.editingStopped = Signal("VDigitToolbar.editingStopped")
+        self.editingBgMap = Signal("VDigitToolbar.editingBgMap")
         layerTree = self._giface.GetLayerTree()
         if layerTree:
             self.editingStarted.connect(layerTree.StartEditing)
             self.editingStopped.connect(layerTree.StopEditing)
-
+            self.editingBgMap.connect(layerTree.SetBgMapForEditing)
+            
         # currently selected map layer for editing (reference to MapLayer instance)
         self.mapLayer = None
         # list of vector layers from Layer Manager (only in the current mapset)
@@ -575,15 +577,18 @@
         dlg.Destroy()
         
         # close open background map if any
-        if UserSettings.Get(group = 'vdigit', key = 'bgmap', subkey = 'value',
-                            internal = True):
+        bgMap = UserSettings.Get(group = 'vdigit', key = 'bgmap', subkey = 'value',
+                                 internal = True)
+        if bgMap:
             self.digit.CloseBackgroundMap()
-        
+            self.editingBgMap.emit(mapName = bgMap, unset=True)
+
         # open background map for reading
         UserSettings.Set(group = 'vdigit', key = 'bgmap', subkey = 'value',
                          value = str(mapName), internal = True)
         self.digit.OpenBackgroundMap(mapName)
-        
+        self.editingBgMap.emit(mapName = mapName)
+
         if self.action['desc'] == 'copyLine': # select previous action
             self.ToggleTool(self.addPoint, True)
             self.ToggleTool(self.additionalTools, False)
@@ -941,9 +946,11 @@
             self.digit.CloseMap()
 
             # close open background map if any
-            if UserSettings.Get(group = 'vdigit', key = 'bgmap', subkey = 'value',
-                                internal = True):
+            bgMap = UserSettings.Get(group = 'vdigit', key = 'bgmap', subkey = 'value',
+                                     internal = True)
+            if bgMap:
                 self.digit.CloseBackgroundMap()
+                self.editingBgMap.emit(mapName = bgMap, unset=True)
             
             self._giface.GetProgress().SetValue(0)
             self._giface.WriteCmdLog(_("Editing of vector map <%s> successfully finished") % \



More information about the grass-commit mailing list