base.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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,
  19. parent=None, tooltip=None):
  20. """Make aligned label"""
  21. if not parent:
  22. parent = self
  23. label = wx.StaticText(parent=parent, id=wx.ID_ANY, label=text,
  24. style=style)
  25. if tooltip:
  26. label.SetToolTipString(tooltip)
  27. return label
  28. def MakeTextCtrl(
  29. self, text='', size=(100, -1),
  30. style=0, parent=None, tooltip=None):
  31. """Generic text control"""
  32. if not parent:
  33. parent = self
  34. textCtrl = wx.TextCtrl(parent=parent, id=wx.ID_ANY, value=text,
  35. size=size, style=style)
  36. if tooltip:
  37. textCtrl.SetToolTipString(tooltip)
  38. return textCtrl
  39. def MakeButton(
  40. self, text, id=wx.ID_ANY, size=(-1, -1),
  41. parent=None, tooltip=None):
  42. """Generic button"""
  43. if not parent:
  44. parent = self
  45. button = wx.Button(parent=parent, id=id, label=text,
  46. size=size)
  47. if tooltip:
  48. button.SetToolTipString(tooltip)
  49. return button