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

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jan 1 23:19:37 EST 2009


Author: cmbarton
Date: 2009-01-01 23:19:37 -0500 (Thu, 01 Jan 2009)
New Revision: 35157

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py
Log:
Improved control to switch between different display modes (2D, 3D, and digitize). Added closing code for nviz window.

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2009-01-01 23:25:13 UTC (rev 35156)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2009-01-02 04:19:37 UTC (rev 35157)
@@ -3376,13 +3376,15 @@
         pgnum = None
         self.Map.Clean()
         
-        # close edited map properly
-        digitToolbar = self.toolbars['vdigit']
-        if digitToolbar:
-            maplayer = digitToolbar.GetLayer()
+        # close edited map and 3D tools properly
+        if self.toolbars['vdigit']:
+            maplayer = self.toolbars['vdigit'].GetLayer()
             if maplayer:
                 self.toolbars['vdigit'].OnExit()
                 self.imgVectorMap = None
+
+        if self.toolbars['nviz']:
+            self.toolbars['nviz'].OnExit()
         
         if self.page:
             pgnum = self.layerbook.GetPageIndex(self.page)

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py	2009-01-01 23:25:13 UTC (rev 35156)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py	2009-01-02 04:19:37 UTC (rev 35157)
@@ -150,8 +150,9 @@
         self.InitToolbar(self.mapdisplay, self.toolbar, self.ToolbarData())
         
         # optional tools
-        self.combo = wx.ComboBox(parent=self.toolbar, id=wx.ID_ANY, value='Tools',
-                                 choices=['Digitize', 'Nviz'], style=wx.CB_READONLY, size=(90, -1))
+        self.combo = wx.ComboBox(parent=self.toolbar, id=wx.ID_ANY, value='2D map',
+                                 choices=['2D map', '3D map', 'Digitize'], 
+                                 style=wx.CB_READONLY, size=(90, -1))
 
         self.comboid = self.toolbar.AddControl(self.combo)
         self.mapdisplay.Bind(wx.EVT_COMBOBOX, self.OnSelectTool, self.comboid)
@@ -243,12 +244,24 @@
         Select / enable tool available in tools list
         """
         tool =  event.GetString()
+        
+        if tool == "2D map":
+            self.ExitToolbars()
+            self.Enable2D(True)
 
-        if tool == "Digitize" and not self.mapdisplay.toolbars['vdigit']:
+        elif tool == "3D map" and not self.mapdisplay.toolbars['nviz']:
+            self.ExitToolbars()
+            self.mapdisplay.AddToolbar("nviz")
+            
+        elif tool == "Digitize" and not self.mapdisplay.toolbars['vdigit']:
+            self.ExitToolbars()
             self.mapdisplay.AddToolbar("vdigit")
 
-        elif tool == "Nviz" and not self.mapdisplay.toolbars['nviz']:
-            self.mapdisplay.AddToolbar("nviz")
+    def ExitToolbars(self):
+        if self.mapdisplay.toolbars['vdigit']:
+            self.mapdisplay.toolbars['vdigit'].OnExit()
+        if self.mapdisplay.toolbars['nviz']:       
+            self.mapdisplay.toolbars['nviz'].OnExit()
 
     def Enable2D(self, enabled):
         """Enable/Disable 2D display mode specific tools"""
@@ -1325,6 +1338,15 @@
     def OnExit (self, event=None):
         """Quit nviz tool (swith to 2D mode)"""
 
+        # hide dialogs if still open
+        if self.parent.nvizToolWin:
+            self.parent.nvizToolWin.Hide()
+
         # disable the toolbar
         self.parent.RemoveToolbar ("nviz")
 
+        # set default mouse settings
+        self.parent.MapWindow.mouse['use'] = "pointer"
+        self.parent.MapWindow.mouse['box'] = "point"
+        self.parent.MapWindow.polycoords = []
+



More information about the grass-commit mailing list