[GRASS-SVN] r36926 - grass/branches/develbranch_6/gui/wxpython

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Apr 30 11:17:25 EDT 2009


Author: martinl
Date: 2009-04-30 11:17:25 -0400 (Thu, 30 Apr 2009)
New Revision: 36926

Modified:
   grass/branches/develbranch_6/gui/wxpython/wxgui.py
Log:
toolbar "add vector" and "add raster" buttons have a regression in usability from gis.m (trac #535)


Modified: grass/branches/develbranch_6/gui/wxpython/wxgui.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/wxgui.py	2009-04-30 14:55:23 UTC (rev 36925)
+++ grass/branches/develbranch_6/gui/wxpython/wxgui.py	2009-04-30 15:17:25 UTC (rev 36926)
@@ -100,7 +100,7 @@
         self.baseTitle = title
         self.iconsize  = (16, 16)
 
-        wx.Frame.__init__(self, parent=parent, id=id, size=(500, 400),
+        wx.Frame.__init__(self, parent=parent, id=id, size=(550, 400),
                           style=wx.DEFAULT_FRAME_STYLE)
                           
         self.SetTitle(self.baseTitle)
@@ -1104,16 +1104,18 @@
                  ('', '', '', ''),
                  ('addrast', Icons["addrast"].GetBitmap(),
                   Icons["addrast"].GetLabel(), self.OnAddRaster),
+                 ('addshaded', Icons["addshaded"].GetBitmap(),
+                  _("Add various raster-based map layers"), self.OnAddRasterMisc),
                  ('addvect', Icons["addvect"].GetBitmap(),
                   Icons["addvect"].GetLabel(), self.OnAddVector),
+                 ('addthematic', Icons["addthematic"].GetBitmap(),
+                  _("Add various vector-based map layer"), self.OnAddVectorMisc),
                  ('addcmd',  Icons["addcmd"].GetBitmap(),
                   Icons["addcmd"].GetLabel(),  self.OnAddCommand),
                  ('addgrp',  Icons["addgrp"].GetBitmap(),
                   Icons["addgrp"].GetLabel(), self.OnAddGroup),
                  ('addovl',  Icons["addovl"].GetBitmap(),
                   Icons["addovl"].GetLabel(), self.OnAddOverlay),
-                 ('addlabels',  Icons["addlabels"].GetBitmap(),
-                  Icons["addlabels"].GetLabel(), self.OnAddLabels),
                  ('delcmd',  Icons["delcmd"].GetBitmap(),
                   Icons["delcmd"].GetLabel(), self.OnDeleteLayer),
                  ('', '', '', ''),
@@ -1238,6 +1240,14 @@
 
     # toolBar button handlers
     def OnAddRaster(self, event):
+        """Add raster map layer"""
+        # start new map display if no display is available
+        if not self.curr_page:
+            self.NewDisplay(show=False)
+        
+        self.AddRaster(event)
+        
+    def OnAddRasterMisc(self, event):
         """Add raster menu"""
         # start new map display if no display is available
         if not self.curr_page:
@@ -1247,11 +1257,6 @@
         rastmenu = wx.Menu()
 
         # add items to the menu
-        addrast = wx.MenuItem(rastmenu, -1, Icons["addrast"].GetLabel())
-        addrast.SetBitmap(Icons["addrast"].GetBitmap(self.iconsize))
-        rastmenu.AppendItem(addrast)
-        self.Bind(wx.EVT_MENU, self.AddRaster, addrast)
-
         if self.curr_page.maptree.mapdisplay.toolbars['nviz']:
             addrast3d = wx.MenuItem(rastmenu, -1, Icons ["addrast3d"].GetLabel())
             addrast3d.SetBitmap(Icons["addrast3d"].GetBitmap (self.iconsize))
@@ -1292,6 +1297,14 @@
         self.curr_page.maptree.mapdisplay.Show()
 
     def OnAddVector(self, event):
+        """Add vector map layer"""
+        # start new map display if no display is available
+        if not self.curr_page:
+            self.NewDisplay(show=False)
+        
+        self.AddVector(event)
+        
+    def OnAddVectorMisc(self, event):
         """Add vector menu"""
         # start new map display if no display is available
         if not self.curr_page:
@@ -1299,12 +1312,7 @@
 
         point = wx.GetMousePosition()
         vectmenu = wx.Menu()
-
-        addvect = wx.MenuItem(vectmenu, -1, Icons["addvect"].GetLabel())
-        addvect.SetBitmap(Icons["addvect"].GetBitmap(self.iconsize))
-        vectmenu.AppendItem(addvect)
-        self.Bind(wx.EVT_MENU, self.AddVector, addvect)
-
+        
         addtheme = wx.MenuItem(vectmenu, -1, Icons["addthematic"].GetLabel())
         addtheme.SetBitmap(Icons["addthematic"].GetBitmap(self.iconsize))
         vectmenu.AppendItem(addtheme)
@@ -1332,17 +1340,22 @@
         point = wx.GetMousePosition()
         ovlmenu = wx.Menu()
 
-        addgrid = wx.MenuItem(ovlmenu, -1, Icons["addgrid"].GetLabel())
+        addgrid = wx.MenuItem(ovlmenu, wx.ID_ANY, Icons["addgrid"].GetLabel())
         addgrid.SetBitmap(Icons["addgrid"].GetBitmap(self.iconsize))
         ovlmenu.AppendItem(addgrid)
         self.Bind(wx.EVT_MENU, self.AddGrid, addgrid)
-
-        addgeodesic = wx.MenuItem(ovlmenu, -1, Icons["addgeodesic"].GetLabel())
+        
+        addlabels = wx.MenuItem(ovlmenu, wx.ID_ANY, Icons["addlabels"].GetLabel())
+        addlabels.SetBitmap(Icons["addlabels"].GetBitmap(self.iconsize))
+        ovlmenu.AppendItem(addlabels)
+        self.Bind(wx.EVT_MENU, self.OnAddLabels, addlabels)
+        
+        addgeodesic = wx.MenuItem(ovlmenu, wx.ID_ANY, Icons["addgeodesic"].GetLabel())
         addgeodesic.SetBitmap(Icons["addgeodesic"].GetBitmap(self.iconsize))
         ovlmenu.AppendItem(addgeodesic)
         self.Bind(wx.EVT_MENU, self.AddGeodesic, addgeodesic)
-
-        addrhumb = wx.MenuItem(ovlmenu, -1, Icons["addrhumb"].GetLabel())
+        
+        addrhumb = wx.MenuItem(ovlmenu, wx.ID_ANY, Icons["addrhumb"].GetLabel())
         addrhumb.SetBitmap(Icons["addrhumb"].GetBitmap(self.iconsize))
         ovlmenu.AppendItem(addrhumb)
         self.Bind(wx.EVT_MENU, self.AddRhumb, addrhumb)



More information about the grass-commit mailing list