[GRASS-SVN] r42378 - in grass/branches/develbranch_6/gui/wxpython: . gui_modules icons

svn_grass at osgeo.org svn_grass at osgeo.org
Sat May 29 08:47:36 EDT 2010


Author: martinl
Date: 2010-05-29 08:47:36 -0400 (Sat, 29 May 2010)
New Revision: 42378

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py
   grass/branches/develbranch_6/gui/wxpython/icons/grass2_icons.py
   grass/branches/develbranch_6/gui/wxpython/icons/grass_icons.py
   grass/branches/develbranch_6/gui/wxpython/icons/icon.py
   grass/branches/develbranch_6/gui/wxpython/icons/silk_icons.py
   grass/branches/develbranch_6/gui/wxpython/wxgui.py
Log:
wxGUI: layer manager toolbar moved to toolbar.py
settings icon added to the toolbar
(merge r42377 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py	2010-05-29 12:42:06 UTC (rev 42377)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py	2010-05-29 12:47:36 UTC (rev 42378)
@@ -13,7 +13,8 @@
  - NvizToolbar
  - ModelToolbar
  - HistogramToolbar
- 
+ - LayerManagerToolbar
+
 (C) 2007-2010 by the GRASS Development Team
 This program is free software under the GNU General Public License
 (>=v2). Read the file COPYING that comes with GRASS for details.
@@ -1446,7 +1447,7 @@
             )
 
 class HistogramToolbar(AbstractToolbar):
