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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 16 12:56:15 EDT 2010


Author: martinl
Date: 2010-08-16 16:56:15 +0000 (Mon, 16 Aug 2010)
New Revision: 43146

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py
Log:
wxGUI/nviz: fix fringes
(merge r43145 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py	2010-08-16 16:51:53 UTC (rev 43145)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py	2010-08-16 16:56:15 UTC (rev 43146)
@@ -297,7 +297,8 @@
         # fringe page
         self.notebookAppearance.AddPage(page = self._createFringePage(),
                                         text = " %s " % _("Fringe"))
-        
+        self.EnablePage('fringe', False)
+
         return self.notebookAppearance
     
     def _createSurfacePage(self):
@@ -1252,7 +1253,8 @@
         rboxSizer = wx.StaticBoxSizer(rbox, wx.VERTICAL)
         rmaps = gselect.Select(parent = panel, type = 'raster',
                                onPopup = self.GselectOnPopup)
-        self.win['fringe']['surface'] = rmaps.GetId()
+        rmaps.GetChildren()[0].Bind(wx.EVT_TEXT, self.OnSetSurface)
+        self.win['fringe']['map'] = rmaps.GetId()
         rboxSizer.Add(item = rmaps, proportion = 0,
                       flag = wx.ALL,
                       border = 3)
@@ -1322,7 +1324,8 @@
     def GetLayerData(self, nvizType):
         """!Get nviz data"""
         name = self.FindWindowById(self.win[nvizType]['map']).GetValue()
-        if nvizType == 'surface':
+        
+        if nvizType == 'surface' or nvizType == 'fringe':
             return self.mapWindow.GetLayerByName(name, mapType = 'raster', dataType = 'nviz')
         elif nvizType == 'vector':
             return self.mapWindow.GetLayerByName(name, mapType = 'vector', dataType = 'nviz')
@@ -1336,7 +1339,8 @@
         enabled = event.IsChecked()
         win = self.FindWindowById(event.GetId())
         
-        data = self.GetLayerData('surface')['surface']
+        data = self.GetLayerData('fringe')['surface']
+        
         sid = data['object']['id']
         elev = self.FindWindowById(self.win['fringe']['elev']).GetValue()
         color = self.FindWindowById(self.win['fringe']['color']).GetValue()
@@ -1492,6 +1496,18 @@
         if self.mapDisplay.statusbarWin['render'].IsChecked():
             self.mapWindow.Refresh(False)
         
+    def OnSetSurface(self, event):
+        """!Surface selected, currently used for fringes"""
+        name = event.GetString()
+        try:
+            data = self.mapWindow.GetLayerByName(name, mapType = 'raster', dataType = 'nviz')['surface']
+        except:
+            self.EnablePage('fringe', False)
+            return
+        
+        layer = self.mapWindow.GetLayerByName(name, mapType = 'raster')
+        self.EnablePage('fringe', True)
+        
     def OnSetRaster(self, event):
         """!Raster map selected, update surface page"""
         name = event.GetString()
@@ -1683,7 +1699,7 @@
     def EnablePage(self, name, enabled = True):
         """!Enable/disable all widgets on page"""
         for key, item in self.win[name].iteritems():
-            if key == 'map':
+            if key == 'map' or key == 'surface':
                 continue
             if type(item) == types.DictType:
                 for sitem in self.win[name][key].itervalues():



More information about the grass-commit mailing list