2
@package gmodeler.toolbars
4
@brief wxGUI Graphical Modeler toolbars classes
7
- toolbars::ModelerToolbar
9
(C) 2010-2011 by the GRASS Development Team
11
This program is free software under the GNU General Public License
12
(>=v2). Read the file COPYING that comes with GRASS for details.
14
@author Martin Landa <landa.martin gmail.com>
22
from core import globalvar
23
from core.utils import _
24
from gui_core.toolbars import BaseToolbar, BaseIcons
26
from icons.icon import MetaIcon
28
class ModelerToolbar(BaseToolbar):
29
"""Graphical modeler toolbaro (see gmodeler.py)
31
def __init__(self, parent):
32
BaseToolbar.__init__(self, parent)
34
# workaround for http://trac.wxwidgets.org/ticket/13888
35
if sys.platform == 'darwin':
36
parent.SetToolBar(self)
38
self.InitToolbar(self._toolbarData())
43
def _toolbarData(self):
46
'new' : MetaIcon(img = 'create',
47
label = _('Create new model (Ctrl+N)')),
48
'open' : MetaIcon(img = 'open',
49
label = _('Load model from file (Ctrl+O)')),
50
'save' : MetaIcon(img = 'save',
51
label = _('Save current model to file (Ctrl+S)')),
52
'toImage' : MetaIcon(img = 'image-export',
53
label = _('Export model to image')),
54
'toPython' : MetaIcon(img = 'python-export',
55
label = _('Export model to Python script')),
56
'actionAdd' : MetaIcon(img = 'module-add',
57
label = _('Add command (GRASS module) to model')),
58
'dataAdd' : MetaIcon(img = 'data-add',
59
label = _('Add data to model')),
60
'relation' : MetaIcon(img = 'relation-create',
61
label = _('Manually define relation between data and commands')),
62
'loop' : MetaIcon(img = 'loop-add',
63
label = _('Add loop/series to model')),
64
'comment' : MetaIcon(img = 'label-add',
65
label = _('Add comment to model')),
66
'run' : MetaIcon(img = 'execute',
67
label = _('Run model')),
68
'validate' : MetaIcon(img = 'check',
69
label = _('Validate model')),
70
'settings' : BaseIcons['settings'].SetLabel(_('Modeler settings')),
71
'properties' : MetaIcon(img = 'options',
72
label = _('Show model properties')),
73
'variables' : MetaIcon(img = 'modeler-variables',
74
label = _('Manage model variables')),
75
'redraw' : MetaIcon(img = 'redraw',
76
label = _('Redraw model canvas')),
77
'quit' : BaseIcons['quit'].SetLabel(_('Quit Graphical Modeler')),
80
return self._getToolbarData((('new', icons['new'],
81
self.parent.OnModelNew),
82
('open', icons['open'],
83
self.parent.OnModelOpen),
84
('save', icons['save'],
85
self.parent.OnModelSave),
86
('image', icons['toImage'],
87
self.parent.OnExportImage),
88
('python', icons['toPython'],
89
self.parent.OnExportPython),
91
('action', icons['actionAdd'],
92
self.parent.OnAddAction),
93
('data', icons['dataAdd'],
94
self.parent.OnAddData),
95
('relation', icons['relation'],
96
self.parent.OnDefineRelation),
97
('loop', icons['loop'],
98
self.parent.OnDefineLoop),
99
('comment', icons['comment'],
100
self.parent.OnAddComment),
102
('redraw', icons['redraw'],
103
self.parent.OnCanvasRefresh),
104
('validate', icons['validate'],
105
self.parent.OnValidateModel),
106
('run', icons['run'],
107
self.parent.OnRunModel),
109
("variables", icons['variables'],
110
self.parent.OnVariables),
111
("settings", icons['settings'],
112
self.parent.OnPreferences),
113
("help", BaseIcons['help'],
116
('quit', icons['quit'],
117
self.parent.OnCloseWindow))