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