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) 2006-2012 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 Kratochvilova <kratochanna gmail.com>
  11. """
  12. import wx
  13. from core import globalvar
  14. from gui_core.dialogs import ElementDialog
  15. from gui_core import gselect
  16. class SwipeMapDialog(ElementDialog):
  17. """!Dialog used to select raster maps"""
  18. def __init__(self, parent, title = _("Select raster maps"), id = wx.ID_ANY, first = None, second = None):
  19. ElementDialog.__init__(self, parent, title, label = _("Name of first raster map:"))
  20. self.element = gselect.Select(parent = self.panel, type = 'raster',
  21. size = globalvar.DIALOG_GSELECT_SIZE)
  22. self.element2 = gselect.Select(parent = self.panel, type = 'raster',
  23. size = globalvar.DIALOG_GSELECT_SIZE)
  24. self.PostInit()
  25. if first:
  26. self.element.SetValue(first)
  27. if second:
  28. self.element2.SetValue(second)
  29. self._layout()
  30. self.SetMinSize(self.GetSize())
  31. def _layout(self):
  32. """!Do layout"""
  33. self.dataSizer.Add(self.element, proportion = 0,
  34. flag = wx.EXPAND | wx.ALL, border = 1)
  35. self.dataSizer.Add(wx.StaticText(parent = self.panel, id = wx.ID_ANY,
  36. label = _("Name of second raster map:")), proportion = 0,
  37. flag = wx.EXPAND | wx.ALL, border = 1)
  38. self.dataSizer.Add(self.element2, proportion = 0,
  39. flag = wx.EXPAND | wx.ALL, border = 1)
  40. self.panel.SetSizer(self.sizer)
  41. self.sizer.Fit(self)
  42. def GetValues(self):
  43. """!Get raster maps"""
  44. return (self.GetElement(), self.element2.GetValue())