[GRASS-SVN] r49181 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Nov 11 09:05:36 EST 2011


Author: martinl
Date: 2011-11-11 06:05:36 -0800 (Fri, 11 Nov 2011)
New Revision: 49181

Modified:
   grass/trunk/gui/wxpython/gui_modules/dbm_dialogs.py
   grass/trunk/gui/wxpython/gui_modules/gcmd.py
   grass/trunk/gui/wxpython/gui_modules/gdialogs.py
   grass/trunk/gui/wxpython/gui_modules/mapdisp_vdigit.py
   grass/trunk/gui/wxpython/gui_modules/toolbars.py
Log:
wxGUI: some improvement when creating new vector map using digitizer
       report time consumption for running command


Modified: grass/trunk/gui/wxpython/gui_modules/dbm_dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm_dialogs.py	2011-11-11 13:56:20 UTC (rev 49180)
+++ grass/trunk/gui/wxpython/gui_modules/dbm_dialogs.py	2011-11-11 14:05:36 UTC (rev 49181)
@@ -168,10 +168,6 @@
             Debug.msg(2, "DisplayAttributesDialog(): Nothing found!")
             ### self.mapDBInfo = None
         
-    def __SelectAttributes(self, layer):
-        """!Select attributes"""
-        pass
-
     def OnSQLStatement(self, event):
         """!Update SQL statement"""
         pass
@@ -182,7 +178,7 @@
         @return True on attributes found
         @return False attributes not found
         """
-        return bool(self.notebook.GetPageCount())
+        return bool(self.mapDBInfo and self.notebook.GetPageCount() > 0)
     
     def GetSQLString(self, updateValues = False):
         """!Create SQL statement string based on self.sqlStatement

Modified: grass/trunk/gui/wxpython/gui_modules/gcmd.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gcmd.py	2011-11-11 13:56:20 UTC (rev 49180)
+++ grass/trunk/gui/wxpython/gui_modules/gcmd.py	2011-11-11 14:05:36 UTC (rev 49181)
@@ -32,6 +32,7 @@
 import locale
 import traceback
 import types
+import time
 
 import wx
 
@@ -591,11 +592,12 @@
     
     if stdin:
         kwargs['stdin'] = subprocess.PIPE
+
+    Debug.msg(2, "gcmd.RunCommand(): command started")
+    start = time.time()
     
     ps = grass.start_command(prog, flags, overwrite, quiet, verbose, **kwargs)
     
-    Debug.msg(2, "gcmd.RunCommand(): command started")
-
     if stdin:
         ps.stdin.write(stdin)
         ps.stdin.close()
@@ -605,8 +607,9 @@
     stdout, stderr = map(utils.DecodeString, ps.communicate())
     
     ret = ps.returncode
-    Debug.msg(1, "gcmd.RunCommand(): get return code %d" % ret)
-        
+    Debug.msg(1, "gcmd.RunCommand(): get return code %d (%.6f sec)" % \
+                  (ret, (time.time() - start)))
+    
     Debug.msg(3, "gcmd.RunCommand(): print error")
     if ret != 0 and parent:
         Debug.msg(2, "gcmd.RunCommand(): error %s" % stderr)

Modified: grass/trunk/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gdialogs.py	2011-11-11 13:56:20 UTC (rev 49180)
+++ grass/trunk/gui/wxpython/gui_modules/gdialogs.py	2011-11-11 14:05:36 UTC (rev 49181)
@@ -254,11 +254,14 @@
         if disableTable:
             self.table.Enable(False)
         
