1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 from common import *
25 from basictextwidget import BasicTextWidget
26
28 """
29 A basic checkbox.
30
31 New Attributes
32 ==============
33
34 - marked: Boolean value, whether the checkbox is checked or not.
35
36 Data
37 ====
38 The marked status can be read and set via L{distributeData} and L{collectData}
39 """
40
41 ATTRIBUTES = BasicTextWidget.ATTRIBUTES + [ BoolAttr('marked') ]
42
43 DEFAULT_MARKED = False
44
45 - def __init__(self,
46 parent = None,
47 name = None,
48 size = None,
49 min_size = None,
50 max_size = None,
51 helptext = None,
52 position = None,
53 style = None,
54 hexpand = None,
55 vexpand = None,
56 font = None,
57 base_color = None,
58 background_color = None,
59 foreground_color = None,
60 selection_color = None,
61 border_size = None,
62 position_technique = None,
63 is_focusable = None,
64 comment = None,
65 margins = None,
66 text = None,
67 marked = None):
68
69 self.real_widget = fife.CheckBox()
70 self.marked = self.DEFAULT_MARKED
71 super(CheckBox,self).__init__(parent=parent,
72 name=name,
73 size=size,
74 min_size=min_size,
75 max_size=max_size,
76 helptext=helptext,
77 position=position,
78 style=style,
79 hexpand=hexpand,
80 vexpand=vexpand,
81 font=font,
82 base_color=base_color,
83 background_color=background_color,
84 foreground_color=foreground_color,
85 selection_color=selection_color,
86 border_size=border_size,
87 position_technique=position_technique,
88 is_focusable=is_focusable,
89 comment=comment,
90 margins=margins,
91 text=text)
92 if marked is not None:
93 self.marked = marked
94
95
96 self.accepts_data = True
97 self._realGetData = self._isMarked
98 self._realSetData = self._setMarked
99
100 - def clone(self, prefix):
101 checkboxClone = CheckBox(None,
102 self._createNameWithPrefix(prefix),
103 self.size,
104 self.min_size,
105 self.max_size,
106 self.helptext,
107 self.position,
108 self.style,
109 self.hexpand,
110 self.vexpand,
111 self.font,
112 self.base_color,
113 self.background_color,
114 self.foreground_color,
115 self.selection_color,
116 self.border_size,
117 self.position_technique,
118 self.is_focusable,
119 self.comment,
120 self.margins,
121 self.text,
122 self.marked)
123 return checkboxClone
124
127 marked = property(_isMarked,_setMarked)
128