[GRASS-SVN] r38938 - grass/branches/releasebranch_6_4/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 31 16:30:55 EDT 2009


Author: martinl
Date: 2009-08-31 16:30:54 -0400 (Mon, 31 Aug 2009)
New Revision: 38938

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


Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/dbm.py	2009-08-31 20:20:50 UTC (rev 38937)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/dbm.py	2009-08-31 20:30:54 UTC (rev 38938)
@@ -467,10 +467,10 @@
                 
         # vector attributes can be changed only if vector map is in
         # the current mapset
-        if grass.find_file(element = 'vector', name = vectmap)['mapset'] == grass.gisenv()['MAPSET']:
-            editable = True
+        if grass.find_file(name = self.vectmap, element = 'vector')['mapset'] == grass.gisenv()['MAPSET']:
+            self.editable = True
         else:
-            editable = False
+            self.editable = False
                 
         wx.Frame.__init__(self, parent, id, title, style=style)
         
@@ -541,7 +541,7 @@
                                                style=dbmStyle)
         #self.notebook.AddPage(self.manageTablePage, caption=_("Manage tables"))
         self.notebook.AddPage(self.manageTablePage, text=_("Manage tables")) # FN
-        if not editable:
+        if not self.editable:
             self.notebook.GetPage(self.notebook.GetPageCount()-1).Enable(False)
         self.manageTablePage.SetTabAreaColour(globalvar.FNPageColor)
 
@@ -550,7 +550,7 @@
         #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:
+        if not self.editable:
             self.notebook.GetPage(self.notebook.GetPageCount()-1).Enable(False)
         
         self.__createBrowsePage()
@@ -1022,11 +1022,15 @@
         menu = wx.Menu()
         menu.Append(self.popupDataID1, _("Edit selected record"))
         selected = list.GetFirstSelected()
-        if selected == -1 or list.GetNextSelected(selected) != -1:
+        if not self.editable or selected == -1 or list.GetNextSelected(selected) != -1:
             menu.Enable(self.popupDataID1, False)
         menu.Append(self.popupDataID2, _("Insert new record"))
         menu.Append(self.popupDataID3, _("Delete selected record(s)"))
         menu.Append(self.popupDataID4, _("Delete all records"))
+        if not self.editable:
+            menu.Enable(self.popupDataID2, False)
+            menu.Enable(self.popupDataID3, False)
+            menu.Enable(self.popupDataID4, False)
         menu.AppendSeparator()
         menu.Append(self.popupDataID5, _("Select all"))
         menu.Append(self.popupDataID6, _("Deselect all"))
@@ -1038,6 +1042,8 @@
             menu.Enable(self.popupDataID8, False)
         menu.Append(self.popupDataID9, _("Extract selected features"))
         menu.Append(self.popupDataID11, _("Delete selected features"))
+        if not self.editable:
+            menu.Enable(self.popupDataID11, False)
         if list.GetFirstSelected() == -1:
             menu.Enable(self.popupDataID3, False)
             menu.Enable(self.popupDataID9, False)



More information about the grass-commit mailing list