Преглед на файлове

dbmgr: remeber sql query also after record editation

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@56917 15284696-431f-4ddb-bdfa-cd5b030d7da7
Štěpán Turek преди 12 години
родител
ревизия
31668c073e
променени са 1 файла, в които са добавени 13 реда и са изтрити 4 реда
  1. 13 4
      gui/wxpython/dbmgr/base.py

+ 13 - 4
gui/wxpython/dbmgr/base.py

@@ -79,6 +79,8 @@ class VirtualAttributeList(wx.ListCtrl,
         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 @@ class VirtualAttributeList(wx.ListCtrl,
         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 @@ class VirtualAttributeList(wx.ListCtrl,
                                   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 @@ class DbMgrBrowsePage(DbMgrNotebookBase):
                                                      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"""