~ubuntu-branches/ubuntu/wily/grass/wily

« back to all changes in this revision

Viewing changes to gui/wxpython/gmodeler/toolbars.py

Tags: 7.0.0~rc1+ds1-1~exp1
* New upstream release candidate.
* Repack upstream tarball, remove precompiled Python objects.
* Add upstream metadata.
* Update gbp.conf and Vcs-Git URL to use the experimental branch.
* Update watch file for GRASS 7.0.
* Drop build dependencies for Tcl/Tk, add build dependencies:
  python-numpy, libnetcdf-dev, netcdf-bin, libblas-dev, liblapack-dev
* Update Vcs-Browser URL to use cgit instead of gitweb.
* Update paths to use grass70.
* Add configure options: --with-netcdf, --with-blas, --with-lapack,
  remove --with-tcltk-includes.
* Update patches for GRASS 7.
* Update copyright file, changes:
  - Update copyright years
  - Group files by license
  - Remove unused license sections
* Add patches for various typos.
* Fix desktop file with patch instead of d/rules.
* Use minimal dh rules.
* Bump Standards-Version to 3.9.6, no changes.
* Use dpkg-maintscript-helper to replace directories with symlinks.
  (closes: #776349)
* Update my email to use @debian.org address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 core.utils import _
 
24
from gui_core.toolbars import BaseToolbar, BaseIcons
 
25
 
 
26
from icons.icon        import MetaIcon
 
27
 
 
28
class ModelerToolbar(BaseToolbar):
 
29
    """Graphical modeler toolbaro (see gmodeler.py)
 
30
    """
 
31
    def __init__(self, parent):
 
32
        BaseToolbar.__init__(self, parent)
 
33
 
 
34
        # workaround for http://trac.wxwidgets.org/ticket/13888
 
35
        if sys.platform == 'darwin':
 
36
            parent.SetToolBar(self)
 
37
 
 
38
        self.InitToolbar(self._toolbarData())
 
39
        
 
40
        # realize the toolbar
 
41
        self.Realize()
 
42
        
 
43
    def _toolbarData(self):
 
44
        """Toolbar data"""
 
45
        icons = {
 
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')),
 
78
            }
 
79
        
 
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),
 
90
                                     (None, ),
 
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),
 
101
                                     (None, ),
 
102
                                     ('redraw', icons['redraw'],
 
103
                                      self.parent.OnCanvasRefresh),
 
104
                                     ('validate', icons['validate'],
 
105
                                      self.parent.OnValidateModel),
 
106
                                     ('run', icons['run'],
 
107
                                      self.parent.OnRunModel),
 
108
                                     (None, ),
 
109
                                     ("variables", icons['variables'],
 
110
                                      self.parent.OnVariables),
 
111
                                     ("settings", icons['settings'],
 
112
                                      self.parent.OnPreferences),
 
113
                                     ("help", BaseIcons['help'],
 
114
                                      self.parent.OnHelp),
 
115
                                     (None, ),
 
116
                                     ('quit', icons['quit'],
 
117
                                      self.parent.OnCloseWindow))
 
118
                                    )