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

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jun 25 05:10:49 PDT 2013


Author: turek
Date: 2013-06-25 05:10:49 -0700 (Tue, 25 Jun 2013)
New Revision: 56917

Modified:
   grass/trunk/gui/wxpython/dbmgr/base.py
Log:
dbmgr: remeber sql query also after record editation

Modified: grass/trunk/gui/wxpython/dbmgr/base.py
===================================================================
--- grass/trunk/gui/wxpython/dbmgr/base.py	2013-06-25 11:39:35 UTC (rev 56916)
+++ grass/trunk/gui/wxpython/dbmgr/base.py	2013-06-25 12:10:49 UTC (rev 56917)
@@ -79,6 +79,8 @@
         self.fieldCalc = None      
         self.columns = {} # <- LoadData()
         
+        self.sqlFilter = {}
+
         wx.ListCtrl.__init__(self, parent = parent, id = wx.ID_ANY,
                              style = wx.LC_REPORT | wx.LC_HRULES |
                              wx.LC_VRULES | wx.LC_VIRTUAL | wx.LC_SORT_ASCENDING)
@@ -118,10 +120,13 @@
         self.Bind(wx.EVT_LIST_COL_CLICK,       self.OnColumnSort)     
         self.Bind(wx.EVT_LIST_COL_RIGHT_CLICK, self.OnColumnMenu)     
         
-    def Update(self, mapDBInfo):
+    def Update(self, mapDBInfo = None):
         """!Update list according new mapDBInfo description"""
-        self.mapDBInfo = mapDBInfo
-        self.LoadData(self.layer)
+        if mapDBInfo:
+            self.mapDBInfo = mapDBInfo
+            self.LoadData(self.layer)
+        else:
+            self.LoadData(self.layer, **self.sqlFilter)
 
     def LoadData(self, layer, columns = None, where = None, sql = None):
         """!Load data into list
@@ -187,11 +192,15 @@
                                   overwrite = True))
             ret = RunCommand('db.select',
                              **cmdParams)
+            self.sqlFilter = {"sql" : sql}
         else:
             cmdParams.update(dict(map = self.mapDBInfo.map,
                                   layer = layer,
                                   where = where,
                                   stdout = outFile))
+            
+            self.sqlFilter = {"where" : where}
+
             if columns:
                 cmdParams.update(dict(columns = ','.join(columns)))
 
@@ -1332,7 +1341,7 @@
                                                      keyColumn, cat))
                 self.ApplyCommands(self.listOfCommands, self.listOfSQLStatements)
             
-            tlist.Update(self.dbMgrData['mapDBInfo'])
+            tlist.Update()
         
     def OnDataItemAdd(self, event):
         """!Add new record to the attribute table"""



More information about the grass-commit mailing list