[GRASS-SVN] r64779 - grass/trunk/gui/wxpython/dbmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Mar 2 06:13:09 PST 2015


Author: martinl
Date: 2015-03-02 06:13:09 -0800 (Mon, 02 Mar 2015)
New Revision: 64779

Modified:
   grass/trunk/gui/wxpython/dbmgr/base.py
   grass/trunk/gui/wxpython/dbmgr/manager.py
Log:
wxGUI/dbmgr: add clear button to reload all data (drop current selection)


Modified: grass/trunk/gui/wxpython/dbmgr/base.py
===================================================================
--- grass/trunk/gui/wxpython/dbmgr/base.py	2015-03-02 13:13:59 UTC (rev 64778)
+++ grass/trunk/gui/wxpython/dbmgr/base.py	2015-03-02 14:13:09 UTC (rev 64779)
@@ -1990,6 +1990,22 @@
             tlist = self.FindWindowById(self.layerPage[layer]['data'])
             tlist.Update(self.dbMgrData['mapDBInfo'])
 
+    def ResetPage(self, layer=None):
+        if not layer:
+            layer = self.selLayer
+        if layer not in self.layerPage.keys():
+            return
+        win = self.FindWindowById(self.layerPage[self.selLayer]['sqlNtb'])
+        if win.GetSelection() == 0:
+            self.FindWindowById(self.layerPage[layer]['whereColumn']).SetSelection(0)
+            self.FindWindowById(self.layerPage[layer]['whereOperator']).SetSelection(0)
+            self.FindWindowById(self.layerPage[layer]['where']).SetValue('')
+        else:
+            sqlWin = self.FindWindowById(self.layerPage[self.selLayer]['statement'])
+            sqlWin.SetValue("SELECT * FROM %s" % self.dbMgrData['mapDBInfo'].layers[layer]['table'])
+            
+        self.UpdatePage(layer)
+        
 class DbMgrTablesPage(DbMgrNotebookBase):   
     def __init__(self, parent, parentDbMgrBase, onlyLayer = -1):
         """Page for managing tables

Modified: grass/trunk/gui/wxpython/dbmgr/manager.py
===================================================================
--- grass/trunk/gui/wxpython/dbmgr/manager.py	2015-03-02 13:13:59 UTC (rev 64778)
+++ grass/trunk/gui/wxpython/dbmgr/manager.py	2015-03-02 14:13:09 UTC (rev 64779)
@@ -120,11 +120,14 @@
         self.btnClose   = wx.Button(parent = self.panel, id = wx.ID_CLOSE)
         self.btnClose.SetToolTipString(_("Close Attribute Table Manager"))
         self.btnReload = wx.Button(parent = self.panel, id = wx.ID_REFRESH)
-        self.btnReload.SetToolTipString(_("Reload attribute data (selected layer only)"))
-
+        self.btnReload.SetToolTipString(_("Reload currently selected attribute data"))
+        self.btnReset = wx.Button(parent = self.panel, id = wx.ID_CLEAR)
+        self.btnReset.SetToolTipString(_("Reload all attribute data (drop current selection)"))
+        
         # events
         self.btnClose.Bind(wx.EVT_BUTTON,   self.OnCloseWindow)
-        self.btnReload.Bind(wx.EVT_BUTTON, self.OnReloadData)
+        self.btnReload.Bind(wx.EVT_BUTTON,  self.OnReloadData)
+        self.btnReset.Bind(wx.EVT_BUTTON,   self.OnReloadDataAll)
         self.notebook.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
         self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
 
@@ -142,6 +145,8 @@
 
         # buttons
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
+        btnSizer.Add(item = self.btnReset, proportion = 1,
+                     flag = wx.ALL | wx.ALIGN_RIGHT, border = 5)
         btnSizer.Add(item = self.btnReload, proportion = 1,
                      flag = wx.ALL | wx.ALIGN_RIGHT, border = 5)
         btnSizer.Add(item = self.btnClose, proportion = 1,
@@ -170,7 +175,12 @@
         """Reload data"""
         if self.pages['browse']:
             self.pages['browse'].OnDataReload(event) # TODO replace by signal
-        
+
+    def OnReloadDataAll(self, event):
+        """Reload all data"""
+        if self.pages['browse']:
+            self.pages['browse'].ResetPage()
+
     def OnPageChanged(self, event):
         """On page in ATM is changed"""
         try:
@@ -189,9 +199,11 @@
             else:
                 self.log.write("")
             self.btnReload.Enable()
+            self.btnReset.Enable()
         else:
             self.log.write("")
             self.btnReload.Enable(False)
+            self.btnReset.Enable(False)
         
         event.Skip()   
 



More information about the grass-commit mailing list