[GRASS-SVN] r47940 - in grass/trunk/gui/wxpython: . gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 29 10:48:33 EDT 2011


Author: annakrat
Date: 2011-08-29 07:48:33 -0700 (Mon, 29 Aug 2011)
New Revision: 47940

Modified:
   grass/trunk/gui/wxpython/gui_modules/gdialogs.py
   grass/trunk/gui/wxpython/gui_modules/layertree.py
   grass/trunk/gui/wxpython/gui_modules/mapdisp.py
   grass/trunk/gui/wxpython/gui_modules/toolbars.py
   grass/trunk/gui/wxpython/wxgui.py
Log:
wxNviz: fix bug made when nviz toolbar was moved

Modified: grass/trunk/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gdialogs.py	2011-08-29 13:14:38 UTC (rev 47939)
+++ grass/trunk/gui/wxpython/gui_modules/gdialogs.py	2011-08-29 14:48:33 UTC (rev 47940)
@@ -496,7 +496,7 @@
             resize.SetToolTipString(_("Click and drag on the map display to set legend"
                                         " size and position and then press OK"))
             resize.SetName('resize')
-            if self.parent.toolbars['nviz']:
+            if self.parent.IsPaneShown('3d'):
                 resize.Disable()
             box.Add(item=resize, proportion=0, flag=wx.ALIGN_CENTRE|wx.ALL, border=5)
             sizer.Add(item=box, proportion=0,
@@ -626,7 +626,7 @@
         self.parent.Map.GetOverlay(self.ovlId).SetActive(self.chkbox.IsChecked())
 
         # update map
-        if self.parent.MapWindow.parent.toolbars['nviz']:
+        if self.parent.IsPaneShown('3d'):
             self.parent.MapWindow.UpdateOverlays()
         
         self.parent.MapWindow.UpdateMap()

Modified: grass/trunk/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/layertree.py	2011-08-29 13:14:38 UTC (rev 47939)
+++ grass/trunk/gui/wxpython/gui_modules/layertree.py	2011-08-29 14:48:33 UTC (rev 47940)
@@ -290,7 +290,7 @@
                 self.popupMenu.Enable(self.popupID['opacity'], False)
                 self.popupMenu.Enable(self.popupID['properties'], False)
             
-            if ltype in ('raster', 'vector', '3d-raster') and self.mapdisplay.toolbars['nviz']:
+            if ltype in ('raster', 'vector', '3d-raster') and self.lmgr.IsPaneShown('toolbarNviz'):
                 self.popupMenu.Append(self.popupID['nviz'], _("3D view properties"))
                 self.Bind (wx.EVT_MENU, self.OnNvizProperties, id = self.popupID['nviz'])
             
@@ -1081,7 +1081,7 @@
         #
         # nviz
         #
-        if self.mapdisplay.toolbars['nviz'] and \
+        if self.lmgr.IsPaneShown('toolbarNviz') and \
                 self.GetPyData(item) is not None:
             # nviz - load/unload data layer
             mapLayer = self.GetPyData(item)[0]['maplayer']
@@ -1131,7 +1131,7 @@
         #
         # nviz
         #
-        if self.mapdisplay.toolbars['nviz'] and \
+        if self.lmgr.IsPaneShown('toolbarNviz') and \
                 self.GetPyData(item) is not None:
             # nviz - load/unload data layer
             mapLayer = self.GetPyData(item)[0]['maplayer']
@@ -1242,7 +1242,7 @@
                                                     render = render)
         
         # update nviz tools
-        if self.mapdisplay.toolbars['nviz'] and \
+        if self.lmgr.IsPaneShown('toolbarNviz') and \
                 self.GetPyData(self.layer_selected) is not None:
             if self.layer_selected.IsChecked():
                 # update Nviz tool window
@@ -1282,7 +1282,7 @@
             self.OnDrop(dropTarget, self._dragItem)
         elif dropTarget == None:
             self.OnDrop(dropTarget, self._dragItem)
-
+            
     def OnDrop(self, dropTarget, dragItem):
         # save everthing associated with item to drag
         try:
