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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon May 31 06:36:51 EDT 2010


Author: martinl
Date: 2010-05-31 06:36:40 -0400 (Mon, 31 May 2010)
New Revision: 42405

Modified:
   grass/trunk/gui/wxpython/gui_modules/layertree.py
   grass/trunk/gui/wxpython/gui_modules/mapdisp.py
   grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
   grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
Log:
wxGUI/nviz: various fixes (after integration of tool window)


Modified: grass/trunk/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/layertree.py	2010-05-31 10:13:00 UTC (rev 42404)
+++ grass/trunk/gui/wxpython/gui_modules/layertree.py	2010-05-31 10:36:40 UTC (rev 42405)
@@ -594,11 +594,9 @@
 
         @todo vector/volume
         """
-        if not self.mapdisplay.nvizToolWin.IsShown():
-            self.mapdisplay.nvizToolWin.Show()
+        self.lmgr.notebook.SetSelection(3)
+        self.lmgr.nviz.SetPage('surface')
 
-        self.mapdisplay.nvizToolWin.SetPage('surface')
-
     def RenameLayer (self, event):
         """!Rename layer"""
         self.EditLabel(self.layer_selected)
@@ -1031,8 +1029,8 @@
                 elif mapLayer.type == 'vector':
                     self.mapdisplay.MapWindow.UnloadVector(item)
                     
-                    if hasattr(self.mapdisplay, "nvizToolWin"):
-                        toolWin = self.mapdisplay.nvizToolWin
+                    if hasattr(self.parent, "nviz"):
+                        toolWin = self.lmgr.nviz
                         # remove vector page
                         if toolWin.notebook.GetSelection() == toolWin.page['vector']['id']:
                             toolWin.notebook.RemovePage(toolWin.page['vector']['id'])
@@ -1123,21 +1121,21 @@
                 type = self.GetPyData(self.layer_selected)[0]['maplayer'].type
 
                 if type == 'raster':
-                    self.mapdisplay.nvizToolWin.UpdatePage('surface')
-                    self.mapdisplay.nvizToolWin.SetPage('surface')
+                    self.lmgr.nviz.UpdatePage('surface')
+                    self.lmgr.nviz.SetPage('surface')
                 elif type == 'vector':
-                    self.mapdisplay.nvizToolWin.UpdatePage('vector')
-                    self.mapdisplay.nvizToolWin.SetPage('vector')
+                    self.lmgr.nviz.UpdatePage('vector')
+                    self.lmgr.nviz.SetPage('vector')
                 elif type == '3d-raster':
-                    self.mapdisplay.nvizToolWin.UpdatePage('volume')
-                    self.mapdisplay.nvizToolWin.SetPage('volume')
+                    self.lmgr.nviz.UpdatePage('volume')
+                    self.lmgr.nviz.SetPage('volume')
             else:
                 for page in ('surface', 'vector', 'volume'):
-                    pageId = self.mapdisplay.nvizToolWin.page[page]['id']
+                    pageId = self.lmgr.nviz.page[page]['id']
                     if pageId > -1:
-                        self.mapdisplay.nvizToolWin.notebook.RemovePage(pageId)
-                        self.mapdisplay.nvizToolWin.page[page]['id'] = -1
-                        self.mapdisplay.nvizToolWin.page['settings']['id'] = 1 
+                        self.lmgr.nviz.notebook.RemovePage(pageId)
+                        self.lmgr.nviz.page[page]['id'] = -1
+                        self.lmgr.nviz.page['settings']['id'] = 1 
 
     def OnCollapseNode(self, event):
         """!Collapse node

Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2010-05-31 10:13:00 UTC (rev 42404)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2010-05-31 10:36:40 UTC (rev 42405)
@@ -546,7 +546,10 @@
                                              subkey = 'precision'))
             format = UserSettings.Get(group = 'projection', key = 'format',
                                       subkey = 'll')
-            e, n = self.MapWindow.Pixel2Cell(event.GetPositionTuple())
+            try:
+                e, n = self.MapWindow.Pixel2Cell(event.GetPositionTuple())
+            except AttributeError:
+                return
             if self.toolbars['vdigit'] and \
                     self.toolbars['vdigit'].GetAction() == 'addLine' and \
                     self.toolbars['vdigit'].GetAction('type') in ('line', 'boundary') and \

