[GRASS-SVN] r49808 - in grass/branches/develbranch_6/gui/wxpython:
gcp gmodeler gui_core icons lmgr mapdisp modules psmap vdigit wxplot
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Dec 18 11:36:20 EST 2011
Author: martinl
Date: 2011-12-18 08:36:20 -0800 (Sun, 18 Dec 2011)
New Revision: 49808
Added:
grass/branches/develbranch_6/gui/wxpython/gmodeler/toolbars.py
Modified:
grass/branches/develbranch_6/gui/wxpython/gcp/toolbars.py
grass/branches/develbranch_6/gui/wxpython/gmodeler/frame.py
grass/branches/develbranch_6/gui/wxpython/gui_core/toolbars.py
grass/branches/develbranch_6/gui/wxpython/icons/icon.py
grass/branches/develbranch_6/gui/wxpython/lmgr/frame.py
grass/branches/develbranch_6/gui/wxpython/lmgr/layertree.py
grass/branches/develbranch_6/gui/wxpython/lmgr/toolbars.py
grass/branches/develbranch_6/gui/wxpython/mapdisp/frame.py
grass/branches/develbranch_6/gui/wxpython/mapdisp/toolbars.py
grass/branches/develbranch_6/gui/wxpython/modules/histogram.py
grass/branches/develbranch_6/gui/wxpython/psmap/frame.py
grass/branches/develbranch_6/gui/wxpython/psmap/toolbars.py
grass/branches/develbranch_6/gui/wxpython/vdigit/toolbars.py
grass/branches/develbranch_6/gui/wxpython/wxplot/base.py
grass/branches/develbranch_6/gui/wxpython/wxplot/profile.py
Log:
wxGUI: separate icons into several GUI modules
(merge r49807 from trunk)
Modified: grass/branches/develbranch_6/gui/wxpython/gcp/toolbars.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gcp/toolbars.py 2011-12-18 16:21:34 UTC (rev 49807)
+++ grass/branches/develbranch_6/gui/wxpython/gcp/toolbars.py 2011-12-18 16:36:20 UTC (rev 49808)
@@ -8,6 +8,7 @@
- toolbars::GCPDisplayToolbar
(C) 2007-2011 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.
@@ -20,10 +21,8 @@
import wx
from core import globalvar
-from gui_core.toolbars import BaseToolbar
-
-sys.path.append(os.path.join(globalvar.ETCWXDIR, "icons"))
-from icon import Icons
+from gui_core.toolbars import BaseToolbar, BaseIcons
+from icon import MetaIcon
class GCPManToolbar(BaseToolbar):
"""!Toolbar for managing ground control points
@@ -39,7 +38,23 @@
self.Realize()
def _toolbarData(self):
- icons = Icons['georectify']
+ icons = {
+ 'gcpSave' : MetaIcon(img = 'gcp-save',
+ label = _('Save GCPs to POINTS file')),
+ 'gcpReload' : MetaIcon(img = 'reload',
+ label = _('Reload GCPs from POINTS file')),
+ 'gcpAdd' : MetaIcon(img = 'gcp-add',
+ label = _('Add new GCP')),
+ 'gcpDelete' : MetaIcon(img = 'gcp-delete',
+ label = _('Delete selected GCP')),
+ 'gcpClear' : MetaIcon(img = 'gcp-remove',
+ label = _('Clear selected GCP')),
+ 'gcpRms' : MetaIcon(img = 'gcp-rms',
+ label = _('Recalculate RMS error')),
+ 'georectify' : MetaIcon(img = 'georectify',
+ label = _('Georectify')),
+ }
+
return self._getToolbarData((('gcpSave', icons["gcpSave"],
self.parent.SaveGCPs),
('gcpReload', icons["gcpReload"],
@@ -79,7 +94,7 @@
self.InsertControl(10, self.togglemap)
self.SetToolShortHelp(self.togglemapid, '%s %s %s' % (_('Set map canvas for '),
- Icons['displayWindow']["zoomBack"].GetLabel(),
+ BaseIcons["zoomBack"].GetLabel(),
_(' / Zoom to map')))
# realize the toolbar
@@ -95,35 +110,43 @@
def _toolbarData(self):
"""!Toolbar data"""
- icons = Icons['displayWindow']
- return self._getToolbarData((("displaymap", icons["display"],
+ icons = {
+ 'gcpSet' : MetaIcon(img = 'gcp-create',
+ label = _('Set GCP'),
+ desc = _('Define GCP (Ground Control Points)')),
+ 'quit' : BaseIcons['quit'].SetLabel(_('Quit georectification tool')),
+ 'settings' : BaseIcons['settings'].SetLabel( _('Georectifier settings')),
+ 'help' : BaseIcons['help'].SetLabel(_('Georectifier manual')),
+ }
+
+ return self._getToolbarData((("displaymap", BaseIcons["display"],
self.parent.OnDraw),
- ("rendermap", icons["render"],
+ ("rendermap", BaseIcons["render"],
self.parent.OnRender),
- ("erase", icons["erase"],
+ ("erase", BaseIcons["erase"],
self.parent.OnErase),
(None, ),
- ("gcpset", Icons["georectify"]["gcpSet"],
+ ("gcpset", icons["gcpSet"],
self.parent.OnPointer),
- ("pan", icons["pan"],
+ ("pan", BaseIcons["pan"],
self.parent.OnPan),
- ("zoomin", icons["zoomIn"],
+ ("zoomin", BaseIcons["zoomIn"],
self.parent.OnZoomIn),
- ("zoomout", icons["zoomOut"],
+ ("zoomout", BaseIcons["zoomOut"],
self.parent.OnZoomOut),
- ("zoommenu", icons["zoomMenu"],
+ ("zoommenu", BaseIcons["zoomMenu"],
self.parent.OnZoomMenuGCP),
(None, ),
- ("zoomback", icons["zoomBack"],
+ ("zoomback", BaseIcons["zoomBack"],
self.parent.OnZoomBack),
- ("zoomtomap", icons["zoomExtent"],
+ ("zoomtomap", BaseIcons["zoomExtent"],
self.parent.OnZoomToMap),
(None, ),
- ('settings', Icons["georectify"]["settings"],
+ ('settings', icons["settings"],
self.parent.OnSettings),
- ('help', Icons["misc"]["help"],
+ ('help', icons["help"],
self.parent.OnHelp),
(None, ),
- ('quit', Icons["georectify"]["quit"],
+ ('quit', icons["quit"],
self.parent.OnQuit))
)
Modified: grass/branches/develbranch_6/gui/wxpython/gmodeler/frame.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gmodeler/frame.py 2011-12-18 16:21:34 UTC (rev 49807)
+++ grass/branches/develbranch_6/gui/wxpython/gmodeler/frame.py 2011-12-18 16:36:20 UTC (rev 49808)
@@ -4,7 +4,6 @@
@brief wxGUI Graphical Modeler for creating, editing, and managing models
Classes:
- - frame::ModelToolbar
- frame::ModelFrame
- frame::ModelCanvas
- frame::ModelEvtHandler
@@ -43,70 +42,17 @@
from gui_core.preferences import PreferencesBaseDialog
from core.settings import UserSettings
from core.menudata import MenuData
-from gui_core.toolbars import BaseToolbar
from gui_core.menu import Menu
from gmodeler.menudata import ModelerData
-from icons.icon import Icons
from gui_core.forms import GUI
from gmodeler.preferences import PreferencesDialog, PropertiesDialog
+from gmodeler.toolbars import ModelerToolbar
from gmodeler.model import *
from gmodeler.dialogs import *
from grass.script import core as grass
-class ModelToolbar(BaseToolbar):
- """!Graphical modeler toolbar (see gmodeler.py)
- """
- def __init__(self, parent):
- BaseToolbar.__init__(self, parent)
-
- self.InitToolbar(self._toolbarData())
-
- # realize the toolbar
- self.Realize()
-
- def _toolbarData(self):
- """!Toolbar data"""
- icons = Icons['modeler']
- return self._getToolbarData((('new', icons['new'],
- self.parent.OnModelNew),
- ('open', icons['open'],
- self.parent.OnModelOpen),
- ('save', icons['save'],
- self.parent.OnModelSave),
- ('image', icons['toImage'],
- self.parent.OnExportImage),
- ('python', icons['toPython'],
- self.parent.OnExportPython),
- (None, ),
- ('action', icons['actionAdd'],
- self.parent.OnAddAction),
- ('data', icons['dataAdd'],
- self.parent.OnAddData),
- ('relation', icons['relation'],
- self.parent.OnDefineRelation),
- ('loop', icons['loop'],
- self.parent.OnDefineLoop),
- (None, ),
- ('redraw', icons['redraw'],
- self.parent.OnCanvasRefresh),
- ('validate', icons['validate'],
- self.parent.OnValidateModel),
- ('run', icons['run'],
- self.parent.OnRunModel),
- (None, ),
- ("variables", icons['variables'],
- self.parent.OnVariables),
- ("settings", icons['settings'],
- self.parent.OnPreferences),
- ("help", Icons['misc']['help'],
- self.parent.OnHelp),
- (None, ),
- ('quit', icons['quit'],
- self.parent.OnCloseWindow))
- )
-
class ModelFrame(wx.Frame):
def __init__(self, parent, id = wx.ID_ANY,
title = _("GRASS GIS Graphical Modeler (experimental prototype)"), **kwargs):
@@ -137,7 +83,7 @@
self.SetMenuBar(self.menubar)
- self.toolbar = ModelToolbar(parent = self)
+ self.toolbar = ModelerToolbar(parent = self)
self.SetToolBar(self.toolbar)
self.statusbar = self.CreateStatusBar(number = 1)
Copied: grass/branches/develbranch_6/gui/wxpython/gmodeler/toolbars.py (from rev 49807, grass/trunk/gui/wxpython/gmodeler/toolbars.py)
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gmodeler/toolbars.py (rev 0)
+++ grass/branches/develbranch_6/gui/wxpython/gmodeler/toolbars.py 2011-12-18 16:36:20 UTC (rev 49808)
@@ -0,0 +1,109 @@
+"""!
+ at package gmodeler.toolbars
+
+ at brief wxGUI Graphical Modeler toolbars classes
+
+Classes:
+ - toolbars::ModelerToolbar
+
+(C) 2010-2011 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.
+
+ at author Martin Landa <landa.martin gmail.com>
+"""
+
+import os
+import sys
+
+import wx
+
+from core import globalvar
+from gui_core.toolbars import BaseToolbar, BaseIcons
+
+from icons.icon import MetaIcon
+
+class ModelerToolbar(BaseToolbar):
+ """!Graphical modeler toolbaro (see gmodeler.py)
+ """
+ def __init__(self, parent):
+ BaseToolbar.__init__(self, parent)
+
+ self.InitToolbar(self._toolbarData())
+
+ # realize the toolbar
+ self.Realize()
+
+ def _toolbarData(self):
+ """!Toolbar data"""
+ icons = {
+ 'new' : MetaIcon(img = 'create',
+ label = _('Create new model (Ctrl+N)')),
+ 'open' : MetaIcon(img = 'open',
+ label = _('Load model from file (Ctrl+O)')),
+ 'save' : MetaIcon(img = 'save',
+ label = _('Save current model to file (Ctrl+S)')),
+ 'toImage' : MetaIcon(img = 'image-export',
+ label = _('Export model to image')),
+ 'toPython' : MetaIcon(img = 'python-export',
+ label = _('Export model to Python script')),
+ 'actionAdd' : MetaIcon(img = 'module-add',
+ label = _('Add command (GRASS module) to model')),
+ 'dataAdd' : MetaIcon(img = 'data-add',
+ label = _('Add data to model')),
+ 'relation' : MetaIcon(img = 'relation-create',
+ label = _('Manually define relation between data and commands')),
+ 'loop' : MetaIcon(img = 'loop-add',
+ label = _('Add loop/series')),
+ 'run' : MetaIcon(img = 'execute',
+ label = _('Run model')),
+ 'validate' : MetaIcon(img = 'check',
+ label = _('Validate model')),
+ 'settings' : BaseIcons['settings'].SetLabel(_('Modeler settings')),
+ 'properties' : MetaIcon(img = 'options',
+ label = _('Show model properties')),
+ 'variables' : MetaIcon(img = 'modeler-variables',
+ label = _('Manage model variables')),
+ 'redraw' : MetaIcon(img = 'redraw',
+ label = _('Redraw model canvas')),
+ 'quit' : BaseIcons['quit'].SetLabel(_('Quit Graphical Modeler')),
+ }
+
+ return self._getToolbarData((('new', icons['new'],
+ self.parent.OnModelNew),
+ ('open', icons['open'],
+ self.parent.OnModelOpen),
+ ('save', icons['save'],
+ self.parent.OnModelSave),
+ ('image', icons['toImage'],
+ self.parent.OnExportImage),
+ ('python', icons['toPython'],
+ self.parent.OnExportPython),
+ (None, ),
+ ('action', icons['actionAdd'],
+ self.parent.OnAddAction),
+ ('data', icons['dataAdd'],
+ self.parent.OnAddData),
+ ('relation', icons['relation'],
+ self.parent.OnDefineRelation),
+ ('loop', icons['loop'],
+ self.parent.OnDefineLoop),
+ (None, ),
+ ('redraw', icons['redraw'],
+ self.parent.OnCanvasRefresh),
+ ('validate', icons['validate'],
+ self.parent.OnValidateModel),
+ ('run', icons['run'],
+ self.parent.OnRunModel),
+ (None, ),
+ ("variables", icons['variables'],
+ self.parent.OnVariables),
+ ("settings", icons['settings'],
+ self.parent.OnPreferences),
+ ("help", BaseIcons['help'],
+ self.parent.OnHelp),
+ (None, ),
+ ('quit', icons['quit'],
+ self.parent.OnCloseWindow))
+ )
Modified: grass/branches/develbranch_6/gui/wxpython/gui_core/toolbars.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_core/toolbars.py 2011-12-18 16:21:34 UTC (rev 49807)
+++ grass/branches/develbranch_6/gui/wxpython/gui_core/toolbars.py 2011-12-18 16:36:20 UTC (rev 49808)
@@ -24,7 +24,59 @@
from core import globalvar
from core.debug import Debug
+from icons.icon import MetaIcon
+BaseIcons = {
+ 'display' : MetaIcon(img = 'show',
+ label = _('Display map'),
+ desc = _('Re-render modified map layers only')),
+ 'render' : MetaIcon(img = 'layer-redraw',
+ label = _('Render map'),
+ desc = _('Force re-rendering all map layers')),
+ 'erase' : MetaIcon(img = 'erase',
+ label = _('Erase display'),
+ desc = _('Erase display canvas with given background color')),
+ 'pointer' : MetaIcon(img = 'pointer',
+ label = _('Pointer')),
+ 'zoomIn' : MetaIcon(img = 'zoom-in',
+ label = _('Zoom in'),
+ desc = _('Drag or click mouse to zoom')),
+ 'zoomOut' : MetaIcon(img = 'zoom-out',
+ label = _('Zoom out'),
+ desc = _('Drag or click mouse to unzoom')),
+ 'zoomBack' : MetaIcon(img = 'zoom-last',
+ label = _('Return to previous zoom')),
+ 'zoomMenu' : MetaIcon(img = 'zoom-more',
+ label = _('Various zoom options'),
+ desc = _('Zoom to computational, default, saved region, ...')),
+ 'zoomExtent' : MetaIcon(img = 'zoom-extent',
+ label = _('Zoom to selected map layer(s)')),
+ 'pan' : MetaIcon(img = 'pan',
+ label = _('Pan'),
+ desc = _('Drag with mouse to pan')),
+ 'saveFile' : MetaIcon(img = 'map-export',
+ label = _('Save display to graphic file')),
+ 'print' : MetaIcon(img = 'print',
+ label = _('Print display')),
+ 'font' : MetaIcon(img = 'font',
+ label = _('Select font')),
+ 'help' : MetaIcon(img = 'help',
+ label = _('Show manual')),
+ 'quit' : MetaIcon(img = 'quit',
+ label = _('Quit')),
+ 'addRast' : MetaIcon(img = 'layer-raster-add',
+ label = _('Add raster map layer')),
+ 'addVect' : MetaIcon(img = 'layer-vector-add',
+ label = _('Add vector map layer')),
+ 'overlay' : MetaIcon(img = 'overlay-add',
+ label = _('Add map elements'),
+ desc = _('Overlay elements like scale and legend onto map')),
+ 'histogramD' : MetaIcon(img = 'layer-raster-histogram',
+ label = _('Create histogram with d.histogram')),
+ 'settings' : MetaIcon(img = 'settings',
+ label = _("Settings")),
+ }
+
class BaseToolbar(wx.ToolBar):
"""!Abstract toolbar class"""
def __init__(self, parent):
@@ -166,3 +218,16 @@
item, icon.GetLabel(), icon.GetDesc(),
handler, pos)
return ("", "", "", "", "", "") # separator
+
+ def _onMenu(self, data):
+ """!Toolbar pop-up menu"""
+ menu = wx.Menu()
+
+ for icon, handler in data:
+ item = wx.MenuItem(menu, wx.ID_ANY, icon.GetLabel())
+ item.SetBitmap(icon.GetBitmap(self.parent.iconsize))
+ menu.AppendItem(item)
+ self.Bind(wx.EVT_MENU, handler, item)
+
+ self.PopupMenu(menu)
+ menu.Destroy()
Modified: grass/branches/develbranch_6/gui/wxpython/icons/icon.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/icons/icon.py 2011-12-18 16:21:34 UTC (rev 49807)
+++ grass/branches/develbranch_6/gui/wxpython/icons/icon.py 2011-12-18 16:36:20 UTC (rev 49808)
@@ -1,20 +1,16 @@
"""!
- at package icon
+ at package icons.icon
- at brief Icon themes
+ at brief Icon metadata
- at code
-from icons import Icons as Icons
- at endcode
-
Classes:
- MetaIcon
(C) 2007-2008, 2010-2011 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.
+This program is free software under the GNU General Public License
+(>=v2). Read the file COPYING that comes with GRASS for details.
+
@author Martin Landa <landa.martin gmail.com>
@author Anna Kratochvilova <kratochanna gmail.com>
"""
@@ -22,9 +18,8 @@
import os
import sys
import types
+import copy
-sys.path.append(os.path.join(os.getenv("GISBASE"), "etc", "wxpython", "gui_modules"))
-
import wx
from core.settings import UserSettings
@@ -90,8 +85,8 @@
class MetaIcon:
"""!Handle icon metadata (image path, tooltip, ...)
"""
- def __init__(self, img, label, desc = None):
- self.imagepath = img
+ def __init__(self, img, label = None, desc = None):
+ self.imagepath = iconSet.get(img, wx.ART_MISSING_IMAGE)
if not self.imagepath:
self.type = 'unknown'
else:
@@ -108,11 +103,9 @@
self.description = ''
def __str__(self):
- """!Debugging"""
return "label=%s, img=%s, type=%s" % (self.label, self.imagepath, self.type)
def GetBitmap(self, size = None):
- """!Get bitmap"""
bmp = None
if self.type == 'wx':
@@ -130,355 +123,24 @@
def GetLabel(self):
return self.label
-
+
def GetDesc(self):
return self.description
def GetImageName(self):
return os.path.basename(self.imagepath)
-#
-# create list of icon instances
-#
-Icons = {
- 'displayWindow' : {
- 'display' : MetaIcon(img = iconSet.get('show', wx.ART_ERROR),
- label = _('Display map'),
- desc = _('Re-render modified map layers only')),
- 'render' : MetaIcon(img = iconSet.get('layer-redraw', wx.ART_ERROR),
- label = _('Render map'),
- desc = _('Force re-rendering all map layers')),
- 'erase' : MetaIcon(img = iconSet.get('erase', wx.ART_ERROR),
- label = _('Erase display'),
- desc = _('Erase display canvas with given background color')),
- 'pointer' : MetaIcon(img = iconSet.get('pointer', wx.ART_ERROR),
- label = _('Pointer')),
- 'zoomIn' : MetaIcon(img = iconSet.get('zoom-in', wx.ART_ERROR),
- label = _('Zoom in'),
- desc = _('Drag or click mouse to zoom')),
- 'zoomOut' : MetaIcon(img = iconSet.get('zoom-out', wx.ART_ERROR),
- label = _('Zoom out'),
- desc = _('Drag or click mouse to unzoom')),
- 'pan' : MetaIcon(img = iconSet.get('pan', wx.ART_ERROR),
- label = _('Pan'),
- desc = _('Drag with mouse to pan')),
- 'query' : MetaIcon(img = iconSet.get('info', wx.ART_ERROR),
- label = _('Query raster/vector map(s)'),
- desc = _('Query selected raster/vector map(s)')),
- 'zoomBack' : MetaIcon(img = iconSet.get('zoom-last', wx.ART_ERROR),
- label = _('Return to previous zoom')),
- 'zoomMenu' : MetaIcon(img = iconSet.get('zoom-more', wx.ART_ERROR),
- label = _('Various zoom options'),
- desc = _('Zoom to computational, default, saved region, ...')),
- 'zoomExtent' : MetaIcon(img = iconSet.get('zoom-extent', wx.ART_ERROR),
- label = _('Zoom to selected map layer(s)')),
- 'overlay' : MetaIcon(img = iconSet.get('overlay-add', wx.ART_ERROR),
- label = _('Add map elements'),
- desc = _('Overlay elements like scale and legend onto map')),
- 'addBarscale': MetaIcon(img = iconSet.get('scalebar-add', wx.ART_ERROR),
- label = _('Add scalebar and north arrow')),
- 'addLegend' : MetaIcon(img = iconSet.get('legend-add', wx.ART_ERROR),
- label = _('Add legend')),
- 'addNorthArrow': MetaIcon(img = iconSet.get('north-arrow-add', wx.ART_ERROR),
- label = _('North Arrow')),
- 'saveFile' : MetaIcon(img = iconSet.get('map-export', wx.ART_ERROR),
- label = _('Save display to graphic file')),
- 'print' : MetaIcon(img = iconSet.get('print', wx.ART_ERROR),
- label = _('Print display')),
- 'analyze' : MetaIcon(img = iconSet.get('layer-raster-analyze', wx.ART_ERROR),
- label = _('Analyze map'),
- desc = _('Measuring, profiling, histogramming, ...')),
- 'measure' : MetaIcon(img = iconSet.get('measure-length', wx.ART_ERROR),
- label = _('Measure distance')),
- 'profile' : MetaIcon(img = iconSet.get('layer-raster-profile', wx.ART_ERROR),
- label = _('Profile surface map')),
- 'addText' : MetaIcon(img = iconSet.get('text-add', wx.ART_ERROR),
- label = _('Add text layer')),
- 'histogram' : MetaIcon(img = iconSet.get('layer-raster-histogram', wx.ART_ERROR),
- label = _('Create histogram of raster map')),
- },
- 'layerManager' : {
- 'newdisplay' : MetaIcon(img = iconSet.get('monitor-create', wx.ART_ERROR),
- label = _('Start new map display')),
- 'workspaceNew' : MetaIcon(img = iconSet.get('create', wx.ART_ERROR),
- label = _('Create new workspace (Ctrl+N)')),
- 'workspaceOpen' : MetaIcon(img = iconSet.get('open', wx.ART_ERROR),
- label = _('Open existing workspace file (Ctrl+O)')),
- 'workspaceSave' : MetaIcon(img = iconSet.get('save', wx.ART_ERROR),
- label = _('Save current workspace to file (Ctrl+S)')),
- 'addMulti' : MetaIcon(img = iconSet.get('layer-open', wx.ART_ERROR),
- label = _('Add multiple raster or vector map layers (Ctrl+Shift+L)')),
- 'import' : MetaIcon(img = iconSet.get('layer-import', wx.ART_ERROR),
- label = _('Import raster or vector data')),
- 'rastImport' : MetaIcon(img = iconSet.get('layer-import', wx.ART_ERROR),
- label = _('Import raster data')),
- 'rastLink' : MetaIcon(img = iconSet.get('layer-import', wx.ART_ERROR),
- label = _('Link external raster data')),
- 'vectImport' : MetaIcon(img = iconSet.get('layer-import', wx.ART_ERROR),
- label = _('Import vector data')),
- 'vectLink' : MetaIcon(img = iconSet.get('layer-import', wx.ART_ERROR),
- label = _('Link external vector data')),
- 'addRast' : MetaIcon(img = iconSet.get('layer-raster-add', wx.ART_ERROR),
- label = _('Add raster map layer (Ctrl+Shift+R)')),
- 'rastMisc' : MetaIcon(img = iconSet.get('layer-raster-more', wx.ART_ERROR),
- label = _('Add various raster map layers (RGB, HIS, shaded relief...)')),
- 'addVect' : MetaIcon(img = iconSet.get('layer-vector-add', wx.ART_ERROR),
- label = _('Add vector map layer (Ctrl+Shift+V)')),
- 'vectMisc' : MetaIcon(img = iconSet.get('layer-vector-more', wx.ART_ERROR),
- label = _('Add various vector map layers (thematic, chart...)')),
- 'addCmd' : MetaIcon(img = iconSet.get('layer-command-add', wx.ART_ERROR),
- label = _('Add command layer')),
- 'addGroup' : MetaIcon(img = iconSet.get('layer-group-add', wx.ART_ERROR),
- label = _('Add group')),
- 'addOverlay' : MetaIcon(img = iconSet.get('layer-more', wx.ART_ERROR),
- label = _('Add grid or vector labels overlay')),
- 'delCmd' : MetaIcon(img = iconSet.get('layer-remove', wx.ART_ERROR),
- label = _('Delete selected map layer')),
- 'quit' : MetaIcon(img = iconSet.get('quit', wx.ART_ERROR),
- label = _('Quit')),
- 'attrTable' : MetaIcon(img = iconSet.get('table', wx.ART_ERROR),
- label = _('Show attribute table')),
- 'vdigit' : MetaIcon(img = iconSet.get('edit', wx.ART_ERROR),
- label = _('Edit vector maps')),
- 'addRgb' : MetaIcon(img = iconSet.get('layer-rgb-add', wx.ART_ERROR),
- label = _('Add RGB map layer')),
- 'addHis' : MetaIcon(img = iconSet.get('layer-his-add', wx.ART_ERROR),
- label = _('Add HIS map layer')),
- 'addShaded' : MetaIcon(img = iconSet.get('layer-shaded-relief-add', wx.ART_ERROR),
- label = _('Add shaded relief map layer')),
- 'addRArrow' : MetaIcon(img = iconSet.get('layer-aspect-arrow-add', wx.ART_ERROR),
- label = _('Add raster flow arrows')),
- 'addRNum' : MetaIcon(img = iconSet.get('layer-cell-cats-add', wx.ART_ERROR),
- label = _('Add raster cell numbers')),
- 'addThematic': MetaIcon(img = iconSet.get('layer-vector-thematic-add', wx.ART_ERROR),
- label = _('Add thematic area (choropleth) map layer')),
- 'addChart' : MetaIcon(img = iconSet.get('layer-vector-chart-add', wx.ART_ERROR),
- label = _('Add thematic chart layer')),
- 'addGrid' : MetaIcon(img = iconSet.get('layer-grid-add', wx.ART_ERROR),
- label = _('Add grid layer')),
- 'addGeodesic': MetaIcon(img = iconSet.get('shortest-distance', wx.ART_ERROR),
- label = _('Add geodesic line layer')),
- 'addRhumb' : MetaIcon(img = iconSet.get('shortest-distance', wx.ART_ERROR),
- label = _('Add rhumbline layer')),
- 'addLabels' : MetaIcon(img = iconSet.get('layer-label-add', wx.ART_ERROR),
- label = _('Add labels')),
- 'addRast3d' : MetaIcon(img = iconSet.get('layer-raster3d-add', wx.ART_ERROR),
- label = _('Add 3D raster map layer'),
- desc = _('Note that 3D raster data are rendered only in 3D view mode')),
- 'settings' : MetaIcon(img = iconSet.get('settings', wx.ART_ERROR),
- label = _('Show GUI settings')),
- 'modeler' : MetaIcon(img = iconSet.get('modeler-main', wx.ART_ERROR),
- label = _('Graphical Modeler')),
- 'layerOptions' : MetaIcon(img = iconSet.get('options', wx.ART_ERROR),
- label = _('Set options')),
- 'mapOutput' : MetaIcon(img = iconSet.get('print-compose', wx.ART_ERROR),
- label = _('Cartographic Composer')),
- 'mapcalc' : MetaIcon(img = iconSet.get('calculator', wx.ART_ERROR),
- label = _('Raster Map Calculator')),
- },
- 'vdigit' : {
- 'addPoint' : MetaIcon(img = iconSet.get('point-create', wx.ART_ERROR),
- label = _('Digitize new point'),
- desc = _('Left: new point')),
- 'addLine' : MetaIcon(img = iconSet.get('line-create', wx.ART_ERROR),
- label = _('Digitize new line'),
- desc = _('Left: new point; Ctrl+Left: undo last point; Right: close line')),
- 'addBoundary' : MetaIcon(img = iconSet.get('boundary-create', wx.ART_ERROR),
- label = _('Digitize new boundary'),
- desc = _('Left: new point; Ctrl+Left: undo last point; Right: close line')),
- 'addCentroid' : MetaIcon(img = iconSet.get('centroid-create', wx.ART_ERROR),
- label = _('Digitize new centroid'),
- desc = _('Left: new point')),
- 'addArea' : MetaIcon(img = iconSet.get('polygon-create', wx.ART_ERROR),
- label = _('Digitize new area (composition of boundaries without category and one centroid with category)'),
- desc = _('Left: new point')),
- 'addVertex' : MetaIcon(img = iconSet.get('vertex-create', wx.ART_ERROR),
- label = _('Add new vertex'),
- desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
- 'deleteLine' : MetaIcon(img = iconSet.get('line-delete', wx.ART_ERROR),
- label = _('Delete feature(s)'),
- desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
- 'displayAttr' : MetaIcon(img = iconSet.get('attributes-display', wx.ART_ERROR),
- label = _('Display/update attributes'),
- desc = _('Left: Select')),
- 'displayCats' : MetaIcon(img = iconSet.get('cats-display', wx.ART_ERROR),
- label = _('Display/update categories'),
- desc = _('Left: Select')),
- 'editLine' : MetaIcon(img = iconSet.get('line-edit', wx.ART_ERROR),
- label = _('Edit line/boundary'),
- desc = _('Left: new point; Ctrl+Left: undo last point; Right: close line')),
- 'moveLine' : MetaIcon(img = iconSet.get('line-move', wx.ART_ERROR),
- label = _('Move feature(s)'),
- desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
- 'moveVertex' : MetaIcon(img = iconSet.get('vertex-move', wx.ART_ERROR),
- label = _('Move vertex'),
- desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
- 'removeVertex' : MetaIcon(img = iconSet.get('vertex-delete', wx.ART_ERROR),
- label = _('Remove vertex'),
- desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
- 'settings' : MetaIcon(img = iconSet.get('settings', wx.ART_ERROR),
- label = _('Digitization settings')),
- 'quit' : MetaIcon(img = iconSet.get('quit', wx.ART_ERROR),
- label = _('Quit digitizer'),
- desc = _('Quit digitizer and save changes')),
- 'additionalTools' : MetaIcon(img = iconSet.get('tools', wx.ART_ERROR),
- label = _('Additional tools ' \
- '(copy, flip, connect, etc.)'),
- desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
- 'undo' : MetaIcon(img = iconSet.get('undo', wx.ART_ERROR),
- label = _('Undo'),
- desc = _('Undo previous changes')),
- },
- 'plot' : {
- 'draw' : MetaIcon(img = iconSet.get('show', wx.ART_ERROR),
- label = _('Draw/re-draw plot')),
- 'transect' : MetaIcon(img = iconSet.get('layer-raster-profile', wx.ART_ERROR),
- label = _('Draw transect in map display window to profile')),
- 'options' : MetaIcon(img = iconSet.get('settings', wx.ART_ERROR),
- label = _('Plot options')),
- 'statistics' : MetaIcon(img = iconSet.get('check', wx.ART_ERROR),
- label = _('Plot statistics')),
- 'save' : MetaIcon(img = iconSet.get('save', wx.ART_ERROR),
- label = _('Save profile data to CSV file')),
- 'quit' : MetaIcon(img = iconSet.get('quit', wx.ART_ERROR),
- label = _('Quit plot tool'))
- },
- 'georectify' : {
- 'gcpSet' : MetaIcon(img = iconSet.get('gcp-create', wx.ART_ERROR),
- label = _('Set GCP'),
- desc = _('Define GCP (Ground Control Points)')),
- 'georectify': MetaIcon(img = iconSet.get('georectify', wx.ART_ERROR),
- label = _('Georectify')),
- 'gcpRms' : MetaIcon(img = iconSet.get('gcp-rms', wx.ART_ERROR),
- label = _('Recalculate RMS error')),
- 'gcpSave' : MetaIcon(img = iconSet.get('gcp-save', wx.ART_ERROR),
- label = _('Save GCPs to POINTS file')),
- 'gcpAdd' : MetaIcon(img = iconSet.get('gcp-add', wx.ART_ERROR),
- label = _('Add new GCP')),
- 'gcpDelete' : MetaIcon(img = iconSet.get('gcp-delete', wx.ART_ERROR),
- label = _('Delete selected GCP')),
- 'gcpClear' : MetaIcon(img = iconSet.get('gcp-remove', wx.ART_ERROR),
- label = _('Clear selected GCP')),
- 'gcpReload' : MetaIcon(img = iconSet.get('reload', wx.ART_ERROR),
- label = _('Reload GCPs from POINTS file')),
- 'quit' : MetaIcon(img = iconSet.get('quit', wx.ART_ERROR),
- label = _('Quit georectification')),
- 'settings' : MetaIcon(img = iconSet.get('settings', wx.ART_ERROR),
- label = _('Settings'),
- desc = _('Settings dialog for georectification tool')),
- },
- 'nviz' : {
- 'rotate': MetaIcon(img = iconSet.get('3d-rotate', wx.ART_ERROR),
- label = _('Rotate 3D scene'),
- desc = _('Drag with mouse to rotate 3D scene')),
- 'flyThrough': MetaIcon(img = iconSet.get('flythrough', wx.ART_MISSING_IMAGE),
- label = _('Fly-through mode'),
- desc = _('Drag with mouse, hold Ctrl down for different mode'
- ' or Shift to accelerate')),
- 'zoomIn': MetaIcon(img = iconSet.get('zoom-in', wx.ART_ERROR),
- label = _('Zoom in'),
- desc = _('Click mouse to zoom')),
- 'zoomOut': MetaIcon(img = iconSet.get('zoom-out', wx.ART_ERROR),
- label = _('Zoom out'),
- desc = _('Click mouse to unzoom')),
- 'nvizCmd': MetaIcon(img = iconSet.get('script-save', wx.ART_ERROR),
- label = _('Generate command for m.nviz.image'),
- desc = _('Generate command for m.nviz.image based on current state')),
- 'settings': MetaIcon(img = iconSet.get('3d-settings', wx.ART_ERROR),
- label = _('3D view mode settings'),
- desc = _('Show 3D view mode settings dialog')),
- 'help' : MetaIcon(img = iconSet.get('3d-help', wx.ART_ERROR),
- label = _('Show 3D view mode manual')),
- },
- 'modeler' : {
- 'new' : MetaIcon(img = iconSet.get('create', wx.ART_ERROR),
- label = _('Create new model (Ctrl+N)')),
- 'open' : MetaIcon(img = iconSet.get('open', wx.ART_ERROR),
- label = _('Load model from file (Ctrl+O)')),
- 'save' : MetaIcon(img = iconSet.get('save', wx.ART_ERROR),
- label = _('Save current model to file (Ctrl+S)')),
- 'toImage' : MetaIcon(img = iconSet.get('image-export', wx.ART_ERROR),
- label = _('Export model to image')),
- 'toPython' : MetaIcon(img = iconSet.get('python-export', wx.ART_ERROR),
- label = _('Export model to Python script')),
- 'actionAdd' : MetaIcon(img = iconSet.get('module-add', wx.ART_ERROR),
- label = _('Add command (GRASS module) to model')),
- 'dataAdd' : MetaIcon(img = iconSet.get('data-add', wx.ART_ERROR),
- label = _('Add data to model')),
- 'relation' : MetaIcon(img = iconSet.get('relation-create', wx.ART_ERROR),
- label = _('Manually define relation between data and commands')),
- 'loop' : MetaIcon(img = iconSet.get('loop-add', wx.ART_ERROR),
- label = _('Add loop/series')),
- 'run' : MetaIcon(img = iconSet.get('execute', wx.ART_ERROR),
- label = _('Run model')),
- 'validate' : MetaIcon(img = iconSet.get('check', wx.ART_ERROR),
- label = _('Validate model')),
- 'settings' : MetaIcon(img = iconSet.get('settings', wx.ART_ERROR),
- label = _('Show modeler settings')),
- 'properties' : MetaIcon(img = iconSet.get('options', wx.ART_ERROR),
- label = _('Show model properties')),
- 'variables' : MetaIcon(img = iconSet.get('modeler-variables', wx.ART_ERROR),
- label = _('Manage model variables')),
- 'redraw' : MetaIcon(img = iconSet.get('redraw', wx.ART_ERROR),
- label = _('Redraw model canvas')),
- 'quit' : MetaIcon(img = iconSet.get('quit', wx.ART_ERROR),
- label = _('Quit Graphical Modeler')),
- },
- 'misc' : {
- 'font' : MetaIcon(img = iconSet.get('font', wx.ART_ERROR),
- label = _('Select font')),
- 'help' : MetaIcon(img = iconSet.get('help', wx.ART_ERROR),
- label = _('Show manual')),
- 'quit' : MetaIcon(img = iconSet.get('quit', wx.ART_ERROR),
- label = _('Quit')),
- },
- 'psMap' : {
- 'scriptSave' : MetaIcon(img = iconSet.get('script-save', wx.ART_ERROR),
- label = _('Generate text file with mapping instructions')),
- 'scriptLoad' : MetaIcon(img = iconSet.get('script-load', wx.ART_ERROR),
- label = _('Load text file with mapping instructions')),
- 'psExport' : MetaIcon(img = iconSet.get('ps-export', wx.ART_ERROR),
- label = _('Generate PostScript output')),
- 'pdfExport' : MetaIcon(img = iconSet.get('pdf-export', wx.ART_ERROR),
- label = _('Generate PDF output')),
- 'pageSetup' : MetaIcon(img = iconSet.get('page-settings', wx.ART_ERROR),
- label = _('Page setup'),
- desc = _('Specify paper size, margins and orientation')),
- 'fullExtent' : MetaIcon(img = iconSet.get('zoom-extent', wx.ART_ERROR),
- label = _("Full extent"),
- desc = _("Zoom to full extent")),
- 'addMap' : MetaIcon(img = iconSet.get('layer-add', wx.ART_ERROR),
- label = _("Map frame"),
- desc = _("Click and drag to place map frame")),
- 'addRast' : MetaIcon(img = iconSet.get('layer-raster-add', wx.ART_ERROR),
- label = _("Raster map"),
- desc = _("Add raster map")),
- 'addVect' : MetaIcon(img = iconSet.get('layer-vector-add', wx.ART_ERROR),
- label = _("Vector map"),
- desc = _("Add vector map")),
- 'deleteObj' : MetaIcon(img = iconSet.get('layer-remove', wx.ART_ERROR),
- label = _("Delete selected object")),
- 'preview' : MetaIcon(img = iconSet.get('execute', wx.ART_ERROR),
- label = _("Show preview")),
- 'quit' : MetaIcon(img = iconSet.get('quit', wx.ART_ERROR),
- label = _('Quit Cartographic Composer')),
- 'addText' : MetaIcon(img = iconSet.get('text-add', wx.ART_ERROR),
- label = _('Text')),
- 'addMapinfo' : MetaIcon(img = iconSet.get('map-info', wx.ART_ERROR),
- label = _('Map info')),
- 'addLegend' : MetaIcon(img = iconSet.get('legend-add', wx.ART_ERROR),
- label = _('Legend')),
- 'addScalebar' : MetaIcon(img = iconSet.get('scalebar-add', wx.ART_ERROR),
- label = _('Scale bar')),
- 'addImage' : MetaIcon(img = iconSet.get('image-add', wx.ART_ERROR),
- label = _('Image')),
- 'addNorthArrow': MetaIcon(img = iconSet.get('north-arrow-add', wx.ART_ERROR),
- label = _('North Arrow')),
- }
- }
-
-# testing ...
-if __name__ == '__main__':
- for k, v in iconSet.iteritems():
- for kk, vv in v.iteritems():
- print k, kk, vv.GetImageName()
+ def SetLabel(self, label = None, desc = None):
+ """!Set label/description for icon
+ @param label icon label (None for no change)
+ @param desc icon description (None for no change)
+
+ @return copy of original object
+ """
+ cobj = copy.copy(self)
+ if label:
+ cobj.label = label
+ if desc:
+ cobj.description = desc
+
+ return cobj
Modified: grass/branches/develbranch_6/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/lmgr/frame.py 2011-12-18 16:21:34 UTC (rev 49807)
+++ grass/branches/develbranch_6/gui/wxpython/lmgr/frame.py 2011-12-18 16:36:20 UTC (rev 49808)
@@ -39,9 +39,8 @@
from core.gcmd import RunCommand, GError, GMessage
from core.settings import UserSettings
-from icons.icon import Icons
from gui_core.preferences import MapsetAccess, PreferencesDialog, EVT_SETTINGS_CHANGED
-from lmgr.layertree import LayerTree
+from lmgr.layertree import LayerTree, LMIcons
from lmgr.menudata import ManagerData
from gui_core.widgets import GNotebook
from modules.mcalc_builder import MapCalcFrame
@@ -668,7 +667,7 @@
win = AboutWindow(self)
win.CentreOnScreen()
win.Show(True)
-
+
def _popupMenu(self, data):
"""!Create popup menu
"""
@@ -679,8 +678,8 @@
if key is None:
menu.AppendSeparator()
continue
- item = wx.MenuItem(menu, wx.ID_ANY, Icons['layerManager'][key].GetLabel())
- item.SetBitmap(Icons['layerManager'][key].GetBitmap(self.iconsize))
+ item = wx.MenuItem(menu, wx.ID_ANY, LMIcons[key].GetLabel())
+ item.SetBitmap(LMIcons[key].GetBitmap(self.iconsize))
menu.AppendItem(item)
self.Bind(wx.EVT_MENU, handler, item)
Modified: grass/branches/develbranch_6/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/lmgr/layertree.py 2011-12-18 16:21:34 UTC (rev 49807)
+++ grass/branches/develbranch_6/gui/wxpython/lmgr/layertree.py 2011-12-18 16:36:20 UTC (rev 49808)
@@ -4,7 +4,7 @@
@brief Utility classes for map layer management.
Classes:
- - lmgr::LayerTree
+ - layertree::LayerTree
(C) 2007-2011 by the GRASS Development Team
@@ -38,12 +38,59 @@
from core.utils import GetLayerNameFromCmd
from wxplot.profile import ProfileFrame
from core.debug import Debug
-from icon import Icons
from core.settings import UserSettings
from core.gcmd import GWarning
+from gui_core.toolbars import BaseIcons
+from icons.icon import MetaIcon
TREE_ITEM_HEIGHT = 25
+LMIcons = {
+ 'rastImport' : MetaIcon(img = 'layer-import',
+ label = _('Import raster data')),
+ 'rastLink' : MetaIcon(img = 'layer-import',
+ label = _('Link external raster data')),
+ 'rastOut' : MetaIcon(img = 'layer-export',
+ label = _('Set raster output format')),
+ 'vectImport' : MetaIcon(img = 'layer-import',
+ label = _('Import vector data')),
+ 'vectLink' : MetaIcon(img = 'layer-import',
+ label = _('Link external vector data')),
+ 'vectOut' : MetaIcon(img = 'layer-export',
+ label = _('Set vector output format')),
+ 'addCmd' : MetaIcon(img = 'layer-command-add',
+ label = _('Add command layer')),
+ 'quit' : MetaIcon(img = 'quit',
+ label = _('Quit')),
+ 'addRgb' : MetaIcon(img = 'layer-rgb-add',
+ label = _('Add RGB map layer')),
+ 'addHis' : MetaIcon(img = 'layer-his-add',
+ label = _('Add HIS map layer')),
+ 'addShaded' : MetaIcon(img = 'layer-shaded-relief-add',
+ label = _('Add shaded relief map layer')),
+ 'addRArrow' : MetaIcon(img = 'layer-aspect-arrow-add',
+ label = _('Add raster flow arrows')),
+ 'addRNum' : MetaIcon(img = 'layer-cell-cats-add',
+ label = _('Add raster cell numbers')),
+ 'addThematic': MetaIcon(img = 'layer-vector-thematic-add',
+ label = _('Add thematic area (choropleth) map layer')),
+ 'addChart' : MetaIcon(img = 'layer-vector-chart-add',
+ label = _('Add thematic chart layer')),
+ 'addGrid' : MetaIcon(img = 'layer-grid-add',
+ label = _('Add grid layer')),
+ 'addGeodesic': MetaIcon(img = 'shortest-distance',
+ label = _('Add geodesic line layer')),
+ 'addRhumb' : MetaIcon(img = 'shortest-distance',
+ label = _('Add rhumbline layer')),
+ 'addLabels' : MetaIcon(img = 'layer-label-add',
+ label = _('Add labels')),
+ 'addRast3d' : MetaIcon(img = 'layer-raster3d-add',
+ label = _('Add 3D raster map layer'),
+ desc = _('Note that 3D raster data are rendered only in 3D view mode')),
+ 'layerOptions' : MetaIcon(img = 'options',
+ label = _('Set options')),
+ }
+
class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
"""!Creates layer tree structure
"""
@@ -129,50 +176,49 @@
self.folder = il.Add(trart)
bmpsize = (16, 16)
- icons = Icons['layerManager']
- trgif = icons["addRast"].GetBitmap(bmpsize)
+ trgif = BaseIcons["addRast"].GetBitmap(bmpsize)
self.rast_icon = il.Add(trgif)
- trgif = icons["addRast3d"].GetBitmap(bmpsize)
+ trgif = LMIcons["addRast3d"].GetBitmap(bmpsize)
self.rast3d_icon = il.Add(trgif)
- trgif = icons["addRgb"].GetBitmap(bmpsize)
+ trgif = LMIcons["addRgb"].GetBitmap(bmpsize)
self.rgb_icon = il.Add(trgif)
- trgif = icons["addHis"].GetBitmap(bmpsize)
+ trgif = LMIcons["addHis"].GetBitmap(bmpsize)
self.his_icon = il.Add(trgif)
- trgif = icons["addShaded"].GetBitmap(bmpsize)
+ trgif = LMIcons["addShaded"].GetBitmap(bmpsize)
self.shaded_icon = il.Add(trgif)
- trgif = icons["addRArrow"].GetBitmap(bmpsize)
+ trgif = LMIcons["addRArrow"].GetBitmap(bmpsize)
self.rarrow_icon = il.Add(trgif)
- trgif = icons["addRNum"].GetBitmap(bmpsize)
+ trgif = LMIcons["addRNum"].GetBitmap(bmpsize)
self.rnum_icon = il.Add(trgif)
- trgif = icons["addVect"].GetBitmap(bmpsize)
+ trgif = BaseIcons["addVect"].GetBitmap(bmpsize)
self.vect_icon = il.Add(trgif)
- trgif = icons["addThematic"].GetBitmap(bmpsize)
+ trgif = LMIcons["addThematic"].GetBitmap(bmpsize)
self.theme_icon = il.Add(trgif)
- trgif = icons["addChart"].GetBitmap(bmpsize)
+ trgif = LMIcons["addChart"].GetBitmap(bmpsize)
self.chart_icon = il.Add(trgif)
- trgif = icons["addGrid"].GetBitmap(bmpsize)
+ trgif = LMIcons["addGrid"].GetBitmap(bmpsize)
self.grid_icon = il.Add(trgif)
- trgif = icons["addGeodesic"].GetBitmap(bmpsize)
+ trgif = LMIcons["addGeodesic"].GetBitmap(bmpsize)
self.geodesic_icon = il.Add(trgif)
- trgif = icons["addRhumb"].GetBitmap(bmpsize)
+ trgif = LMIcons["addRhumb"].GetBitmap(bmpsize)
self.rhumb_icon = il.Add(trgif)
- trgif = icons["addLabels"].GetBitmap(bmpsize)
+ trgif = LMIcons["addLabels"].GetBitmap(bmpsize)
self.labels_icon = il.Add(trgif)
- trgif = icons["addCmd"].GetBitmap(bmpsize)
+ trgif = LMIcons["addCmd"].GetBitmap(bmpsize)
self.cmd_icon = il.Add(trgif)
self.AssignImageList(il)
@@ -692,7 +738,7 @@
grouptext = _('Layer group:') + str(self.groupnode)
self.groupnode += 1
else:
- btnbmp = Icons['layerManager']["layerOptions"].GetBitmap((16,16))
+ btnbmp = LMIcons["layerOptions"].GetBitmap((16,16))
ctrl = buttons.GenBitmapButton(self, id = wx.ID_ANY, bitmap = btnbmp, size = (24,24))
ctrl.SetToolTipString(_("Click to edit layer settings"))
self.Bind(wx.EVT_BUTTON, self.OnLayerContextMenu, ctrl)
@@ -1257,7 +1303,7 @@
text = self.GetItemText(dragItem)
if self.GetPyData(dragItem)[0]['ctrl']:
# recreate data layer
- btnbmp = Icons['layerManager']["layerOptions"].GetBitmap((16,16))
+ btnbmp = LMIcons["layerOptions"].GetBitmap((16,16))
newctrl = buttons.GenBitmapButton(self, id = wx.ID_ANY, bitmap = btnbmp, size = (24, 24))
newctrl.SetToolTipString(_("Click to edit layer settings"))
self.Bind(wx.EVT_BUTTON, self.OnLayerContextMenu, newctrl)
Modified: grass/branches/develbranch_6/gui/wxpython/lmgr/toolbars.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/lmgr/toolbars.py 2011-12-18 16:21:34 UTC (rev 49807)
+++ grass/branches/develbranch_6/gui/wxpython/lmgr/toolbars.py 2011-12-18 16:36:20 UTC (rev 49808)
@@ -28,11 +28,9 @@
from core import globalvar
from core.gcmd import RunCommand
from nviz.preferences import NvizPreferencesDialog
-from gui_core.toolbars import BaseToolbar
+from gui_core.toolbars import BaseToolbar, BaseIcons
+from icons.icon import MetaIcon
-sys.path.append(os.path.join(globalvar.ETCWXDIR, "icons"))
-from icons.icon import Icons
-
class LMWorkspaceToolbar(BaseToolbar):
"""!Layer Manager `workspace` toolbar
"""
@@ -47,7 +45,16 @@
def _toolbarData(self):
"""!Toolbar data
"""
- icons = Icons['layerManager']
+ icons = {
+ 'newdisplay' : MetaIcon(img = 'monitor-create',
+ label = _('Start new map display')),
+ 'workspaceNew' : MetaIcon(img = 'create',
+ label = _('Create new workspace (Ctrl+N)')),
+ 'workspaceOpen' : MetaIcon(img = 'open',
+ label = _('Open existing workspace file (Ctrl+O)')),
+ 'workspaceSave' : MetaIcon(img = 'save',
+ label = _('Save current workspace to file (Ctrl+S)')),
+ }
return self._getToolbarData((('newdisplay', icons["newdisplay"],
self.parent.OnNewDisplay),
(None, ),
@@ -73,7 +80,23 @@
def _toolbarData(self):
"""!Toolbar data
"""
- icons = Icons['layerManager']
+ icons = {
+ 'addMulti' : MetaIcon(img = 'layer-open',
+ label = _('Add multiple raster or vector map layers (Ctrl+Shift+L)')),
+ 'addRast' : BaseIcons['addRast'].SetLabel(_("Add raster map layer (Ctrl+Shift+R)")),
+ 'rastMisc' : MetaIcon(img = 'layer-raster-more',
+ label = _('Add various raster map layers (RGB, HIS, shaded relief...)')),
+ 'addVect' : BaseIcons['addRast'].SetLabel(_("Add vector map layer (Ctrl+Shift+V)")),
+ 'vectMisc' : MetaIcon(img = 'layer-vector-more',
+ label = _('Add various vector map layers (thematic, chart...)')),
+ 'addGroup' : MetaIcon(img = 'layer-group-add',
+ label = _('Add group')),
+ 'addOverlay' : MetaIcon(img = 'layer-more',
+ label = _('Add grid or vector labels overlay')),
+ 'delCmd' : MetaIcon(img = 'layer-remove',
+ label = _('Delete selected map layer')),
+ }
+
return self._getToolbarData((('addMulti', icons["addMulti"],
self.parent.OnAddMaps),
('addrast', icons["addRast"],
@@ -106,17 +129,29 @@
def _toolbarData(self):
"""!Toolbar data
"""
- icons = Icons['layerManager']
+ icons = {
+ 'import' : MetaIcon(img = 'layer-import',
+ label = _('Import/link raster or vector data')),
+ 'mapcalc' : MetaIcon(img = 'calculator',
+ label = _('Raster Map Calculator')),
+ 'modeler' : MetaIcon(img = 'modeler-main',
+ label = _('Graphical Modeler')),
+ 'georectify' : MetaIcon(img = 'georectify',
+ label = _('Georectifier')),
+ 'composer': MetaIcon(img = 'print-compose',
+ label = _('Cartographic Composer')),
+ }
+
return self._getToolbarData((('importMap', icons["import"],
self.parent.OnImportMenu),
(None, ),
('mapCalc', icons["mapcalc"],
self.parent.OnMapCalculator),
- ('georect', Icons["georectify"]["georectify"],
+ ('georect', icons["georectify"],
self.parent.OnGCPManager),
('modeler', icons["modeler"],
self.parent.OnGModeler),
- ('mapOutput', icons['mapOutput'],
+ ('mapOutput', icons['composer'],
self.parent.OnPsMap)
))
@@ -134,10 +169,14 @@
def _toolbarData(self):
"""!Toolbar data
"""
- icons = Icons['layerManager']
+ icons = {
+ 'settings' : BaseIcons['settings'].SetLabel(_('GUI settings')),
+ 'help' : BaseIcons['help'].SetLabel(_('GRASS manual')),
+ }
+
return self._getToolbarData((('settings', icons["settings"],
self.parent.OnPreferences),
- ('help', Icons["misc"]["help"],
+ ('help', icons["help"],
self.parent.OnHelp),
))
@@ -155,7 +194,13 @@
def _toolbarData(self):
"""!Toolbar data
"""
- icons = Icons['layerManager']
+ icons = {
+ 'vdigit' : MetaIcon(img = 'edit',
+ label = _('Edit vector maps')),
+ 'attrTable' : MetaIcon(img = 'table',
+ label = _('Show attribute table')),
+ }
+
return self._getToolbarData((('vdigit', icons["vdigit"],
self.parent.OnVDigit),
('attribute', icons["attrTable"],
@@ -180,8 +225,18 @@
def _toolbarData(self):
"""!Toolbar data"""
- icons = Icons['nviz']
- return self._getToolbarData((("nvizCmd", icons['nvizCmd'],
+ icons = {
+ 'cmd' : MetaIcon(img = 'script-save',
+ label = _('Generate command for m.nviz.image'),
+ desc = _('Generate command for m.nviz.image based on current state')),
+ 'settings' : MetaIcon(img = '3d-settings',
+ label = _('3D view mode settings'),
+ desc = _('Show 3D view mode settings dialog')),
+ 'help' : MetaIcon(img = '3d-help',
+ label = _('Show 3D view mode manual')),
+ }
+
+ return self._getToolbarData((("nvizCmd", icons['cmd'],
self.OnNvizCmd),
(None, ),
("settings", icons["settings"],
Modified: grass/branches/develbranch_6/gui/wxpython/mapdisp/frame.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/mapdisp/frame.py 2011-12-18 16:21:34 UTC (rev 49807)
+++ grass/branches/develbranch_6/gui/wxpython/mapdisp/frame.py 2011-12-18 16:36:20 UTC (rev 49808)
@@ -36,14 +36,13 @@
from core import globalvar
from core.render import EVT_UPDATE_PRGBAR
from vdigit.toolbars import VDigitToolbar
-from mapdisp.toolbars import MapToolbar
+from mapdisp.toolbars import MapToolbar, NvizIcons
from mapdisp.gprint import PrintOptions
from core.gcmd import GError, GMessage, RunCommand
from dbmgr.dialogs import DisplayAttributesDialog
from core.utils import ListOfCatsToRange, GetLayerNameFromCmd
from gui_core.dialogs import GetImageHandlers, ImageSizeDialog, DecorationDialog, TextLayerDialog
from core.debug import Debug
-from icon import Icons
from core.settings import UserSettings
from gui_core.mapdisp import MapFrameBase
from mapdisp.mapwindow import BufferedWindow
@@ -270,9 +269,9 @@
self._layerManager.gm_cb.GetPage(page).maptree.mapdisplay.toolbars['map'].combo.Delete(1)
self.toolbars['map'].Enable2D(False)
# add rotate tool to map toolbar
- self.toolbars['map'].InsertTool((('rotate', Icons['nviz']['rotate'],
+ self.toolbars['map'].InsertTool((('rotate', NvizIcons['rotate'],
self.OnRotate, wx.ITEM_CHECK, 7),)) # 7 is position
- self.toolbars['map'].InsertTool((('flyThrough', Icons['nviz']['flyThrough'],
+ self.toolbars['map'].InsertTool((('flyThrough', NvizIcons['flyThrough'],
self.OnFlyThrough, wx.ITEM_CHECK, 8),))
self.toolbars['map'].ChangeToolsDesc(mode2d = False)
# update status bar
@@ -894,34 +893,6 @@
else:
return cmd
- def OnAnalyze(self, event):
- """!Analysis tools menu
- """
- point = wx.GetMousePosition()
- toolsmenu = wx.Menu()
- icons = Icons['displayWindow']
-
- # Add items to the menu
- measure = wx.MenuItem(toolsmenu, wx.ID_ANY, icons["measure"].GetLabel())
- measure.SetBitmap(icons["measure"].GetBitmap(self.iconsize))
- toolsmenu.AppendItem(measure)
- self.Bind(wx.EVT_MENU, self.OnMeasure, measure)
-
- profile = wx.MenuItem(toolsmenu, wx.ID_ANY, icons["profile"].GetLabel())
- profile.SetBitmap(icons["profile"].GetBitmap(self.iconsize))
- toolsmenu.AppendItem(profile)
- self.Bind(wx.EVT_MENU, self.Profile, profile)
-
- histogram = wx.MenuItem(toolsmenu, wx.ID_ANY, icons["histogram"].GetLabel())
- histogram.SetBitmap(icons["histogram"].GetBitmap(self.iconsize))
- toolsmenu.AppendItem(histogram)
- self.Bind(wx.EVT_MENU, self.Histogram, histogram)
-
- # Popup the menu. If an item is selected then its handler
- # will be called before PopupMenu returns.
- self.PopupMenu(toolsmenu)
- toolsmenu.Destroy()
-
def OnMeasure(self, event):
"""!Init measurement routine that calculates map distance
along transect drawn on map display
@@ -1082,41 +1053,6 @@
self.histogram.Update()
- def OnDecoration(self, event):
- """!Decorations overlay menu
- """
- point = wx.GetMousePosition()
- decmenu = wx.Menu()
- icons = Icons['displayWindow']
-
- # Add items to the menu
- AddScale = wx.MenuItem(decmenu, wx.ID_ANY, icons["addBarscale"].GetLabel())
- AddScale.SetBitmap(icons["addBarscale"].GetBitmap(self.iconsize))
- decmenu.AppendItem(AddScale)
- self.Bind(wx.EVT_MENU, self.OnAddBarscale, AddScale)
- # temporary
- if self.IsPaneShown('3d'):
- AddScale.Enable(False)
- AddArrow = wx.MenuItem(decmenu, wx.ID_ANY, icons['addNorthArrow'].GetLabel())
- AddArrow.SetBitmap(icons['addNorthArrow'].GetBitmap(self.iconsize))
- decmenu.AppendItem(AddArrow)
- self.Bind(wx.EVT_MENU, self.OnAddArrow, AddArrow)
-
- AddLegend = wx.MenuItem(decmenu, wx.ID_ANY, icons["addLegend"].GetLabel())
- AddLegend.SetBitmap(icons["addLegend"].GetBitmap(self.iconsize))
- decmenu.AppendItem(AddLegend)
- self.Bind(wx.EVT_MENU, self.OnAddLegend, AddLegend)
-
- AddText = wx.MenuItem(decmenu, wx.ID_ANY, icons["addText"].GetLabel())
- AddText.SetBitmap(icons["addText"].GetBitmap(self.iconsize))
- decmenu.AppendItem(AddText)
- self.Bind(wx.EVT_MENU, self.OnAddText, AddText)
-
- # Popup the menu. If an item is selected then its handler
- # will be called before PopupMenu returns.
- self.PopupMenu(decmenu)
- decmenu.Destroy()
-
def OnAddBarscale(self, event):
"""!Handler for scale/arrow map decoration menu selection.
"""
Modified: grass/branches/develbranch_6/gui/wxpython/mapdisp/toolbars.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/mapdisp/toolbars.py 2011-12-18 16:21:34 UTC (rev 49807)
+++ grass/branches/develbranch_6/gui/wxpython/mapdisp/toolbars.py 2011-12-18 16:36:20 UTC (rev 49808)
@@ -18,11 +18,48 @@
import wx
-from gui_core.toolbars import BaseToolbar
-from icons.icon import Icons
+from gui_core.toolbars import BaseToolbar, BaseIcons
from nviz.main import haveNviz
from vdigit.main import haveVDigit
+from icons.icon import MetaIcon
+MapIcons = {
+ 'query' : MetaIcon(img = 'info',
+ label = _('Query raster/vector map(s)'),
+ desc = _('Query selected raster/vector map(s)')),
+ 'addBarscale': MetaIcon(img = 'scalebar-add',
+ label = _('Add scalebar and north arrow')),
+ 'addLegend' : MetaIcon(img = 'legend-add',
+ label = _('Add legend')),
+ 'addNorthArrow': MetaIcon(img = 'north-arrow-add',
+ label = _('North Arrow')),
+ 'analyze' : MetaIcon(img = 'layer-raster-analyze',
+ label = _('Analyze map'),
+ desc = _('Measuring, profiling, histogramming, ...')),
+ 'measure' : MetaIcon(img = 'measure-length',
+ label = _('Measure distance')),
+ 'profile' : MetaIcon(img = 'layer-raster-profile',
+ label = _('Profile surface map')),
+ 'scatter' : MetaIcon(img = 'layer-raster-profile',
+ label = _("Create bivariate scatterplot of raster maps")),
+ 'addText' : MetaIcon(img = 'text-add',
+ label = _('Add text layer')),
+ 'histogram' : MetaIcon(img = 'layer-raster-histogram',
+ label = _('Create histogram of raster map')),
+ }
+
+NvizIcons = {
+ 'rotate' : MetaIcon(img = '3d-rotate',
+ label = _('Rotate 3D scene'),
+ desc = _('Drag with mouse to rotate 3D scene')),
+ 'flyThrough': MetaIcon(img = 'flythrough',
+ label = _('Fly-through mode'),
+ desc = _('Drag with mouse, hold Ctrl down for different mode'
+ ' or Shift to accelerate')),
+ 'zoomIn' : BaseIcons['zoomIn'].SetLabel(desc = _('Click mouse to zoom')),
+ 'zoomOut' : BaseIcons['zoomOut'].SetLabel(desc = _('Click mouse to unzoom'))
+ }
+
class MapToolbar(BaseToolbar):
"""!Map Display toolbar
"""
@@ -95,51 +132,50 @@
self.OnTool(None)
- self.EnableTool(self.zoomback, False)
+ self.EnableTool(self.zoomBack, False)
self.FixSize(width = 90)
def _toolbarData(self):
"""!Toolbar data"""
- icons = Icons['displayWindow']
- return self._getToolbarData((('displaymap', icons['display'],
+ return self._getToolbarData((('displayMap', BaseIcons['display'],
self.parent.OnDraw),
- ('rendermap', icons['render'],
+ ('renderMap', BaseIcons['render'],
self.parent.OnRender),
- ('erase', icons['erase'],
+ ('erase', BaseIcons['erase'],
self.parent.OnErase),
(None, ),
- ('pointer', icons['pointer'],
+ ('pointer', BaseIcons['pointer'],
self.parent.OnPointer,
wx.ITEM_CHECK),
- ('query', icons['query'],
+ ('query', MapIcons['query'],
self.parent.OnQuery,
wx.ITEM_CHECK),
- ('pan', icons['pan'],
+ ('pan', BaseIcons['pan'],
self.parent.OnPan,
wx.ITEM_CHECK),
- ('zoomin', icons['zoomIn'],
+ ('zoomIn', BaseIcons['zoomIn'],
self.parent.OnZoomIn,
wx.ITEM_CHECK),
- ('zoomout', icons['zoomOut'],
+ ('zoomOut', BaseIcons['zoomOut'],
self.parent.OnZoomOut,
wx.ITEM_CHECK),
- ('zoomextent', icons['zoomExtent'],
+ ('zoomExtent', BaseIcons['zoomExtent'],
self.parent.OnZoomToMap),
- ('zoomback', icons['zoomBack'],
+ ('zoomBack', BaseIcons['zoomBack'],
self.parent.OnZoomBack),
- ('zoommenu', icons['zoomMenu'],
+ ('zoomMenu', BaseIcons['zoomMenu'],
self.parent.OnZoomMenu),
(None, ),
- ('analyze', icons['analyze'],
- self.parent.OnAnalyze),
+ ('analyze', MapIcons['analyze'],
+ self.OnAnalyze),
(None, ),
- ('dec', icons['overlay'],
- self.parent.OnDecoration),
+ ('overlay', BaseIcons['overlay'],
+ self.OnDecoration),
(None, ),
- ('savefile', icons['saveFile'],
+ ('saveFile', BaseIcons['saveFile'],
self.parent.SaveToFile),
- ('printmap', icons['print'],
+ ('printMap', BaseIcons['print'],
self.parent.PrintMenu),
(None, ))
)
@@ -167,16 +203,16 @@
def ChangeToolsDesc(self, mode2d):
"""!Change description of zoom tools for 2D/3D view"""
if mode2d:
- set = 'displayWindow'
+ icons = BaseIcons
else:
- set = 'nviz'
+ icons = NvizIcons
for i, data in enumerate(self._data):
- for tool, toolname in (('zoomin', 'zoomIn'),('zoomout', 'zoomOut')):
+ for tool in (('zoomIn', 'zoomOut')):
if data[0] == tool:
tmp = list(data)
- tmp[4] = Icons[set][toolname].GetDesc()
+ tmp[4] = icons[tool].GetDesc()
self._data[i] = tuple(tmp)
-
+
def OnSelectTool(self, event):
"""!Select / enable tool available in tools list
"""
@@ -197,7 +233,27 @@
self.ExitToolbars()
self.parent.AddToolbar("vdigit")
self.parent.MapWindow.SetFocus()
+
+ def OnAnalyze(self, event):
+ """!Analysis tools menu
+ """
+ self._onMenu(((MapIcons["measure"], self.parent.OnMeasure),
+ (MapIcons["profile"], self.parent.OnProfile),
+ (MapIcons["scatter"], self.parent.OnScatterplot),
+ (BaseIcons["histogram"], self.parent.OnHistogram)))
+ def OnDecoration(self, event):
+ """!Decorations overlay menu
+ """
+ if self.parent.IsPaneShown('3d'):
+ self._onMenu(((MapIcons["addNorthArrow"], self.parent.OnAddArrow),
+ (MapIcons["addLegend"], self.parent.OnAddLegend),
+ (MapIcons["addText"], self.parent.OnAddText)))
+ else:
+ self._onMenu(((MapIcons["addBarscale"], self.parent.OnAddBarscale),
+ (MapIcons["addLegend"], self.parent.OnAddLegend),
+ (MapIcons["addText"], self.parent.OnAddText)))
+
def ExitToolbars(self):
if self.parent.GetToolbar('vdigit'):
self.parent.toolbars['vdigit'].OnExit()
@@ -206,7 +262,7 @@
def Enable2D(self, enabled):
"""!Enable/Disable 2D display mode specific tools"""
- for tool in (self.zoommenu,
+ for tool in (self.zoomMenu,
self.analyze,
- self.printmap):
+ self.printMap):
self.EnableTool(tool, enabled)
Modified: grass/branches/develbranch_6/gui/wxpython/modules/histogram.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/modules/histogram.py 2011-12-18 16:21:34 UTC (rev 49807)
+++ grass/branches/develbranch_6/gui/wxpython/modules/histogram.py 2011-12-18 16:36:20 UTC (rev 49808)
@@ -29,9 +29,8 @@
from gui_core.dialogs import GetImageHandlers, ImageSizeDialog
from gui_core.preferences import DefaultFontDialog
from core.debug import Debug
-from icon import Icons
from core.gcmd import GError
-from gui_core.toolbars import BaseToolbar
+from gui_core.toolbars import BaseToolbar, BaseIcons
class BufferedWindow(wx.Window):
"""!A Buffered window class.
@@ -474,21 +473,20 @@
def _toolbarData(self):
"""!Toolbar data"""
- icons = Icons['displayWindow']
- return self._getToolbarData((('histogram', icons["histogram"],
+ return self._getToolbarData((('histogram', BaseIcons["histogramD"],
self.parent.OnOptions),
- ('rendermao', icons["display"],
+ ('render', BaseIcons["display"],
self.parent.OnRender),
- ('erase', icons["erase"],
+ ('erase', BaseIcons["erase"],
self.parent.OnErase),
- ('font', Icons['misc']["font"],
+ ('font', BaseIcons["font"],
self.parent.SetHistFont),
(None, ),
- ('save', icons["saveFile"],
+ ('save', BaseIcons["saveFile"],
self.parent.SaveToFile),
- ('hprint', icons["print"],
+ ('hprint', BaseIcons["print"],
self.parent.PrintMenu),
(None, ),
- ('quit', Icons['misc']["quit"],
+ ('quit', BaseIcons["quit"],
self.parent.OnQuit))
)
Modified: grass/branches/develbranch_6/gui/wxpython/psmap/frame.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/psmap/frame.py 2011-12-18 16:21:34 UTC (rev 49807)
+++ grass/branches/develbranch_6/gui/wxpython/psmap/frame.py 2011-12-18 16:36:20 UTC (rev 49808)
@@ -41,7 +41,6 @@
from gui_core.menu import Menu
from gui_core.goutput import CmdThread, EVT_CMD_DONE
from psmap.toolbars import PsMapToolbar
-from icon import Icons
from core.gcmd import RunCommand, GError, GMessage
from gui_core.forms import GUI
from psmap.menudata import PsMapData
@@ -579,46 +578,7 @@
dlg = MainVectorDialog(self, id = id, settings = self.instruction)
self.openDialogs['vector'] = dlg
self.openDialogs['vector'].Show()
-
- def OnDecoration(self, event):
- """!Decorations overlay menu
- """
- decmenu = wx.Menu()
- # legend
- AddLegend = wx.MenuItem(decmenu, wx.ID_ANY, Icons['psMap']["addLegend"].GetLabel())
- AddLegend.SetBitmap(Icons['psMap']["addLegend"].GetBitmap(self.iconsize))
- decmenu.AppendItem(AddLegend)
- self.Bind(wx.EVT_MENU, self.OnAddLegend, AddLegend)
- # mapinfo
- AddMapinfo = wx.MenuItem(decmenu, wx.ID_ANY, Icons['psMap']["addMapinfo"].GetLabel())
- AddMapinfo.SetBitmap(Icons['psMap']["addMapinfo"].GetBitmap(self.iconsize))
- decmenu.AppendItem(AddMapinfo)
- self.Bind(wx.EVT_MENU, self.OnAddMapinfo, AddMapinfo)
- # scalebar
- AddScalebar = wx.MenuItem(decmenu, wx.ID_ANY, Icons['psMap']["addScalebar"].GetLabel())
- AddScalebar.SetBitmap(Icons['psMap']["addScalebar"].GetBitmap(self.iconsize))
- decmenu.AppendItem(AddScalebar)
- self.Bind(wx.EVT_MENU, self.OnAddScalebar, AddScalebar)
- # text
- AddText = wx.MenuItem(decmenu, wx.ID_ANY, Icons['psMap']["addText"].GetLabel())
- AddText.SetBitmap(Icons['psMap']["addText"].GetBitmap(self.iconsize))
- decmenu.AppendItem(AddText)
- self.Bind(wx.EVT_MENU, self.OnAddText, AddText)
- # eps image
- AddImage = wx.MenuItem(decmenu, wx.ID_ANY, Icons['psMap']["addImage"].GetLabel())
- AddImage.SetBitmap(Icons['psMap']["addImage"].GetBitmap(self.iconsize))
- decmenu.AppendItem(AddImage)
- self.Bind(wx.EVT_MENU, self.OnAddImage, AddImage)
- # north arrow image
- AddNorthArrow = wx.MenuItem(decmenu, wx.ID_ANY, Icons['psMap']["addNorthArrow"].GetLabel())
- AddNorthArrow.SetBitmap(Icons['psMap']["addNorthArrow"].GetBitmap(self.iconsize))
- decmenu.AppendItem(AddNorthArrow)
- self.Bind(wx.EVT_MENU, self.OnAddNorthArrow, AddNorthArrow)
- # Popup the menu. If an item is selected then its handler
- # will be called before PopupMenu returns.
- self.PopupMenu(decmenu)
- decmenu.Destroy()
-
+
def OnAddScalebar(self, event):
"""!Add scalebar"""
if projInfo()['proj'] == 'll':
Modified: grass/branches/develbranch_6/gui/wxpython/psmap/toolbars.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/psmap/toolbars.py 2011-12-18 16:21:34 UTC (rev 49807)
+++ grass/branches/develbranch_6/gui/wxpython/psmap/toolbars.py 2011-12-18 16:36:20 UTC (rev 49808)
@@ -20,11 +20,9 @@
import wx
from core import globalvar
-from gui_core.toolbars import BaseToolbar
+from gui_core.toolbars import BaseToolbar, BaseIcons
+from icon import MetaIcon
-sys.path.append(os.path.join(globalvar.ETCWXDIR, "icons"))
-from icon import Icons
-
class PsMapToolbar(BaseToolbar):
def __init__(self, parent):
"""!Toolbar Cartographic Composer (psmap.py)
@@ -49,7 +47,44 @@
def _toolbarData(self):
"""!Toolbar data
"""
- icons = Icons['psMap']
+ icons = {
+ 'scriptSave' : MetaIcon(img = 'script-save',
+ label = _('Generate text file with mapping instructions')),
+ 'scriptLoad' : MetaIcon(img = 'script-load',
+ label = _('Load text file with mapping instructions')),
+ 'psExport' : MetaIcon(img = 'ps-export',
+ label = _('Generate PostScript output')),
+ 'pdfExport' : MetaIcon(img = 'pdf-export',
+ label = _('Generate PDF output')),
+ 'pageSetup' : MetaIcon(img = 'page-settings',
+ label = _('Page setup'),
+ desc = _('Specify paper size, margins and orientation')),
+ 'fullExtent' : MetaIcon(img = 'zoom-extent',
+ label = _("Full extent"),
+ desc = _("Zoom to full extent")),
+ 'addMap' : MetaIcon(img = 'layer-add',
+ label = _("Map frame"),
+ desc = _("Click and drag to place map frame")),
+ 'deleteObj' : MetaIcon(img = 'layer-remove',
+ label = _("Delete selected object")),
+ 'preview' : MetaIcon(img = 'execute',
+ label = _("Show preview")),
+ 'quit' : MetaIcon(img = 'quit',
+ label = _('Quit Cartographic Composer')),
+ 'addText' : MetaIcon(img = 'text-add',
+ label = _('Text')),
+ 'addMapinfo' : MetaIcon(img = 'map-info',
+ label = _('Map info')),
+ 'addLegend' : MetaIcon(img = 'legend-add',
+ label = _('Legend')),
+ 'addScalebar' : MetaIcon(img = 'scalebar-add',
+ label = _('Scale bar')),
+ 'addImage' : MetaIcon(img = 'image-add',
+ label = _('Image')),
+ 'addNorthArrow': MetaIcon(img = 'north-arrow-add',
+ label = _('North Arrow')),
+ }
+
return self._getToolbarData((('loadFile', icons['scriptLoad'],
self.parent.OnLoadFile),
('instructionFile', icons['scriptSave'],
@@ -58,25 +93,25 @@
('pagesetup', icons['pageSetup'],
self.parent.OnPageSetup),
(None, ),
- ("pointer", Icons["displayWindow"]["pointer"],
+ ("pointer", BaseIcons["pointer"],
self.parent.OnPointer, wx.ITEM_CHECK),
- ('pan', Icons["displayWindow"]['pan'],
+ ('pan', BaseIcons['pan'],
self.parent.OnPan, wx.ITEM_CHECK),
- ("zoomin", Icons["displayWindow"]["zoomIn"],
+ ("zoomin", BaseIcons["zoomIn"],
self.parent.OnZoomIn, wx.ITEM_CHECK),
- ("zoomout", Icons["displayWindow"]["zoomOut"],
+ ("zoomout", BaseIcons["zoomOut"],
self.parent.OnZoomOut, wx.ITEM_CHECK),
('zoomAll', icons['fullExtent'],
self.parent.OnZoomAll),
(None, ),
('addMap', icons['addMap'],
self.parent.OnAddMap, wx.ITEM_CHECK),
- ('addRaster', icons['addRast'],
+ ('addRaster', BaseIcons['addRast'],
self.parent.OnAddRaster),
- ('addVector', icons['addVect'],
+ ('addVector', BaseIcons['addVect'],
self.parent.OnAddVect),
- ("dec", Icons["displayWindow"]["overlay"],
- self.parent.OnDecoration),
+ ("dec", BaseIcons["overlay"],
+ self.OnDecoration),
("delete", icons["deleteObj"],
self.parent.OnDelete),
(None, ),
@@ -87,8 +122,19 @@
('generatePDF', icons['pdfExport'],
self.parent.OnPDFFile),
(None, ),
- ("help", Icons['misc']['help'],
+ ("help", BaseIcons['help'],
self.parent.OnHelp),
('quit', icons['quit'],
self.parent.OnCloseWindow))
)
+
+ def OnDecoration(self, event):
+ """!Decorations overlay menu
+ """
+ self._onMenu(((PsMapIcons["addLegend"], self.parent.OnAddLegend),
+ (PsMapIcons["addMapinfo"], self.parent.OnAddMapinfo),
+ (PsMapIcons["addScalebar"], self.parent.OnAddScalebar),
+ (PsMapIcons["addText"], self.parent.OnAddText),
+ (PsMapIcons["addImage"], self.parent.OnAddImage),
+ (PsMapIcons["addNorthArrow"], self.parent.OnAddNorthArrow)))
+
Modified: grass/branches/develbranch_6/gui/wxpython/vdigit/toolbars.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/vdigit/toolbars.py 2011-12-18 16:21:34 UTC (rev 49807)
+++ grass/branches/develbranch_6/gui/wxpython/vdigit/toolbars.py 2011-12-18 16:36:20 UTC (rev 49808)
@@ -17,14 +17,14 @@
from grass.script import core as grass
-from gui_core.toolbars import BaseToolbar
+from gui_core.toolbars import BaseToolbar, BaseIcons
from gui_core.dialogs import CreateNewVector
-from icons.icon import Icons
from vdigit.preferences import VDigitSettingsDialog
from vdigit.main import VDigit
from core.debug import Debug
from core.settings import UserSettings
from core.gcmd import GError
+from icons.icon import MetaIcon
class VDigitToolbar(BaseToolbar):
"""!Toolbar for digitization
@@ -76,7 +76,59 @@
"""!Toolbar data
"""
data = []
- icons = Icons['vdigit']
+
+ icons = {
+ 'addPoint' : MetaIcon(img = 'point-create',
+ label = _('Digitize new point'),
+ desc = _('Left: new point')),
+ 'addLine' : MetaIcon(img = 'line-create',
+ label = _('Digitize new line'),
+ desc = _('Left: new point; Ctrl+Left: undo last point; Right: close line')),
+ 'addBoundary' : MetaIcon(img = 'boundary-create',
+ label = _('Digitize new boundary'),
+ desc = _('Left: new point; Ctrl+Left: undo last point; Right: close line')),
+ 'addCentroid' : MetaIcon(img = 'centroid-create',
+ label = _('Digitize new centroid'),
+ desc = _('Left: new point')),
+ 'addArea' : MetaIcon(img = 'polygon-create',
+ label = _('Digitize new area (composition of boundaries without category and one centroid with category)'),
+ desc = _('Left: new point')),
+ 'addVertex' : MetaIcon(img = 'vertex-create',
+ label = _('Add new vertex'),
+ desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
+ 'deleteLine' : MetaIcon(img = 'line-delete',
+ label = _('Delete feature(s)'),
+ desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
+ 'displayAttr' : MetaIcon(img = 'attributes-display',
+ label = _('Display/update attributes'),
+ desc = _('Left: Select')),
+ 'displayCats' : MetaIcon(img = 'cats-display',
+ label = _('Display/update categories'),
+ desc = _('Left: Select')),
+ 'editLine' : MetaIcon(img = 'line-edit',
+ label = _('Edit line/boundary'),
+ desc = _('Left: new point; Ctrl+Left: undo last point; Right: close line')),
+ 'moveLine' : MetaIcon(img = 'line-move',
+ label = _('Move feature(s)'),
+ desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
+ 'moveVertex' : MetaIcon(img = 'vertex-move',
+ label = _('Move vertex'),
+ desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
+ 'removeVertex' : MetaIcon(img = 'vertex-delete',
+ label = _('Remove vertex'),
+ desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
+ 'settings' : BaseIcons['settings'].SetLabel(_('Digitization settings')),
+ 'quit' : BaseIcons['quit'].SetLabel(label = _('Quit digitizer'),
+ desc = _('Quit digitizer and save changes')),
+ 'additionalTools' : MetaIcon(img = 'tools',
+ label = _('Additional tools '
+ '(copy, flip, connect, etc.)'),
+ desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
+ 'undo' : MetaIcon(img = 'undo',
+ label = _('Undo'),
+ desc = _('Undo previous changes')),
+ }
+
return self._getToolbarData(((None, ),
("addPoint", icons["addPoint"],
self.OnAddPoint,
Modified: grass/branches/develbranch_6/gui/wxpython/wxplot/base.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/wxplot/base.py 2011-12-18 16:21:34 UTC (rev 49807)
+++ grass/branches/develbranch_6/gui/wxpython/wxplot/base.py 2011-12-18 16:36:20 UTC (rev 49808)
@@ -4,6 +4,7 @@
@brief Base classes for iinteractive plotting using PyPlot
Classes:
+ - base::PlotIcons
- base::BasePlotFrame
(C) 2011 by the GRASS Development Team
@@ -20,13 +21,29 @@
import wx
import wx.lib.plot as plot
-from core.globalvar import ETCICONDIR
-from core.settings import UserSettings
-from wxplot.dialogs import TextDialog, OptDialog
-from core.render import Map
+from core.globalvar import ETCICONDIR
+from core.settings import UserSettings
+from wxplot.dialogs import TextDialog, OptDialog
+from core.render import Map
+from icons.icon import MetaIcon
+from gui_core.toolbars import BaseIcons
import grass.script as grass
+PlotIcons = {
+ 'draw' : MetaIcon(img = 'show',
+ label = _('Draw/re-draw plot')),
+ 'transect' : MetaIcon(img = 'layer-raster-profile',
+ label = _('Draw transect in map display window to profile')),
+ 'options' : MetaIcon(img = 'settings',
+ label = _('Plot options')),
+ 'statistics' : MetaIcon(img = 'check',
+ label = _('Plot statistics')),
+ 'save' : MetaIcon(img = 'save',
+ label = _('Save profile data to CSV file')),
+ 'quit' : BaseIcons['quit'].SetLabel(_('Quit plot tool')),
+ }
+
class BasePlotFrame(wx.Frame):
"""!Abstract PyPlot display frame class"""
def __init__(self, parent = None, id = wx.ID_ANY, size = (700, 300),
Modified: grass/branches/develbranch_6/gui/wxpython/wxplot/profile.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/wxplot/profile.py 2011-12-18 16:21:34 UTC (rev 49807)
+++ grass/branches/develbranch_6/gui/wxpython/wxplot/profile.py 2011-12-18 16:36:20 UTC (rev 49808)
@@ -34,9 +34,8 @@
"binaries.")
print >> sys.stderr, "wxplot.py: " + msg
-from wxplot.base import BasePlotFrame
-from gui_core.toolbars import BaseToolbar
-from icons.icon import Icons
+from wxplot.base import BasePlotFrame, PlotIcons
+from gui_core.toolbars import BaseToolbar, BaseIcons
from wxplot.dialogs import ProfileRasterDialog, PlotStatsFrame
from core.gcmd import RunCommand
@@ -396,34 +395,33 @@
def _toolbarData(self):
"""!Toolbar data"""
- icons = Icons['plot']
- return self._getToolbarData((('addraster', Icons['layerManager']["addRast"],
+ return self._getToolbarData((('addraster', BaseIcons["addRast"],
self.parent.OnSelectRaster),
- ('transect', icons["transect"],
+ ('transect', PlotIcons["transect"],
self.parent.OnDrawTransect),
(None, ),
- ('draw', icons["draw"],
+ ('draw', PlotIcons["draw"],
self.parent.OnCreateProfile),
- ('erase', Icons['displayWindow']["erase"],
+ ('erase', BaseIcons["erase"],
self.parent.OnErase),
- ('drag', Icons['displayWindow']['pan'],
+ ('drag', BaseIcons['pan'],
self.parent.OnDrag),
- ('zoom', Icons['displayWindow']['zoomIn'],
+ ('zoom', BaseIcons['zoomIn'],
self.parent.OnZoom),
- ('unzoom', Icons['displayWindow']['zoomBack'],
+ ('unzoom', BaseIcons['zoomBack'],
self.parent.OnRedraw),
(None, ),
- ('statistics', icons['statistics'],
+ ('statistics', PlotIcons['statistics'],
self.parent.OnStats),
- ('datasave', icons["save"],
+ ('datasave', PlotIcons["save"],
self.parent.SaveProfileToFile),
- ('image', Icons['displayWindow']["saveFile"],
+ ('image', BaseIcons["saveFile"],
self.parent.SaveToFile),
- ('print', Icons['displayWindow']["print"],
+ ('print', BaseIcons["print"],
self.parent.PrintMenu),
(None, ),
- ('settings', icons["options"],
+ ('settings', PlotIcons["options"],
self.parent.PlotOptionsMenu),
- ('quit', icons["quit"],
+ ('quit', PlotIcons["quit"],
self.parent.OnQuit),
))
More information about the grass-commit
mailing list