[GRASS-SVN] r38933 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 31 12:54:10 EDT 2009


Author: martinl
Date: 2009-08-31 12:54:10 -0400 (Mon, 31 Aug 2009)
New Revision: 38933

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py
Log:
wxGUI: vector attributes editable only if vector map is in the current
mapset
      (merge from trunk, r38932)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py	2009-08-31 16:36:00 UTC (rev 38932)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py	2009-08-31 16:54:10 UTC (rev 38933)
@@ -1,4 +1,4 @@
-"""
+"""!
 @package dbm.py
 
 @brief GRASS Attribute Table Manager
@@ -46,6 +46,8 @@
 import wx.lib.mixins.listctrl as listmix
 import wx.lib.flatnotebook as FN
 
+import grass.script as grass
+
 import sqlbuilder
 import gcmd
 import utils
@@ -446,7 +448,14 @@
             maptree = self.parent.curr_page.maptree
             name = maptree.GetPyData(self.treeItem)[0]['maplayer'].GetName()
             self.vectorName = name
-
+        
+        # vector attributes can be changed only if vector map is in
+        # the current mapset
+        if grass.find_file(element = 'vector', name = vectorName)['mapset'] == grass.gisenv()['MAPSET']:
+            editable = True
+        else:
+            editable = False
+        
         self.cmdLog     = log    # self.parent.goutput
         
         wx.Frame.__init__(self, parent, id, style=style)
@@ -522,9 +531,11 @@
         self.browsePage.SetTabAreaColour(globalvar.FNPageColor)
 
         self.manageTablePage = FN.FlatNotebook(self.panel, id=wx.ID_ANY,
-                                          style=dbmStyle)
+                                               style=dbmStyle)
         #self.notebook.AddPage(self.manageTablePage, caption=_("Manage tables"))
         self.notebook.AddPage(self.manageTablePage, text=_("Manage tables")) # FN
+        if not editable:
+            self.notebook.GetPage(self.notebook.GetPageCount()-1).Enable(False)
         self.manageTablePage.SetTabAreaColour(globalvar.FNPageColor)
 
         self.manageLayerPage = FN.FlatNotebook(self.panel, id=wx.ID_ANY,
@@ -532,6 +543,8 @@
         #self.notebook.AddPage(self.manageLayerPage, caption=_("Manage layers"))
         self.notebook.AddPage(self.manageLayerPage, text=_("Manage layers")) # FN
         self.manageLayerPage.SetTabAreaColour(globalvar.FNPageColor)
+        if not editable:
+            self.notebook.GetPage(self.notebook.GetPageCount()-1).Enable(False)
         
         self.__createBrowsePage()
         self.__createManageTablePage()



More information about the grass-commit mailing list