Przeglądaj źródła

wxGUI/vdigit: currently edited vector map cannot be used as background map (merge devbr6, https://trac.osgeo.org/grass/changeset/31689)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@31690 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 17 lat temu
rodzic
commit
10bee37ae5

+ 7 - 4
gui/wxpython/gui_modules/gselect.py

@@ -27,7 +27,7 @@ from preferences import globalSettings as UserSettings
 
 class Select(wx.combo.ComboCtrl):
     def __init__(self, parent, id, size,
-                 type, multiple=False, mapsets=None):
+                 type, multiple=False, mapsets=None, exceptOf=[]):
         """
         Custom control to create a ComboBox with a tree control
         to display and select GIS elements within acessible mapsets.
@@ -39,7 +39,7 @@ class Select(wx.combo.ComboCtrl):
         self.tcp = TreeCtrlComboPopup()
         self.SetPopupControl(self.tcp)
         self.SetPopupExtents(0,100)
-        self.tcp.GetElementList(type, mapsets)
+        self.tcp.GetElementList(type, mapsets, exceptOf)
         self.tcp.SetMultiple(multiple)
 
     def SetElementList(self, type):
@@ -116,7 +116,7 @@ class TreeCtrlComboPopup(wx.combo.ComboPopup):
     def GetAdjustedSize(self, minWidth, prefHeight, maxHeight):
         return wx.Size(minWidth, min(200, maxHeight))
 
-    def GetElementList(self, element, mapsets=None):
+    def GetElementList(self, element, mapsets=None, exceptOf=[]):
         """
         Get list of GIS elements in accessible mapsets and display as tree
         with all relevant elements displayed beneath each mapset branch
@@ -195,7 +195,10 @@ class TreeCtrlComboPopup(wx.combo.ComboPopup):
                 elem_list.sort()
                 for elem in elem_list:
                     if elem != '':
-                        self.AddItem(elem+'@'+dir, parent=dir_node)
+                        fullqElem = elem + '@' + dir
+                        if len(exceptOf) > 0 and fullqElem in exceptOf:
+                            continue
+                        self.AddItem(fullqElem, parent=dir_node)
             except:
                 continue
 

+ 5 - 1
gui/wxpython/gui_modules/vdigit.py

@@ -159,6 +159,10 @@ class AbstractDigit:
             except:
                 pass
 
+        # avoid using current vector map as background map
+        if self.map == UserSettings.Get(group='vdigit', key='backgroundMap', subkey='value'):
+            UserSettings.Set(group='vdigit', key='backgroundMap', subkey='value', value='')
+
     def SelectLinesByQueryThresh(self):
         """Generic method used for SelectLinesByQuery()
         -- to get threshold value"""
@@ -1687,7 +1691,7 @@ class VDigitSettingsDialog(wx.Dialog):
         # background map
         text = wx.StaticText(parent=panel, id=wx.ID_ANY, label=_("Background vector map"))
         self.backgroundMap = gselect.Select(parent=panel, id=wx.ID_ANY, size=(200,-1),
-                                           type="vector")
+                                           type="vector", exceptOf=[self.parent.digit.map])
         self.backgroundMap.SetValue(UserSettings.Get(group='vdigit', key="backgroundMap", subkey='value'))
         self.backgroundMap.Bind(wx.EVT_TEXT, self.OnChangeBackgroundMap)
         flexSizer2.Add(text, proportion=1, flag=wx.ALIGN_CENTER_VERTICAL)