123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- """!
- @package example.dialogs
- @brief Dialogs used in Example tool
- Classes:
- - dialogs::ExampleMapDialog
- (C) 2011-2014 by the GRASS Development Team
- This program is free software under the GNU General Public
- License (>=v2). Read the file COPYING that comes with GRASS
- for details.
- @author Anna Petrasova <kratochanna gmail.com>
- """
- import wx
- from core import globalvar
- from gui_core.dialogs import SimpleDialog
- from gui_core import gselect
- from core.utils import _
- class ExampleMapDialog(SimpleDialog):
- """!Dialog for adding raster map.
- Dialog can be easily changed to enable to choose vector, imagery groups or other elements.
- """
- def __init__(self, parent, title=_("Choose raster map")):
- """!Calls super class constructor.
- @param parent gui parent
- @param title dialog window title
- @param id id
- """
- SimpleDialog.__init__(self, parent, title)
- # here is the place to determine element type
- self.element = gselect.Select(parent=self.panel, type='raster',
- size=globalvar.DIALOG_GSELECT_SIZE)
- self._layout()
- self.SetMinSize(self.GetSize())
- def _layout(self):
- """!Do layout"""
- self.dataSizer.Add(item=wx.StaticText(parent=self.panel,
- label=_("Name of raster map:")),
- proportion=0, flag=wx.ALL, border=1)
- self.dataSizer.Add(self.element, proportion=0,
- flag=wx.EXPAND | wx.ALL, border=1)
- self.panel.SetSizer(self.sizer)
- self.sizer.Fit(self)
- def GetRasterMap(self):
- """!Returns selected raster map"""
- return self.element.GetValue()
|