-        self.keycol = wx.TextCtrl(parent = self.panel, id =  wx.ID_ANY,
-                                  size = globalvar.DIALOG_SPIN_SIZE)
-        self.keycol.SetValue(UserSettings.Get(group = 'atm', key = 'keycolumn', subkey = 'value'))
-        if disableTable:
-            self.keycol.Enable(False)
+        if showType:
+            self.keycol = None
+        else:
+            self.keycol = wx.TextCtrl(parent = self.panel, id =  wx.ID_ANY,
+                                      size = globalvar.DIALOG_SPIN_SIZE)
+            self.keycol.SetValue(UserSettings.Get(group = 'atm', key = 'keycolumn', subkey = 'value'))
+            if disableTable:
+                self.keycol.Enable(False)
         
         self.addbox = wx.CheckBox(parent = self.panel,
                                   label = _('Add created map into layer tree'), style = wx.NO_BORDER)
@@ -280,7 +283,8 @@
         self.OnElement(event)
         
     def OnTable(self, event):
-        self.keycol.Enable(event.IsChecked())
+        if self.keycol:
+            self.keycol.Enable(event.IsChecked())
         
     def _layout(self):
         """!Do layout"""
@@ -293,17 +297,18 @@
         
         self.dataSizer.Add(item = self.table, proportion = 0,
                       flag = wx.EXPAND | wx.ALL, border = 1)
-
-        keySizer = wx.BoxSizer(wx.HORIZONTAL)
-        keySizer.Add(item = wx.StaticText(parent = self.panel, label = _("Key column:")),
-                     proportion = 0,
-                     flag = wx.ALIGN_CENTER_VERTICAL)
-        keySizer.AddSpacer(10)
-        keySizer.Add(item = self.keycol, proportion = 0,
-                     flag = wx.ALIGN_RIGHT)
-        self.dataSizer.Add(item = keySizer, proportion = 1,
-                           flag = wx.EXPAND | wx.ALL, border = 1)
-
+        
+        if self.keycol:
+            keySizer = wx.BoxSizer(wx.HORIZONTAL)
+            keySizer.Add(item = wx.StaticText(parent = self.panel, label = _("Key column:")),
+                         proportion = 0,
+                         flag = wx.ALIGN_CENTER_VERTICAL)
+            keySizer.AddSpacer(10)
+            keySizer.Add(item = self.keycol, proportion = 0,
+                         flag = wx.ALIGN_RIGHT)
+            self.dataSizer.Add(item = keySizer, proportion = 1,
+                               flag = wx.EXPAND | wx.ALL, border = 1)
+            
         self.dataSizer.AddSpacer(5)
         
         self.dataSizer.Add(item = self.addbox, proportion = 0,
@@ -328,7 +333,9 @@
 
     def GetKey(self):
         """!Get key column name"""
-        return self.keycol.GetValue()
+        if self.keycol:
+            return self.keycol.GetValue()
+        return UserSettings.Get(group = 'atm', key = 'keycolumn', subkey = 'value')
     
     def IsChecked(self, key):
         """!Get dialog properties

Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp_vdigit.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp_vdigit.py	2011-11-11 13:56:20 UTC (rev 49180)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp_vdigit.py	2011-11-11 14:05:36 UTC (rev 49181)
@@ -170,7 +170,7 @@
                         self._geomAttrb(fid, addRecordDlg, 'area')
                         self._geomAttrb(fid, addRecordDlg, 'perimeter')
                 
-                if addRecordDlg.mapDBInfo and \
+                if addRecordDlg.IsFound() and \
                         addRecordDlg.ShowModal() == wx.ID_OK:
                     sqlfile = tempfile.NamedTemporaryFile(mode = "w")
                     for sql in addRecordDlg.GetSQLString():

Modified: grass/trunk/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/toolbars.py	2011-11-11 13:56:20 UTC (rev 49180)
+++ grass/trunk/gui/wxpython/gui_modules/toolbars.py	2011-11-11 14:05:36 UTC (rev 49181)
@@ -1046,7 +1046,7 @@
             dlg = CreateNewVector(self.parent,
                                   exceptMap = openVectorMap, log = self.log,
                                   cmd = (('v.edit',
-                                          { 'tool' : 'create' },
+                                          { 'flags' : 'b', 'tool' : 'create' },
                                           'map')),
                                   disableAdd = True)
             



More information about the grass-commit mailing list