dialogs.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. """!
  2. @package swipe.dialogs
  3. @brief Dialogs used in Map Swipe
  4. Classes:
  5. - dialogs::SwipeMapDialog
  6. (C) 2012 by the GRASS Development Team
  7. This program is free software under the GNU General Public License
  8. (>=v2). Read the file COPYING that comes with GRASS for details.
  9. @author Anna Kratochvilova <kratochanna gmail.com>
  10. """
  11. import wx
  12. from core import globalvar
  13. from gui_core.dialogs import ElementDialog
  14. from gui_core import gselect
  15. class SwipeMapDialog(ElementDialog):
  16. """!Dialog used to select raster maps"""
  17. def __init__(self, parent, title = _("Select raster maps"), id = wx.ID_ANY, first = None, second = None):
  18. ElementDialog.__init__(self, parent, title, id = id, label = _("Name of top/left raster map:"))
  19. self.element = gselect.Select(parent = self.panel, type = 'raster',
  20. size = globalvar.DIALOG_GSELECT_SIZE)
  21. self.element2 = gselect.Select(parent = self.panel, type = 'raster',
  22. size = globalvar.DIALOG_GSELECT_SIZE)
  23. self.PostInit()
  24. if first:
  25. self.element.SetValue(first)
  26. if second:
  27. self.element2.SetValue(second)
  28. self._layout()
  29. self.SetMinSize(self.GetSize())
  30. def _layout(self):
  31. """!Do layout"""
  32. self.dataSizer.Add(self.element, proportion = 0,
  33. flag = wx.EXPAND | wx.ALL, border = 1)
  34. self.dataSizer.Add(wx.StaticText(parent = self.panel, id = wx.ID_ANY,
  35. label = _("Name of bottom/right raster map:")), proportion = 0,
  36. flag = wx.EXPAND | wx.ALL, border = 1)
  37. self.dataSizer.Add(self.element2, proportion = 0,
  38. flag = wx.EXPAND | wx.ALL, border = 1)
  39. self.panel.SetSizer(self.sizer)
  40. self.sizer.Fit(self)
  41. def GetValues(self):
  42. """!Get raster maps"""
  43. return (self.GetElement(), self.element2.GetValue())