base.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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(self, text='', size=(100, -1),
  29. style=0, parent=None, tooltip=None):
  30. """Generic text control"""
  31. if not parent:
  32. parent = self
  33. textCtrl = wx.TextCtrl(parent=parent, id=wx.ID_ANY, value=text,
  34. size=size, style=style)
  35. if tooltip:
  36. textCtrl.SetToolTipString(tooltip)
  37. return textCtrl
  38. def MakeButton(self, text, id=wx.ID_ANY, size=(-1, -1),
  39. parent=None, tooltip=None):
  40. """Generic button"""
  41. if not parent:
  42. parent = self
  43. button = wx.Button(parent=parent, id=id, label=text,
  44. size=size)
  45. if tooltip:
  46. button.SetToolTipString(tooltip)
  47. return button
  48. def MakeCheckBox(self, text, id=wx.ID_ANY, size=(-1, -1),
  49. parent=None, tooltip=None):
  50. """Generic checkbox"""
  51. if not parent:
  52. parent = self
  53. chbox = wx.CheckBox(parent=parent, id=id, label=text,
  54. size=size)
  55. if tooltip:
  56. chbox.SetToolTipString(tooltip)
  57. return chbox