Modified: grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py	2010-05-31 10:13:00 UTC (rev 42404)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py	2010-05-31 10:36:40 UTC (rev 42405)
@@ -220,8 +220,8 @@
                 self.view['persp']['value'] = 100
             
             if prev_value !=  self.view['persp']['value']:
-                if hasattr(self.parent, "nvizToolWin"):
-                    self.parent.nvizToolWin.UpdateSettings()
+                if hasattr(self._layermanager, "nviz"):
+                    self._layermanager.nviz.UpdateSettings()
 
                     self._display.SetView(self.view['pos']['x'], self.view['pos']['y'],
                                           self.iview['height']['value'],
@@ -419,7 +419,7 @@
                 except gcmd.NvizError, e:
                     print >> sys.stderr, "Nviz:" + e.message
                 
-                self.parent.nvizToolWin.UpdateSettings()        
+                self._layermanager.nviz.UpdateSettings()        
         
         stop = time.time()
         
@@ -538,9 +538,9 @@
         wx.PostEvent(self, event)
         
         # update tools window
-        if hasattr(self.parent, "nvizToolWin") and \
+        if hasattr(self._layermanager, "nviz") and \
                 item ==  self.GetSelectedLayer(type = 'item'):
-            toolWin = self.parent.nvizToolWin
+            toolWin = self._layermanager.nviz
             if layer.type ==  'raster':
                 win = toolWin.FindWindowById( \
                     toolWin.win['vector']['lines']['surface'])
@@ -600,9 +600,9 @@
         self.layers.remove(item)
         
         # update tools window
-        if hasattr(self.parent, "nvizToolWin") and \
+        if hasattr(self._layermanager, "nviz") and \
                 layer.type ==  'raster':
-            toolWin = self.parent.nvizToolWin
+            toolWin = self._layermanager.nviz
             win = toolWin.FindWindowById( \
                 toolWin.win['vector']['lines']['surface'])
             win.SetItems(self.GetLayerNames(layer.type))
@@ -659,9 +659,9 @@
         wx.PostEvent(self, event)
         
         # update tools window
-        if hasattr(self.parent, "nvizToolWin") and \
+        if hasattr(self._layermanager, "nviz") and \
                 item ==  self.GetSelectedLayer(type = 'item'):
-            toolWin = self.parent.nvizToolWin
+            toolWin = self._layermanager.nviz
             
             toolWin.UpdatePage('vector')
             toolWin.SetPage('vector')
@@ -706,9 +706,9 @@
             self.layers.remove(id)
         
         # update tools window
-        if hasattr(self.parent, "nvizToolWin") and \
+        if hasattr(self._layermanager, "nviz") and \
                 vecType is None:
-            toolWin = self.parent.nvizToolWin
+            toolWin = self._layermanager.nviz
             # remove surface page
             if toolWin.notebook.GetSelection() ==  toolWin.page['surface']['id']:
                 toolWin.notebook.RemovePage(toolWin.page['surface']['id'])

Modified: grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_tools.py	2010-05-31 10:13:00 UTC (rev 42404)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_tools.py	2010-05-31 10:36:40 UTC (rev 42405)
@@ -1949,7 +1949,7 @@
         event = wxUpdateProperties(data = data)
         wx.PostEvent(self.mapWindow, event)
         
-        if self.parent.statusbarWin['render'].IsChecked():
+        if self.mapDisplay.statusbarWin['render'].IsChecked():
             self.mapWindow.Refresh(False)
         
     def OnSurfaceAxis(self, event):
@@ -2009,7 +2009,7 @@
         event = wxUpdateProperties(data = data)
         wx.PostEvent(self.mapWindow, event)
         
-        if self.parent.statusbarWin['render'].IsChecked():
+        if self.mapDisplay.statusbarWin['render'].IsChecked():
             self.mapWindow.Refresh(False)
         #        self.UpdatePage('surface')
 
@@ -2070,7 +2070,7 @@
                 event = wxUpdateProperties(data = data)
                 wx.PostEvent(self.mapWindow, event)
         
-        if self.parent.statusbarWin['render'].IsChecked():
+        if self.mapDisplay.statusbarWin['render'].IsChecked():
             self.mapWindow.Refresh(False)
         
         event.Skip()
@@ -2128,7 +2128,7 @@
         event = wxUpdateProperties(data = data)
         wx.PostEvent(self.mapWindow, event)
                         
-        if self.parent.statusbarWin['render'].IsChecked():
+        if self.mapDisplay.statusbarWin['render'].IsChecked():
             self.mapWindow.Refresh(False)
         
     def OnVectorHeight(self, event):
@@ -2199,7 +2199,7 @@
         event = wxUpdateProperties(data = data)
         wx.PostEvent(self.mapWindow, event)
         
-        if self.parent.statusbarWin['render'].IsChecked():
+        if self.mapDisplay.statusbarWin['render'].IsChecked():
             self.mapWindow.Refresh(False)
         
     def OnVectorPoints(self, event):
@@ -2228,7 +2228,7 @@
         event = wxUpdateProperties(data = data)
         wx.PostEvent(self.mapWindow, event)
         
-        if self.parent.statusbarWin['render'].IsChecked():
+        if self.mapDisplay.statusbarWin['render'].IsChecked():
             self.mapWindow.Refresh(False)
 
     def UpdateIsosurfButtons(self, list):
@@ -2281,7 +2281,7 @@
         
         self._display.SetIsosurfaceMode(id, mode)
         
-        if self.parent.statusbarWin['render'].IsChecked():
+        if self.mapDisplay.statusbarWin['render'].IsChecked():
             self.mapWindow.Refresh(False)
         
     def OnVolumeIsosurfResolution(self, event):
@@ -2300,7 +2300,7 @@
         id = data['object']['id']
         self._display.SetIsosurfaceRes(id, res)
         
-        if self.parent.statusbarWin['render'].IsChecked():
+        if self.mapDisplay.statusbarWin['render'].IsChecked():
             self.mapWindow.Refresh(False)
         
     def OnVolumeIsosurfMap(self, event):
@@ -2322,7 +2322,7 @@
             # disable -> make transparent
             self._display.SetIsosurfaceTransp(id, isosurfId, False, "255")
         
-        if self.parent.statusbarWin['render'].IsChecked():
+        if self.mapDisplay.statusbarWin['render'].IsChecked():
             self.mapWindow.Refresh(False)
         
     def OnVolumeIsosurfSelect(self, event):
@@ -2410,7 +2410,7 @@
         # update buttons
         self.UpdateIsosurfButtons(list)
         
-        if self.parent.statusbarWin['render'].IsChecked():
+        if self.mapDisplay.statusbarWin['render'].IsChecked():
             self.mapWindow.Refresh(False)
         
         event.Skip()
@@ -2438,7 +2438,7 @@
         # update buttons
         self.UpdateIsosurfButtons(list)
         
-        if self.parent.statusbarWin['render'].IsChecked():
+        if self.mapDisplay.statusbarWin['render'].IsChecked():
             self.mapWindow.Refresh(False)
         
         event.Skip()
@@ -2468,7 +2468,7 @@
         # update buttons
         self.UpdateIsosurfButtons(list)
         
-        if self.parent.statusbarWin['render'].IsChecked():
+        if self.mapDisplay.statusbarWin['render'].IsChecked():
             self.mapWindow.Refresh(False)
         
         event.Skip()
@@ -2498,7 +2498,7 @@
         # update buttons
         self.UpdateIsosurfButtons(list)
         
-        if self.parent.statusbarWin['render'].IsChecked():
+        if self.mapDisplay.statusbarWin['render'].IsChecked():
             self.mapWindow.Refresh(False)
         
         event.Skip()
@@ -2642,7 +2642,7 @@
         
         npoints = nprimitives = 0
         for line in vInfo.splitlines():
-            key, value = line.split(' = ')
+            key, value = line.split('=')
             if key == 'map3d':
                 mapIs3D = int(value)
             



More information about the grass-commit mailing list