@@ -1454,7 +1454,7 @@
                                                     render = render)
         
         # update nviz session        
-        if self.mapdisplay.toolbars['nviz'] and dcmd:
+        if self.lmgr.IsPaneShown('toolbarNviz') and dcmd:
             mapLayer = self.GetPyData(layer)[0]['maplayer']
             mapWin = self.mapdisplay.MapWindow
             if len(mapLayer.GetCmd()) > 0:

Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2011-08-29 13:14:38 UTC (rev 47939)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2011-08-29 14:48:33 UTC (rev 47940)
@@ -429,6 +429,7 @@
     
     def RemoveNviz(self):
         """!Restore 2D view"""
+        self.toolbars['map'].RemoveTool(self.toolbars['map'].rotate)
         # update status bar
         self.statusbarWin['toggle'].Enable(True)
         self.statusbar.SetStatusText(_("Please wait, unloading data..."), 0)
@@ -513,7 +514,9 @@
     
     def IsPaneShown(self, name):
         """!Check if pane (toolbar, mapWindow ...) of given name is currently shown"""
-        return self._mgr.GetPane(name).IsShown()
+        if self._mgr.GetPane(name).IsOk():
+            return self._mgr.GetPane(name).IsShown()
+        return False
     
     def _initDisplay(self):
         """!Initialize map display, set dimensions and map region
@@ -1126,7 +1129,7 @@
     def SaveToFile(self, event):
         """!Save map to image
         """
-        if self.toolbars['nviz']:
+        if self.IsPaneShown('3d'):
             filetype = "PPM file (*.ppm)|*.ppm|TIF file (*.tif)|*.tif"
             ltype = [{ 'ext' : 'ppm', 'type' : 'ppm' },
                      { 'ext' : 'tif', 'type' : 'tif' }]
@@ -1207,10 +1210,9 @@
             maplayer = self.toolbars['vdigit'].GetLayer()
             if maplayer:
                 self.toolbars['vdigit'].OnExit()
+        if self.IsPaneShown('3d'):
+            self.RemoveNviz()
         
-        if self.toolbars['nviz']:
-            self.toolbars['nviz'].OnExit()
-        
         if not self._layerManager:
             self.Destroy()
         elif self.page:
@@ -1690,7 +1692,7 @@
         decmenu.AppendItem(AddScale)
         self.Bind(wx.EVT_MENU, self.OnAddBarscale, AddScale)
         # temporary
-        if self.toolbars['nviz']:
+        if self.IsPaneShown('3d'):
             AddScale.Enable(False)
             AddArrow = wx.MenuItem(decmenu, wx.ID_ANY, _("Add north arrow"))
             AddArrow.SetBitmap(icons["addBarscale"].GetBitmap(self.iconsize))

Modified: grass/trunk/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/toolbars.py	2011-08-29 13:14:38 UTC (rev 47939)
+++ grass/trunk/gui/wxpython/gui_modules/toolbars.py	2011-08-29 14:48:33 UTC (rev 47940)
@@ -371,7 +371,6 @@
         if self.parent.toolbars['vdigit']:
             self.parent.toolbars['vdigit'].OnExit()
         if self.parent.GetLayerManager().IsPaneShown('toolbarNviz'):
-            self.RemoveTool(self.rotate)
             self.parent.RemoveNviz()
         
     def Enable2D(self, enabled):

Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py	2011-08-29 13:14:38 UTC (rev 47939)
+++ grass/trunk/gui/wxpython/wxgui.py	2011-08-29 14:48:33 UTC (rev 47940)
@@ -240,7 +240,9 @@
     
     def IsPaneShown(self, name):
         """!Check if pane (toolbar, ...) of given name is currently shown"""
-        return self._auimgr.GetPane(name).IsShown()
+        if self._auimgr.GetPane(name).IsOk():
+            return self._auimgr.GetPane(name).IsShown()
+        return False
     
     def _createNoteBook(self):
         """!Creates notebook widgets"""



More information about the grass-commit mailing list