wrap.py 864 B

123456789101112131415161718192021222324252627282930313233343536
  1. """
  2. @package gui_core.wrap
  3. @brief Core wrapped wxpython widgets
  4. Classes:
  5. - wrap::GSpinCtrl
  6. (C) 2016 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 Petrasova <kratochanna gmail.com>
  10. """
  11. import wx
  12. from core.globalvar import gtk3
  13. class GSpinCtrl(wx.SpinCtrl):
  14. """Wrapper around wx.SpinCtrl to have more control
  15. over the widget on different platforms"""
  16. gtk3MinSize = 130
  17. def __init__(self, *args, **kwargs):
  18. if gtk3:
  19. if 'size' in kwargs:
  20. kwargs['size'] = wx.Size(max(self.gtk3MinSize, kwargs['size'][0]), kwargs['size'][1])
  21. else:
  22. kwargs['size'] = wx.Size(self.gtk3MinSize, -1)
  23. wx.SpinCtrl.__init__(self, *args, **kwargs)