dialogs.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. """!
  2. @package example.dialogs
  3. @brief Dialogs used in Example tool
  4. Classes:
  5. - dialogs::ExampleMapDialog
  6. (C) 2011-2014 by the GRASS Development Team
  7. This program is free software under the GNU General Public
  8. License (>=v2). Read the file COPYING that comes with GRASS
  9. for details.
  10. @author Anna Petrasova <kratochanna gmail.com>
  11. """
  12. import wx
  13. from core import globalvar
  14. from gui_core.dialogs import SimpleDialog
  15. from gui_core import gselect
  16. from core.utils import _
  17. class ExampleMapDialog(SimpleDialog):
  18. """!Dialog for adding raster map.
  19. Dialog can be easily changed to enable to choose vector, imagery groups or other elements.
  20. """
  21. def __init__(self, parent, title=_("Choose raster map")):
  22. """!Calls super class constructor.
  23. @param parent gui parent
  24. @param title dialog window title
  25. @param id id
  26. """
  27. SimpleDialog.__init__(self, parent, title)
  28. # here is the place to determine element type
  29. self.element = gselect.Select(parent=self.panel, type='raster',
  30. size=globalvar.DIALOG_GSELECT_SIZE)
  31. self._layout()
  32. self.SetMinSize(self.GetSize())
  33. def _layout(self):
  34. """!Do layout"""
  35. self.dataSizer.Add(item=wx.StaticText(parent=self.panel,
  36. label=_("Name of raster map:")),
  37. proportion=0, flag=wx.ALL, border=1)
  38. self.dataSizer.Add(self.element, proportion=0,
  39. flag=wx.EXPAND | wx.ALL, border=1)
  40. self.panel.SetSizer(self.sizer)
  41. self.sizer.Fit(self)
  42. def GetRasterMap(self):
  43. """!Returns selected raster map"""
  44. return self.element.GetValue()