-    """!Histogram modeler toolbar (see histogram.py)
+    """!Histogram toolbar (see histogram.py)
     """
     def __init__(self, parent):
         AbstractToolbar.__init__(self, parent)
@@ -1492,4 +1493,82 @@
              wx.ITEM_NORMAL, Icons["quit"].GetLabel(), Icons["quit"].GetDesc(),
              self.parent.OnQuit)
             )
+
+class LayerManagerToolbar(AbstractToolbar):
+    """!Layer Manager toolbar (see wxgui.py)
+    """
+    def __init__(self, parent):
+        AbstractToolbar.__init__(self, parent)
+        
+        self.InitToolbar(self.ToolbarData())
+        
+        # realize the toolbar
+        self.Realize()
+        
+    def ToolbarData(self):
+        """!Toolbar data"""
+        self.newdisplay = wx.NewId()
+        self.workspaceLoad = wx.NewId()
+        self.workspaceOpen = wx.NewId()
+        self.workspaceSave = wx.NewId()
+        self.addrast = wx.NewId()
+        self.addshaded = wx.NewId()
+        self.addvect = wx.NewId()
+        self.addthematic = wx.NewId()
+        self.addcmd = wx.NewId()
+        self.addgrp = wx.NewId()
+        self.addovl = wx.NewId()
+        self.delcmd = wx.NewId()
+        self.attribute = wx.NewId()
+        self.preferences = wx.NewId()
+        
+        # tool, label, bitmap, kind, shortHelp, longHelp, handler
+        return (
+            (self.newdisplay, 'newdisplay', Icons["newdisplay"].GetBitmap(),
+             wx.ITEM_NORMAL, Icons["newdisplay"].GetLabel(), Icons["newdisplay"].GetDesc(),
+             self.parent.OnNewDisplay),
+            ('', '', '', '', '', '', ''),
+            (self.workspaceLoad, 'workspaceLoad', Icons["workspaceLoad"].GetBitmap(),
+             wx.ITEM_NORMAL, Icons["workspaceLoad"].GetLabel(), Icons["workspaceLoad"].GetDesc(),
+             self.parent.OnWorkspace),
+            (self.workspaceOpen, 'workspaceOpen', Icons["workspaceOpen"].GetBitmap(),
+             wx.ITEM_NORMAL, Icons["workspaceOpen"].GetLabel(), Icons["workspaceOpen"].GetDesc(),
+             self.parent.OnWorkspaceOpen),
+            (self.workspaceSave, 'workspaceSave', Icons["workspaceSave"].GetBitmap(),
+             wx.ITEM_NORMAL, Icons["workspaceSave"].GetLabel(), Icons["workspaceSave"].GetDesc(),
+             self.parent.OnWorkspaceSave),
+            ('', '', '', '', '', '', ''),
+            (self.addrast, 'addrast', Icons["addrast"].GetBitmap(),
+             wx.ITEM_NORMAL, Icons["addrast"].GetLabel(), Icons["addrast"].GetDesc(),
+             self.parent.OnAddRaster),
+            (self.addshaded, 'addshaded', Icons["addshaded"].GetBitmap(),
+             wx.ITEM_NORMAL, _("Add various raster-based map layers"), "",
+             self.parent.OnAddRasterMisc),
+            (self.addvect, 'addvect', Icons["addvect"].GetBitmap(),
+             wx.ITEM_NORMAL, Icons["addvect"].GetLabel(), Icons["addvect"].GetDesc(),
+             self.parent.OnAddVector),
+            (self.addthematic, 'addthematic', Icons["addthematic"].GetBitmap(),
+             wx.ITEM_NORMAL, _("Add various vector-based map layers"), "",
+             self.parent.OnAddVectorMisc),
+            (self.addcmd, 'addcmd',  Icons["addcmd"].GetBitmap(),
+             wx.ITEM_NORMAL, Icons["addcmd"].GetLabel(), Icons["addcmd"].GetDesc(),
+             self.parent.OnAddCommand),
+            (self.addgrp, 'addgrp',  Icons["addgrp"].GetBitmap(),
+             wx.ITEM_NORMAL, Icons["addgrp"].GetLabel(), Icons["addgrp"].GetDesc(),
+             self.parent.OnAddGroup),
+            (self.addovl, 'addovl',  Icons["addovl"].GetBitmap(),
+             wx.ITEM_NORMAL, Icons["addovl"].GetLabel(), Icons["addovl"].GetDesc(),
+             self.parent.OnAddOverlay),
+            (self.delcmd, 'delcmd',  Icons["delcmd"].GetBitmap(),
+             wx.ITEM_NORMAL, Icons["delcmd"].GetLabel(), Icons["delcmd"].GetDesc(),
+             self.parent.OnDeleteLayer),
+            ('', '', '', '', '', '', ''),
+            (self.attribute, 'attrtable', Icons["attrtable"].GetBitmap(),
+             wx.ITEM_NORMAL, Icons["attrtable"].GetLabel(), Icons["attrtable"].GetDesc(),
+             self.parent.OnShowAttributeTable),
+            ('', '', '', '', '', '', ''),
+            (self.preferences, 'preferences', Icons["settings"].GetBitmap(),
+             wx.ITEM_NORMAL, Icons["settings"].GetLabel(), Icons["settings"].GetDesc(),
+             self.parent.OnPreferences)
+            )
     

Modified: grass/branches/develbranch_6/gui/wxpython/icons/grass2_icons.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/icons/grass2_icons.py	2010-05-29 12:42:06 UTC (rev 42377)
+++ grass/branches/develbranch_6/gui/wxpython/icons/grass2_icons.py	2010-05-29 12:47:36 UTC (rev 42378)
@@ -60,7 +60,6 @@
     "digDispAttr" : 'attributes-display.png',
     ## general
     "digUndo" : 'undo.png',
-    "digSettings" : 'settings.png',
     "digAdditionalTools" : 'tools.png',
     # layer manager
     "newdisplay" : 'monitor-create.png',
@@ -89,7 +88,6 @@
     # profile analysis
     "transect"     : 'layer-raster-profile.png',
     "profiledraw"  : 'show.png',
-    "profileopt"   : 'settings.png',
     # georectify
     "grGcpSet"     : 'gcp-create.png',
     'grGcpClear'   : 'gcp-remove.png',
@@ -100,9 +98,6 @@
     "grGcpAdd"     : 'gcp-add.png',
     "grGcpDelete"  : 'gcp-delete.png',
     "grGcpReload"  : 'reload.png',
-    "grSettings"   : 'settings.png',
-    # nviz
-    "nvizSettings"   : 'settings.png',
     # modeler
     "modelActionAdd" : 'module-add.png',
     "modelDataAdd"   : 'data-add.png',
@@ -111,6 +106,7 @@
     "modelValidate"  : 'check.png',
     "imageSave"      : 'image-export.png',
     "pythonSave"     : 'python-export.png',
-    "modelSettings"  : 'settings.png',
     "modelProperties" : 'options.png',
+    # various
+    "settings"       : 'settings.png',
     }

Modified: grass/branches/develbranch_6/gui/wxpython/icons/grass_icons.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/icons/grass_icons.py	2010-05-29 12:42:06 UTC (rev 42377)
+++ grass/branches/develbranch_6/gui/wxpython/icons/grass_icons.py	2010-05-29 12:47:36 UTC (rev 42378)
@@ -48,7 +48,6 @@
     "digDispAttr" : 'display.attributes.gif',
     ## general
     "digUndo" : wx.ART_ERROR, # FIXME
-    "digSettings" : 'settings.gif',
     "digAdditionalTools" : wx.ART_ERROR, # FIXME
     # layer manager
     "newdisplay" : 'gui-startmon.gif',
@@ -89,7 +88,6 @@
     # profile 
     "profile"    : 'gui-profile.gif',
     "transect"   : 'gui-profiledefine.gif',
-    # "profiledraw": 'gui-profiledraw.gif',
     "profiledraw" : 'gui-display.gif',
     "profileopt" : 'gui-profileopt.gif',
     # georectify
@@ -102,9 +100,6 @@
     "grGcpAdd"     : wx.ART_NEW, # FIXME
     "grGcpDelete"  : wx.ART_DELETE, # FIXME
     "grGcpReload"  : 'gui-redraw.gif',
-    "grSettings"   : 'edit-color.gif', 
-    # nviz 
-    "nvizSettings" : 'edit-color.gif',
     # modeler
     "modelActionAdd" : wx.ART_ERROR,
     "modelDataAdd"   : wx.ART_ERROR,
@@ -113,6 +108,7 @@
     "modelValidate"  : wx.ART_ERROR,
     "imageSave"      : wx.ART_ERROR,
     "pythonSave"     : wx.ART_ERROR,
-    "modelSettings"  : wx.ART_ERROR,
     "modelProperties" : wx.ART_ERROR,
+    # various
+    "settings"       : 'edit-color.gif',
     }

Modified: grass/branches/develbranch_6/gui/wxpython/icons/icon.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/icons/icon.py	2010-05-29 12:42:06 UTC (rev 42377)
+++ grass/branches/develbranch_6/gui/wxpython/icons/icon.py	2010-05-29 12:47:36 UTC (rev 42378)
@@ -228,6 +228,8 @@
                              label=_("Add text layer")),
     "addrast3d"  : MetaIcon (img=Icons["addrast3d"],
                              label=_("Add 3D raster map")),
+    "settings"   : MetaIcon (img=Icons["settings"],
+                             label=_("Show GUI settings")),
     # digit
     "digAddPoint": MetaIcon (img=Icons["digAddPoint"],
                              label=_("Digitize new point"),
@@ -268,7 +270,7 @@
     "digRemoveVertex": MetaIcon (img=Icons["digRemoveVertex"],
                                  label=_("Remove vertex"),
                                  desc=_("Left: Select; Middle: Unselect; Right: Confirm")),
-    "digSettings": MetaIcon (img=Icons["digSettings"],
+    "digSettings": MetaIcon (img=Icons["settings"],
                              label=_("Settings"),
                              desc=_("Settings dialog for digitization tool")),
     "digSplitLine": MetaIcon (img=Icons["digSplitLine"],
@@ -294,7 +296,7 @@
                              label=_("Profile surface map")),
     "profiledraw": MetaIcon (img=Icons["profiledraw"],
                              label=_("Draw/re-draw profile")),
-    "profileopt" : MetaIcon (img=Icons["profileopt"],
+    "profileopt" : MetaIcon (img=Icons["settings"],
                              label=_("Profile options")),
     "histogram"  : MetaIcon (img=Icons["histogram"],
                              label=_("Create histogram of image or raster file")),
@@ -328,11 +330,11 @@
                               label=_("Reload GCPs from selected POINTS file")),
     'grGcpQuit' : MetaIcon (img=Icons["quit"],
                             label=_("Quit georectification module")),
-    "grSettings": MetaIcon (img=Icons["grSettings"],
+    "grSettings": MetaIcon (img=Icons["settings"],
                             label=_("Settings"),
                             desc=_("Settings dialog for georectification tool")),
     # nviz
-    "nvizSettings": MetaIcon (img=Icons["nvizSettings"],
+    "nvizSettings": MetaIcon (img=Icons["settings"],
                               label=_("3D view mode tools"),
                               desc=_("Show/hide 3D view mode tools dialog")),
     "nvizQuit": MetaIcon (img=Icons["quit"],
@@ -359,7 +361,7 @@
                            label=_("Run entire model")),
     "modelValidate" : MetaIcon (img=Icons["modelValidate"],
                                 label=_("Validate entire model")),
-    "modelSettings" : MetaIcon (img=Icons["modelSettings"],
+    "modelSettings" : MetaIcon (img=Icons["settings"],
                                 label=_("Show modeler settings")),
     "modelProperties" : MetaIcon (img=Icons["modelProperties"],
                                   label=_("Show model properties")),

Modified: grass/branches/develbranch_6/gui/wxpython/icons/silk_icons.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/icons/silk_icons.py	2010-05-29 12:42:06 UTC (rev 42377)
+++ grass/branches/develbranch_6/gui/wxpython/icons/silk_icons.py	2010-05-29 12:47:36 UTC (rev 42378)
@@ -63,7 +63,6 @@
     "digDispAttr" : 'table.png',
     ## general
     "digUndo" : 'arrow_undo.png',
-    "digSettings" : 'color_swatch.png',
     "digAdditionalTools" : 'plugin.png',
     # layer manager
     "newdisplay" : 'application_add.png',
@@ -103,9 +102,6 @@
     "grGcpAdd"     : 'bullet_add.png', 
     "grGcpDelete"  : 'bullet_delete.png',
     "grGcpReload"  : 'arrow_refresh.png',
-    "grSettings"   : 'color_swatch.png',
-    # nviz
-    "nvizSettings"   : 'color_swatch.png',
     # modeler
     "modelActionAdd" : wx.ART_ERROR,
     "modelDataAdd"   : wx.ART_ERROR,
@@ -114,6 +110,7 @@
     "modelValidate"  : wx.ART_ERROR,
     "imageSave"      : wx.ART_ERROR,
     "pythonSave"     : wx.ART_ERROR,
-    "modelSettings"  : wx.ART_ERROR,
     "modelProperties" : wx.ART_ERROR,
+    # various
+    "settings"     : 'color_swatch.png',
     }


Property changes on: grass/branches/develbranch_6/gui/wxpython/icons/silk_icons.py
___________________________________________________________________
Modified: svn:mergeinfo
   - /grass/trunk/gui/wxpython/icons/silk_icons.py:41584,41586-41587,41590-41592,41594,41596,41598,41600,41806,41884,41888,42350
   + /grass/branches/releasebranch_6_4/gui/wxpython/icons/silk_icons.py:42375
/grass/trunk/gui/wxpython/icons/silk_icons.py:41584,41586-41587,41590-41592,41594,41596,41598,41600,41806,41884,41888,42350,42372,42377

Modified: grass/branches/develbranch_6/gui/wxpython/wxgui.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/wxgui.py	2010-05-29 12:42:06 UTC (rev 42377)
+++ grass/branches/develbranch_6/gui/wxpython/wxgui.py	2010-05-29 12:47:36 UTC (rev 42378)
@@ -39,17 +39,8 @@
 gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode=True)
 
 import gui_modules
-gmpath = gui_modules.__path__[0]
-sys.path.append(gmpath)
+sys.path.append(gui_modules.__path__[0])
 
-import images
-imagepath = images.__path__[0]
-sys.path.append(imagepath)
-
-import icons
-gmpath = icons.__path__[0]
-sys.path.append(gmpath)
-
 import gui_modules.globalvar as globalvar
 if not os.getenv("GRASS_WXBUNDLED"):
     globalvar.CheckForWx()
@@ -65,8 +56,7 @@
     import wx.lib.customtreectrl as CT
 import wx.lib.flatnotebook as FN
 
-grassPath = os.path.join(globalvar.ETCDIR, "python")
-sys.path.append(grassPath)
+sys.path.append(os.path.join(globalvar.ETCDIR, "python"))
 from grass.script import core as grass
 
 import gui_modules.utils as utils
@@ -93,6 +83,7 @@
 from   gui_modules.debug import Debug
 from   gui_modules.ghelp import MenuTreeWindow
 from   gui_modules.ghelp import AboutWindow
+from   gui_modules.toolbars import LayerManagerToolbar
 from   icons.icon import Icons
 
 UserSettings = preferences.globalSettings
@@ -136,7 +127,8 @@
         self.menucmd = self.menubar.GetCmd()
         self.statusbar = self.CreateStatusBar(number=1)
         self.notebook  = self.__createNoteBook()
-        self.toolbar   = self.__createToolBar()
+        self.toolbar = LayerManagerToolbar(parent = self)
+        self.SetToolBar(self.toolbar)
         
         # bindings
         self.Bind(wx.EVT_CLOSE,    self.OnCloseWindow)
@@ -226,19 +218,7 @@
         self.gm_cb.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CLOSING, self.OnCBPageClosed)
         
         return self.notebook
-
-    def __createToolBar(self):
-        """!Creates toolbar"""
-
-        self.toolbar = self.CreateToolBar()
-        self.toolbar.SetToolBitmapSize(globalvar.toolbarSize)
-
-        for each in self.ToolbarData():
-            self.AddToolbarButton(self.toolbar, *each)
-        self.toolbar.Realize()
-
-        return self.toolbar
-
+    
     def WorkspaceChanged(self):
         """!Update window title"""
         if not self.workspaceChanged:
@@ -1033,49 +1013,6 @@
         win.CentreOnScreen()
         win.Show()
         
-    def AddToolbarButton(self, toolbar, label, icon, help, handler):
-        """!Adds button to the given toolbar"""
-
-        if not label:
-            toolbar.AddSeparator()
-            return
-        tool = toolbar.AddLabelTool(id=wx.ID_ANY, label=label, bitmap=icon, shortHelp=help)
-        self.Bind(wx.EVT_TOOL, handler, tool)
-
-    def ToolbarData(self):
-
-        return   (
-                 ('newdisplay', Icons["newdisplay"].GetBitmap(),
-                  Icons["newdisplay"].GetLabel(), self.OnNewDisplay),
-                 ('', '', '', ''),
-                 ('workspaceLoad', Icons["workspaceLoad"].GetBitmap(),
-                  Icons["workspaceLoad"].GetLabel(), self.OnWorkspace),
-                 ('workspaceOpen', Icons["workspaceOpen"].GetBitmap(),
-                  Icons["workspaceOpen"].GetLabel(), self.OnWorkspaceOpen),
-                 ('workspaceSave', Icons["workspaceSave"].GetBitmap(),
-                  Icons["workspaceSave"].GetLabel(), self.OnWorkspaceSave),
-                 ('', '', '', ''),
-                 ('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),
-                 ('delcmd',  Icons["delcmd"].GetBitmap(),
-                  Icons["delcmd"].GetLabel(), self.OnDeleteLayer),
-                 ('', '', '', ''),
-                 ('attrtable', Icons["attrtable"].GetBitmap(),
-                  Icons["attrtable"].GetLabel(), self.OnShowAttributeTable)
-                  )
-
     def OnImportDxfFile(self, event):
         """!Convert multiple DXF layers to GRASS vector map layers"""
         dlg = gdialogs.DxfImportDialog(parent=self)



More information about the grass-commit mailing list