[GRASS-SVN] r43011 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Aug 6 17:53:48 EDT 2010
Author: martinl
Date: 2010-08-06 21:53:48 +0000 (Fri, 06 Aug 2010)
New Revision: 43011
Modified:
grass/trunk/gui/wxpython/gui_modules/mapdisp.py
grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
grass/trunk/gui/wxpython/gui_modules/wxnviz.py
Log:
wxGUI/nviz: redirect messages/progress info
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2010-08-05 16:17:13 UTC (rev 43010)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2010-08-06 21:53:48 UTC (rev 43011)
@@ -404,7 +404,8 @@
# erase map window
self.MapWindow.EraseMap()
-
+
+ self._layerManager.goutput.WriteCmdLog(_("Starting 3D view mode..."))
self.statusbar.SetStatusText(_("Please wait, loading data..."), 0)
# create GL window & NVIZ toolbar
Modified: grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py 2010-08-05 16:17:13 UTC (rev 43010)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py 2010-08-06 21:53:48 UTC (rev 43011)
@@ -56,9 +56,9 @@
self._display = None
self.setDaemon(True)
-
+
def run(self):
- self._display = wxnviz.Nviz(self.log)
+ self._display = wxnviz.Nviz(self.log, self.progressbar)
def GetDisplay(self):
"""!Get display instance"""
@@ -104,6 +104,7 @@
else:
self.log = logmsg = sys.stdout
logerr = sys.stderr
+
self.nvizThread = NvizThread(logerr,
self.parent.statusbarWin['progress'],
logmsg)
Modified: grass/trunk/gui/wxpython/gui_modules/wxnviz.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxnviz.py 2010-08-05 16:17:13 UTC (rev 43010)
+++ grass/trunk/gui/wxpython/gui_modules/wxnviz.py 2010-08-06 21:53:48 UTC (rev 43011)
@@ -32,17 +32,48 @@
from debug import Debug
+log = None
+progress = None
+
+def print_error(msg, type):
+ """!Redirect stderr"""
+ global log
+ if log:
+ log.write(msg)
+ else:
+ print msg
+
+ return 0
+
+def print_progress(value):
+ """!Redirect progress info"""
+ global progress
+ if progress:
+ progress.SetValue(value)
+ else:
+ print value
+
+ return 0
+
+errtype = CFUNCTYPE(UNCHECKED(c_int), String, c_int)
+errfunc = errtype(print_error)
+
+pertype = CFUNCTYPE(UNCHECKED(c_int), c_int)
+perfunc = pertype(print_progress)
+
class Nviz(object):
- def __init__(self, log):
+ def __init__(self, glog, gprogress):
"""!Initialize Nviz class instance
@param log logging area
"""
- self.log = log
+ global errfunc, perfunc, log, progress
+ log = glog
+ progress = gprogress
G_gisinit("")
- # G_set_error_routine(&print_error)
- # G_set_percent_routine(poiter(print_percent))
+ G_set_error_routine(errfunc)
+ G_set_percent_routine(perfunc)
GS_libinit()
GVL_libinit()
@@ -56,8 +87,8 @@
def __del__(self):
"""!Destroy Nviz class instance"""
- # G_unset_error_routine()
- # G_unset_percent_routine()
+ G_unset_error_routine()
+ G_unset_percent_routine()
del self.data
del self.data_obj
self.log = None
More information about the grass-commit
mailing list