base.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. """
  2. @package location_wizard.base
  3. @brief Location wizard - base classes
  4. Classes:
  5. - base::BaseClass
  6. (C) 2007-2011 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 Michael Barton
  10. @author Jachym Cepicky
  11. @author Martin Landa <landa.martin gmail.com>
  12. """
  13. import wx
  14. class BaseClass(wx.Object):
  15. """Base class providing basic methods"""
  16. def __init__(self):
  17. pass
  18. def MakeLabel(self, text = "", style = wx.ALIGN_LEFT, parent = None, tooltip = None):
  19. """Make aligned label"""
  20. if not parent:
  21. parent = self
  22. label = wx.StaticText(parent = parent, id = wx.ID_ANY, label = text,
  23. style = style)
  24. if tooltip:
  25. label.SetToolTipString(tooltip)
  26. return label
  27. def MakeTextCtrl(self, text = '', size = (100,-1), style = 0, parent = None, tooltip = None):
  28. """Generic text control"""
  29. if not parent:
  30. parent = self
  31. textCtrl = wx.TextCtrl(parent = parent, id = wx.ID_ANY, value = text,
  32. size = size, style = style)
  33. if tooltip:
  34. textCtrl.SetToolTipString(tooltip)
  35. return textCtrl
  36. def MakeButton(self, text, id = wx.ID_ANY, size = (-1,-1), parent = None, tooltip = None):
  37. """Generic button"""
  38. if not parent:
  39. parent = self
  40. button = wx.Button(parent = parent, id = id, label = text,
  41. size = size)
  42. if tooltip:
  43. button.SetToolTipString(tooltip)
  44. return button