2
@package example.toolbars
4
@brief Example toolbars and icons.
7
- toolbars::ExampleMapToolbar
8
- toolbars::ExampleMainToolbar
9
- toolbars::ExampleMiscToolbar
11
(C) 2011-2014 by the GRASS Development Team
12
This program is free software under the GNU General Public
13
License (>=v2). Read the file COPYING that comes with GRASS
16
@author Anna Petrasova <kratochanna gmail.com>
21
from gui_core.toolbars import BaseToolbar, BaseIcons
22
from icons.icon import MetaIcon
25
class ExampleMapToolbar(BaseToolbar):
26
"""!Map toolbar (to control map zoom and rendering)
28
def __init__(self, parent, toolSwitcher):
29
"""!Map toolbar constructor
31
BaseToolbar.__init__(self, parent, toolSwitcher)
33
self.InitToolbar(self._toolbarData())
38
self._default = self.pan
40
for tool in (self.pan, self.zoomIn, self.zoomOut):
41
self.toolSwitcher.AddToolToGroup(group='mouseUse', toolbar=self, tool=tool)
43
self.EnableTool(self.zoomBack, False)
45
def _toolbarData(self):
46
"""!Returns toolbar data (name, icon, handler)"""
47
# BaseIcons are a set of often used icons. It is possible
48
# to reuse icons in ./trunk/gui/icons/grass or add new ones there.
50
return self._getToolbarData((("displaymap", icons["display"],
52
("rendermap", icons["render"],
53
self.parent.OnRender),
54
("erase", icons["erase"],
56
(None, ), # creates separator
59
wx.ITEM_CHECK), # toggle tool
60
("zoomIn", icons["zoomIn"],
63
("zoomOut", icons["zoomOut"],
64
self.parent.OnZoomOut,
67
("zoomBack", icons["zoomBack"],
68
self.parent.OnZoomBack),
69
("zoomToMap", icons["zoomExtent"],
70
self.parent.OnZoomToMap),
74
class ExampleMainToolbar(BaseToolbar):
75
"""!Toolbar with tools related to application functionality
77
def __init__(self, parent):
78
"""!Toolbar constructor
80
BaseToolbar.__init__(self, parent)
82
self.InitToolbar(self._toolbarData())
87
def _toolbarData(self):
89
return self._getToolbarData((("addRaster", BaseIcons['addRast'],
90
self.parent.OnSelectRaster),
94
class ExampleMiscToolbar(BaseToolbar):
95
"""!Toolbar with miscellaneous tools related to app
97
def __init__(self, parent):
98
"""!Toolbar constructor
100
BaseToolbar.__init__(self, parent)
102
self.InitToolbar(self._toolbarData())
103
# realize the toolbar
106
def _toolbarData(self):
109
return self._getToolbarData((("help", icons['help'],
111
("quit", icons['quit'],
112
self.parent.OnCloseWindow),