comparison engine/extensions/pychan/widgets/checkbox.py @ 248:a2d5e2721489

widgets.py split up.
author phoku@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 26 Mar 2009 16:20:16 +0000
parents
children 48c99636453e
comparison
equal deleted inserted replaced
247:040387b7167f 248:a2d5e2721489
1 # -*- coding: utf-8 -*-
2
3 from common import *
4 from basictextwidget import BasicTextWidget
5
6 class CheckBox(BasicTextWidget):
7 """
8 A basic checkbox.
9
10 New Attributes
11 ==============
12
13 - marked: Boolean value, whether the checkbox is checked or not.
14
15 Data
16 ====
17 The marked status can be read and set via L{distributeData} and L{collectData}
18 """
19
20 ATTRIBUTES = BasicTextWidget.ATTRIBUTES + [BoolAttr('marked')]
21
22 def __init__(self,**kwargs):
23 self.real_widget = fife.CheckBox()
24 super(CheckBox,self).__init__(**kwargs)
25
26 # Prepare Data collection framework
27 self.accepts_data = True
28 self._realGetData = self._isMarked
29 self._realSetData = self._setMarked
30
31 # Initial data stuff inherited.
32
33 def _isMarked(self): return self.real_widget.isSelected()
34 def _setMarked(self,mark): self.real_widget.setSelected(mark)
35 marked = property(_isMarked,_setMarked)