GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
gmodeler/toolbars.py
Go to the documentation of this file.
1 """!
2 @package gmodeler.toolbars
3 
4 @brief wxGUI Graphical Modeler toolbars classes
5 
6 Classes:
7  - toolbars::ModelerToolbar
8 
9 (C) 2010-2011 by the GRASS Development Team
10 
11 This program is free software under the GNU General Public License
12 (>=v2). Read the file COPYING that comes with GRASS for details.
13 
14 @author Martin Landa <landa.martin gmail.com>
15 """
16 
17 import os
18 import sys
19 
20 import wx
21 
22 from core import globalvar
23 from gui_core.toolbars import BaseToolbar, BaseIcons
24 
25 from icons.icon import MetaIcon
26 
28  """!Graphical modeler toolbaro (see gmodeler.py)
29  """
30  def __init__(self, parent):
31  BaseToolbar.__init__(self, parent)
32 
33  self.InitToolbar(self._toolbarData())
34 
35  # realize the toolbar
36  self.Realize()
37 
38  def _toolbarData(self):
39  """!Toolbar data"""
40  icons = {
41  'new' : MetaIcon(img = 'create',
42  label = _('Create new model (Ctrl+N)')),
43  'open' : MetaIcon(img = 'open',
44  label = _('Load model from file (Ctrl+O)')),
45  'save' : MetaIcon(img = 'save',
46  label = _('Save current model to file (Ctrl+S)')),
47  'toImage' : MetaIcon(img = 'image-export',
48  label = _('Export model to image')),
49  'toPython' : MetaIcon(img = 'python-export',
50  label = _('Export model to Python script')),
51  'actionAdd' : MetaIcon(img = 'module-add',
52  label = _('Add command (GRASS module) to model')),
53  'dataAdd' : MetaIcon(img = 'data-add',
54  label = _('Add data to model')),
55  'relation' : MetaIcon(img = 'relation-create',
56  label = _('Manually define relation between data and commands')),
57  'loop' : MetaIcon(img = 'loop-add',
58  label = _('Add loop/series')),
59  'run' : MetaIcon(img = 'execute',
60  label = _('Run model')),
61  'validate' : MetaIcon(img = 'check',
62  label = _('Validate model')),
63  'settings' : BaseIcons['settings'].SetLabel(_('Modeler settings')),
64  'properties' : MetaIcon(img = 'options',
65  label = _('Show model properties')),
66  'variables' : MetaIcon(img = 'modeler-variables',
67  label = _('Manage model variables')),
68  'redraw' : MetaIcon(img = 'redraw',
69  label = _('Redraw model canvas')),
70  'quit' : BaseIcons['quit'].SetLabel(_('Quit Graphical Modeler')),
71  }
72 
73  return self._getToolbarData((('new', icons['new'],
74  self.parent.OnModelNew),
75  ('open', icons['open'],
76  self.parent.OnModelOpen),
77  ('save', icons['save'],
78  self.parent.OnModelSave),
79  ('image', icons['toImage'],
80  self.parent.OnExportImage),
81  ('python', icons['toPython'],
82  self.parent.OnExportPython),
83  (None, ),
84  ('action', icons['actionAdd'],
85  self.parent.OnAddAction),
86  ('data', icons['dataAdd'],
87  self.parent.OnAddData),
88  ('relation', icons['relation'],
89  self.parent.OnDefineRelation),
90  ('loop', icons['loop'],
91  self.parent.OnDefineLoop),
92  (None, ),
93  ('redraw', icons['redraw'],
94  self.parent.OnCanvasRefresh),
95  ('validate', icons['validate'],
96  self.parent.OnValidateModel),
97  ('run', icons['run'],
98  self.parent.OnRunModel),
99  (None, ),
100  ("variables", icons['variables'],
101  self.parent.OnVariables),
102  ("settings", icons['settings'],
103  self.parent.OnPreferences),
104  ("help", BaseIcons['help'],
105  self.parent.OnHelp),
106  (None, ),
107  ('quit', icons['quit'],
108  self.parent.OnCloseWindow))
109  )
Graphical modeler toolbaro (see gmodeler.py)
def _toolbarData
Toolbar data.
def _getToolbarData
Define tool.
def InitToolbar
Initialize toolbar, add tools to the toolbar.
Abstract toolbar class.
Base classes toolbar widgets.