[GRASS-SVN] r35742 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 2 16:31:18 EST 2009


Author: martinl
Date: 2009-02-02 16:31:17 -0500 (Mon, 02 Feb 2009)
New Revision: 35742

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gcmd.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/sqlbuilder.py
Log:
wxGUI: remove unused methods of gcmd.Command
       (merge from trunk r35741)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gcmd.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gcmd.py	2009-02-02 21:29:25 UTC (rev 35741)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gcmd.py	2009-02-02 21:31:17 UTC (rev 35742)
@@ -358,11 +358,11 @@
                                     os.linesep, os.linesep,
                                     _("Details:"),
                                     os.linesep,
-                                    _("Error: ") + self.GetError()))
+                                    _("Error: ") + self.__GetError()))
                 elif rerr == sys.stderr: # redirect message to sys
                     stderr.write("Execution failed: '%s'" % (' '.join(self.cmd)))
                     stderr.write("%sDetails:%s%s" % (os.linesep,
-                                                     _("Error: ") + self.GetError(),
+                                                     _("Error: ") + self.__GetError(),
                                                      os.linesep))
             else:
                 pass # nop
@@ -394,17 +394,7 @@
 
         return lineList
                     
-    def ReadStdOutput(self):
-        """Read standard output and return list of lines"""
-        if self.cmdThread.stdout:
-            stream = self.cmdThread.stdout # use redirected stream instead
-            stream.seek(0)
-        else:
-            stream = self.cmdThread.module.stdout
-
-        return self.__ReadOutput(stream)
-    
-    def ReadErrOutput(self):
+    def __ReadErrOutput(self):
         """Read standard error output and return list of lines"""
         return self.__ReadOutput(self.cmdThread.module.stderr)
 
@@ -415,7 +405,7 @@
         @return list of (type, message)
         """
         if self.stderr is None:
-            lines = self.ReadErrOutput()
+            lines = self.__ReadErrOutput()
         else:
             lines = self.cmdThread.error.strip('%s' % os.linesep). \
                 split('%s' % os.linesep)
@@ -444,7 +434,7 @@
 
         return msg
 
-    def GetError(self):
+    def __GetError(self):
         """Get error message or ''"""
         if not self.cmdThread.module:
             return _("Unable to exectute command: '%s'") % ' '.join(self.cmd)
@@ -455,28 +445,6 @@
 
         return ''
     
-    def PrintModuleOutput(self, error=True, warning=False, message=False):
-        """Print module errors, warnings, messages to output
-
-        @param error print errors
-        @param warning print warnings
-        @param message print messages
-
-        @return string
-        """
-
-        msgString = ""
-        for type, msg in self.__ProcessStdErr():
-            if type:
-                if (type == 'ERROR' and error) or \
-                        (type == 'WARNING' and warning) or \
-                        (type == 'MESSAGE' and message):
-                    msgString += " " + type + ": " + msg + "%s" % os.linesep
-            else:
-                msgString += " " + msg + "%s" % os.linesep
-
-        return msgString
-
 class CommandThread(Thread):
     """Create separate thread for command
 

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py	2009-02-02 21:29:25 UTC (rev 35741)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py	2009-02-02 21:31:17 UTC (rev 35742)
@@ -1009,16 +1009,17 @@
             ret = gcmd.RunCommand('v.in.dxf',
                                   quiet = True,
                                   parent = self,
+                                  read = True,
                                   flags = 'l',
                                   input = path)
-            if ret != 0:
+            if not ret:
                 self.list.LoadData()
                 self.btn_run.Enable(False)
                 return
 
         data = []
         if self.inputType == 'dxf':
-            for line in cmd.ReadStdOutput():
+            for line in ret.splitlines():
                 layerId = line.split(':')[0].split(' ')[1]
                 layerName = line.split(':')[1].strip()
                 grassName = utils.GetValidLayerName(layerName)

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/sqlbuilder.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/sqlbuilder.py	2009-02-02 21:29:25 UTC (rev 35741)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/sqlbuilder.py	2009-02-02 21:31:17 UTC (rev 35742)
@@ -220,13 +220,14 @@
 
     def GetColumns(self):
         """Get columns"""
-        dbDescribe = gcmd.RunCommand('db.describe',
-                                     quiet = True,
-                                     flags = 'c',
-                                     table = self.tablename)
+        ret = gcmd.RunCommand('db.describe',
+                              quiet = True,
+                              read = True,
+                              flags = 'c',
+                              table = self.tablename)
         
         # skip ncols and nrows lines
-        for line in dbDescribe.ReadStdOutput()[2:]:
+        for line in ret.splitlines():
             num, name, ctype, length = line.strip().split(":")
             name.strip()
             #self.columns_names.append(name)



More information about the grass-commit mailing list