[GRASS-SVN] r32711 - in grass/trunk/gui/wxpython: gui_modules nviz

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Aug 12 05:39:21 EDT 2008


Author: martinl
Date: 2008-08-12 05:39:20 -0400 (Tue, 12 Aug 2008)
New Revision: 32711

Modified:
   grass/trunk/gui/wxpython/gui_modules/nviz.py
   grass/trunk/gui/wxpython/gui_modules/toolbars.py
   grass/trunk/gui/wxpython/nviz/nviz_types.i
Log:
wxGUI vdigit toolbar cosmetics, update r32684
nviz minor updates
(merge from devbr6, r32710)


Modified: grass/trunk/gui/wxpython/gui_modules/nviz.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz.py	2008-08-12 09:35:52 UTC (rev 32710)
+++ grass/trunk/gui/wxpython/gui_modules/nviz.py	2008-08-12 09:39:20 UTC (rev 32711)
@@ -1865,18 +1865,25 @@
         
         # buttons (add, delete, move up, move down)
         btnAdd = wx.Button(parent=panel, id=wx.ID_ADD)
+        self.win['volume']['btnIsoSurfAdd'] = btnAdd.GetId()
         btnAdd.Bind(wx.EVT_BUTTON, self.OnVolumeIsosurfAdd)
         gridSizer.Add(item=btnAdd,
                       pos=(0, 1))
         btnDelete = wx.Button(parent=panel, id=wx.ID_DELETE)
+        self.win['volume']['btnIsosurfDelete'] = btnDelete.GetId()
+        btnDelete.Bind(wx.EVT_BUTTON, self.OnVolumeIsosurfDelete)
         btnDelete.Enable(False)
         gridSizer.Add(item=btnDelete,
                       pos=(1, 1))
         btnMoveUp = wx.Button(parent=panel, id=wx.ID_UP)
+        self.win['volume']['btnIsosurfMoveUp'] = btnMoveUp.GetId()
+        btnMoveUp.Bind(wx.EVT_BUTTON, self.OnVolumeIsosurfMoveUp)
         btnMoveUp.Enable(False)
         gridSizer.Add(item=btnMoveUp,
                       pos=(2, 1))
         btnMoveDown = wx.Button(parent=panel, id=wx.ID_DOWN)
+        self.win['volume']['btnIsosurfMoveDown'] = btnMoveDown.GetId()
+        btnMoveDown.Bind(wx.EVT_BUTTON, self.OnVolumeIsosurfMoveDown)
         btnMoveDown.Enable(False)
         gridSizer.Add(item=btnMoveDown,
                       pos=(3, 1))
@@ -3024,8 +3031,42 @@
         self.mapWindow.nvizClass.AddIsosurface(id, level)
         self.mapWindow.nvizClass.SetIsosurfaceColor(id, 0, True, str(layer.name))
 
+        # disable add button on max
+        if list.GetCount() >= wxnviz.MAX_ISOSURFS:
+            self.FindWindowById(event.GetId()).Enable(False)
+        
+        # enable delete & move buttons
+        btnDelete = self.FindWindowById(self.win['volume']['btnIsosurfDelete'])
+        if not btnDelete.IsEnabled():
+            btnDelete.Enable(True)
+        if list.GetCount() > 1:
+            btnMoveUp = self.FindWindowById(self.win['volume']['btnIsosurfMoveUp'])
+            btnMoveDown = self.FindWindowById(self.win['volume']['btnIsosurfMoveDown'])
+            if not btnMoveUp.IsEnabled():
+                btnMoveUp.Enable(True)
+                btnMoveDown.Enable(True)
+        
         event.Skip()
         
+    def OnVolumeIsosurfDelete(self, event):
+        """Remove isosurface from list"""
+        list = self.FindWindowById(self.win['volume']['isosurfs'])
+        btn = self.FindWindowById(event.GetId())
+        
+        if list.GetCount() < 1:
+            btn.Enable(False)
+        elif list.GetCount() < 2:
+            self.FindWindowById(self.win['volume']['btnIsosurfMoveUp']).Enable(False)
+            self.FindWindowById(self.win['volume']['btnIsosurfMoveDown']).Enable(False)
+        
+    def OnVolumeIsosurfMoveUp(self, event):
+        """Move isosurface up in the list"""
+        pass
+
+    def OnVolumeIsosurfMoveDown(self, event):
+        """Move isosurface dowm in the list"""
+        pass
+
     def UpdatePage(self, pageId):
         """Update dialog (selected page)"""
         self.pageChanging = True

Modified: grass/trunk/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/toolbars.py	2008-08-12 09:35:52 UTC (rev 32710)
+++ grass/trunk/gui/wxpython/gui_modules/toolbars.py	2008-08-12 09:39:20 UTC (rev 32711)
@@ -502,7 +502,7 @@
         id = self.parent.toolbars['map'].pointer
         self.parent.toolbars['map'].toolbar.ToggleTool(id, True)
         self.parent.toolbars['map'].mapdisplay.OnPointer(event)
-
+        
         if event:
             # deselect previously selected tool
             if self.action.has_key('id'):
@@ -754,10 +754,10 @@
         # will be called before PopupMenu returns.
         self.parent.MapWindow.PopupMenu(toolMenu)
         toolMenu.Destroy()
-
-        id = self.parent.toolbars['vdigit'].additionalTools
-        self.parent.toolbars['vdigit'].toolbar[0].ToggleTool(id, True)
         
+        if self.action['desc'] == 'addPoint':
+            self.toolbar[0].ToggleTool(self.additionalTools, True)
+        
     def OnCopy(self, event):
         """Copy selected features from (background) vector map"""
         if self.action['desc'] == 'copyLine': # select previous action

Modified: grass/trunk/gui/wxpython/nviz/nviz_types.i
===================================================================
--- grass/trunk/gui/wxpython/nviz/nviz_types.i	2008-08-12 09:35:52 UTC (rev 32710)
+++ grass/trunk/gui/wxpython/nviz/nviz_types.i	2008-08-12 09:39:20 UTC (rev 32711)
@@ -48,6 +48,9 @@
 #define ST_GYRO       9
 #define ST_HISTOGRAM  10
 
+#define MAX_ISOSURFS   12
+#define MAX_SLICES     12
+
 /* extracted from include/nviz.h */
 /* quick draw mode */
 #define DRAW_QUICK_SURFACE 0x01



More information about the grass-commit mailing list