comparison frontends/src/wix/xmlui.py @ 969:5c7707c958d8

tools, frontends (xmlui): add setter methods for widgets + new widget InternalButton to process UI operations
author souliane <souliane@mailoo.org>
date Tue, 01 Apr 2014 21:30:21 +0200
parents 75f3b3b430ff
children b37b1d183ac3
comparison
equal deleted inserted replaced
968:75f3b3b430ff 969:5c7707c958d8
40 class WixWidget(object): 40 class WixWidget(object):
41 _xmlui_proportion = 0 41 _xmlui_proportion = 0
42 42
43 43
44 class ValueWidget(WixWidget): 44 class ValueWidget(WixWidget):
45
46 def _xmluiSetValue(self, value):
47 self.SetValue(value)
48
45 def _xmluiGetValue(self): 49 def _xmluiGetValue(self):
46 return self.GetValue() 50 return self.GetValue()
47 51
48 52
49 class EmptyWidget(WixWidget, xmlui.EmptyWidget, wx.Window): 53 class EmptyWidget(WixWidget, xmlui.EmptyWidget, wx.Window):
103 107
104 def __init__(self, parent, state): 108 def __init__(self, parent, state):
105 wx.CheckBox.__init__(self, parent, -1, "", style=wx.CHK_2STATE) 109 wx.CheckBox.__init__(self, parent, -1, "", style=wx.CHK_2STATE)
106 self.SetValue(state) 110 self.SetValue(state)
107 self._xmlui_proportion = 1 111 self._xmlui_proportion = 1
112
113 def _xmluiSetValue(self, value):
114 self.SetValue(value == 'true')
108 115
109 def _xmluiGetValue(self): 116 def _xmluiGetValue(self):
110 return "true" if self.GetValue() else "false" 117 return "true" if self.GetValue() else "false"
111 118
112 119
150 ret = [] 157 ret = []
151 labels = [self.GetString(idx) for idx in self.GetSelections()] 158 labels = [self.GetString(idx) for idx in self.GetSelections()]
152 for label in labels: 159 for label in labels:
153 ret.append(self._xmlui_attr_map[label]) 160 ret.append(self._xmlui_attr_map[label])
154 return ret 161 return ret
162
163 def _xmluiAddValues(self, values, select=True):
164 wx.ListBox.AppendItems(values)
165 if select:
166 self._xmluiSelectValues(values)
155 167
156 168
157 class WixContainer(object): 169 class WixContainer(object):
158 _xmlui_proportion = 1 170 _xmlui_proportion = 1
159 171