瀏覽代碼

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 年之前
父節點
當前提交
10bee37ae5
共有 2 個文件被更改,包括 12 次插入5 次删除
  1. 7 4
      gui/wxpython/gui_modules/gselect.py
  2. 5 1
      gui/wxpython/gui_modules/vdigit.py

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

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

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

@@ -159,6 +159,10 @@ class AbstractDigit:
             except:
             except:
                 pass
                 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):
     def SelectLinesByQueryThresh(self):
         """Generic method used for SelectLinesByQuery()
         """Generic method used for SelectLinesByQuery()
         -- to get threshold value"""
         -- to get threshold value"""
@@ -1687,7 +1691,7 @@ class VDigitSettingsDialog(wx.Dialog):
         # background map
         # background map
         text = wx.StaticText(parent=panel, id=wx.ID_ANY, label=_("Background vector 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),
         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.SetValue(UserSettings.Get(group='vdigit', key="backgroundMap", subkey='value'))
         self.backgroundMap.Bind(wx.EVT_TEXT, self.OnChangeBackgroundMap)
         self.backgroundMap.Bind(wx.EVT_TEXT, self.OnChangeBackgroundMap)
         flexSizer2.Add(text, proportion=1, flag=wx.ALIGN_CENTER_VERTICAL)
         flexSizer2.Add(text, proportion=1, flag=wx.ALIGN_CENTER_VERTICAL)