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

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


Author: martinl
Date: 2010-05-31 06:51:22 -0400 (Mon, 31 May 2010)
New Revision: 42407

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py
Log:
wxGUI/nviz: various fixes (after integration of tool window)
(merge r42405 & r42406 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py	2010-05-31 10:42:38 UTC (rev 42406)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py	2010-05-31 10:51:22 UTC (rev 42407)
@@ -266,6 +266,11 @@
             self.Bind(wx.EVT_MENU, self.OnPopupOpacityLevel, id=self.popupID8)
             self.popupMenu.Append(self.popupID3, text=_("Properties"))
             self.Bind(wx.EVT_MENU, self.OnPopupProperties, id=self.popupID3)
+            
+            if ltype in ('raster', 'vector', 'raster3d') and self.mapdisplay.toolbars['nviz']:
+                self.popupMenu.Append(self.popupID11, _("3D view properties"))
+                self.Bind (wx.EVT_MENU, self.OnNvizProperties, id=self.popupID11)
+            
             if ltype in ('raster', 'vector', 'rgb'):
                 self.popupMenu.Append(self.popupID9, text=_("Zoom to selected map(s)"))
                 self.Bind(wx.EVT_MENU, self.mapdisplay.MapWindow.OnZoomToMap, id=self.popupID9)
@@ -358,7 +363,7 @@
             self.popupMenu.Append(self.popupID6, _("Metadata"))
             self.Bind (wx.EVT_MENU, self.OnMetadata, id=self.popupID6)
             if self.mapdisplay.toolbars['nviz']:
-                self.popupMenu.Append(self.popupID11, _("Nviz properties"))
+                self.popupMenu.Append(self.popupID11, _("3D view properties"))
                 self.Bind (wx.EVT_MENU, self.OnNvizProperties, id=self.popupID11)
 
             if numSelected > 1:
@@ -592,11 +597,15 @@
 
         @todo vector/volume
         """
-        if not self.mapdisplay.nvizToolWin.IsShown():
-            self.mapdisplay.nvizToolWin.Show()
-
-        self.mapdisplay.nvizToolWin.SetPage('surface')
-
+        self.lmgr.notebook.SetSelection(3)
+        ltype = self.GetPyData(self.layer_selected)[0]['type']
+        if ltype == 'raster':
+            self.lmgr.nviz.SetPage('surface')
+        elif ltype == 'vector':
+            self.lmgr.nviz.SetPage('vector')
+        elif ltype == 'raster3d':
+            self.lmgr.nviz.SetPage('volume')
+        
     def RenameLayer (self, event):
         """!Rename layer"""
         self.EditLabel(self.layer_selected)
@@ -1029,8 +1038,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'])
@@ -1121,21 +1130,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/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2010-05-31 10:42:38 UTC (rev 42406)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2010-05-31 10:51:22 UTC (rev 42407)
@@ -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/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py	2010-05-31 10:42:38 UTC (rev 42406)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py	2010-05-31 10:51:22 UTC (rev 42407)
@@ -218,8 +218,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'],
@@ -417,7 +417,7 @@
                 except gcmd.NvizError, e:
                     print >> sys.stderr, "Nviz:" + e.message
                 
-                self.parent.nvizToolWin.UpdateSettings()        
+                self._layermanager.nviz.UpdateSettings()        
         
         stop = time.time()
         
@@ -536,9 +536,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'])
@@ -598,9 +598,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))
@@ -657,9 +657,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')
@@ -704,9 +704,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/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py	2010-05-31 10:42:38 UTC (rev 42406)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py	2010-05-31 10:51:22 UTC (rev 42407)
@@ -1948,7 +1948,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):
@@ -2008,7 +2008,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')
 
@@ -2069,7 +2069,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()
@@ -2127,7 +2127,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):
@@ -2198,7 +2198,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):
@@ -2227,7 +2227,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):
@@ -2280,7 +2280,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):
@@ -2299,7 +2299,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):
@@ -2321,7 +2321,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):
@@ -2409,7 +2409,7 @@
         # update buttons
         self.UpdateIsosurfButtons(list)
         
-        if self.parent.statusbarWin['render'].IsChecked():
+        if self.mapDisplay.statusbarWin['render'].IsChecked():
             self.mapWindow.Refresh(False)
         
         event.Skip()
@@ -2437,7 +2437,7 @@
         # update buttons
         self.UpdateIsosurfButtons(list)
         
-        if self.parent.statusbarWin['render'].IsChecked():
+        if self.mapDisplay.statusbarWin['render'].IsChecked():
             self.mapWindow.Refresh(False)
         
         event.Skip()
@@ -2467,7 +2467,7 @@
         # update buttons
         self.UpdateIsosurfButtons(list)
         
-        if self.parent.statusbarWin['render'].IsChecked():
+        if self.mapDisplay.statusbarWin['render'].IsChecked():
             self.mapWindow.Refresh(False)
         
         event.Skip()
@@ -2497,7 +2497,7 @@
         # update buttons
         self.UpdateIsosurfButtons(list)
         
-        if self.parent.statusbarWin['render'].IsChecked():
+        if self.mapDisplay.statusbarWin['render'].IsChecked():
             self.mapWindow.Refresh(False)
         
         event.Skip()
@@ -2641,7 +2641,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