GRASS Programmer's Manual  6.5.svn(2012)-r51648
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
gmodeler/toolbars.py
Go to the documentation of this file.
00001 """!
00002 @package gmodeler.toolbars
00003 
00004 @brief wxGUI Graphical Modeler toolbars classes
00005 
00006 Classes:
00007  - toolbars::ModelerToolbar
00008 
00009 (C) 2010-2011 by the GRASS Development Team
00010 
00011 This program is free software under the GNU General Public License
00012 (>=v2). Read the file COPYING that comes with GRASS for details.
00013 
00014 @author Martin Landa <landa.martin gmail.com>
00015 """
00016 
00017 import os
00018 import sys
00019 
00020 import wx
00021 
00022 from core              import globalvar
00023 from gui_core.toolbars import BaseToolbar, BaseIcons
00024 
00025 from icons.icon        import MetaIcon
00026 
00027 class ModelerToolbar(BaseToolbar):
00028     """!Graphical modeler toolbaro (see gmodeler.py)
00029     """
00030     def __init__(self, parent):
00031         BaseToolbar.__init__(self, parent)
00032         
00033         self.InitToolbar(self._toolbarData())
00034         
00035         # realize the toolbar
00036         self.Realize()
00037         
00038     def _toolbarData(self):
00039         """!Toolbar data"""
00040         icons = {
00041             'new'        : MetaIcon(img = 'create',
00042                                     label = _('Create new model (Ctrl+N)')),
00043             'open'       : MetaIcon(img = 'open',
00044                                     label = _('Load model from file (Ctrl+O)')),
00045             'save'       : MetaIcon(img = 'save',
00046                                     label = _('Save current model to file (Ctrl+S)')),
00047             'toImage'    : MetaIcon(img = 'image-export',
00048                                     label = _('Export model to image')),
00049             'toPython'   : MetaIcon(img = 'python-export',
00050                                     label = _('Export model to Python script')),
00051             'actionAdd'  : MetaIcon(img = 'module-add',
00052                                     label = _('Add command (GRASS module) to model')),
00053             'dataAdd'    : MetaIcon(img = 'data-add',
00054                                     label = _('Add data to model')),
00055             'relation'   : MetaIcon(img = 'relation-create',
00056                                     label = _('Manually define relation between data and commands')),
00057             'loop'       : MetaIcon(img = 'loop-add',
00058                                     label = _('Add loop/series')),
00059             'run'        : MetaIcon(img = 'execute',
00060                                     label = _('Run model')),
00061             'validate'   : MetaIcon(img = 'check',
00062                                     label = _('Validate model')),
00063             'settings'   : BaseIcons['settings'].SetLabel(_('Modeler settings')),
00064             'properties' : MetaIcon(img = 'options',
00065                                     label = _('Show model properties')),
00066             'variables'  : MetaIcon(img = 'modeler-variables',
00067                                     label = _('Manage model variables')),
00068             'redraw'     : MetaIcon(img = 'redraw',
00069                                     label = _('Redraw model canvas')),
00070             'quit'       : BaseIcons['quit'].SetLabel(_('Quit Graphical Modeler')),
00071             }
00072         
00073         return self._getToolbarData((('new', icons['new'],
00074                                       self.parent.OnModelNew),
00075                                      ('open', icons['open'],
00076                                       self.parent.OnModelOpen),
00077                                      ('save', icons['save'],
00078                                       self.parent.OnModelSave),
00079                                      ('image', icons['toImage'],
00080                                       self.parent.OnExportImage),
00081                                      ('python', icons['toPython'],
00082                                       self.parent.OnExportPython),
00083                                      (None, ),
00084                                      ('action', icons['actionAdd'],
00085                                       self.parent.OnAddAction),
00086                                      ('data', icons['dataAdd'],
00087                                       self.parent.OnAddData),
00088                                      ('relation', icons['relation'],
00089                                       self.parent.OnDefineRelation),
00090                                      ('loop', icons['loop'],
00091                                       self.parent.OnDefineLoop),
00092                                      (None, ),
00093                                      ('redraw', icons['redraw'],
00094                                       self.parent.OnCanvasRefresh),
00095                                      ('validate', icons['validate'],
00096                                       self.parent.OnValidateModel),
00097                                      ('run', icons['run'],
00098                                       self.parent.OnRunModel),
00099                                      (None, ),
00100                                      ("variables", icons['variables'],
00101                                       self.parent.OnVariables),
00102                                      ("settings", icons['settings'],
00103                                       self.parent.OnPreferences),
00104                                      ("help", BaseIcons['help'],
00105                                       self.parent.OnHelp),
00106                                      (None, ),
00107                                      ('quit', icons['quit'],
00108                                       self.parent.OnCloseWindow))
00109                                     )