Mercurial > libervia-backend
comparison frontends/wix/xmlui.py @ 106:138d82f64b6f
plugin CS: friends parsing
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 26 Jun 2010 15:33:16 +0800 |
parents | d2630fba8dfd |
children | 5ae370c71803 |
comparison
equal
deleted
inserted
replaced
105:d2630fba8dfd | 106:138d82f64b6f |
---|---|
60 if elem.nodeName != "elem": | 60 if elem.nodeName != "elem": |
61 message=_("Unmanaged tag") | 61 message=_("Unmanaged tag") |
62 error(message) | 62 error(message) |
63 raise Exception(message) | 63 raise Exception(message) |
64 _proportion = 0 | 64 _proportion = 0 |
65 id = elem.getAttribute("id") | |
65 name = elem.getAttribute("name") | 66 name = elem.getAttribute("name") |
66 type = elem.getAttribute("type") | 67 type = elem.getAttribute("type") |
67 value = elem.getAttribute("value") if elem.hasAttribute('value') else u'' | 68 value = elem.getAttribute("value") if elem.hasAttribute('value') else u'' |
68 if type=="empty": | 69 if type=="empty": |
69 ctrl = wx.Window(parent, -1) | 70 ctrl = wx.Window(parent, -1) |
86 elif type=="list": | 87 elif type=="list": |
87 ctrl = wx.ListBox(parent, -1, choices=[option.getAttribute("value") for option in elem.getElementsByTagName("option")], style=wx.LB_SINGLE) | 88 ctrl = wx.ListBox(parent, -1, choices=[option.getAttribute("value") for option in elem.getElementsByTagName("option")], style=wx.LB_SINGLE) |
88 self.ctl_list.append({'name':name, 'type':type, 'control':ctrl}) | 89 self.ctl_list.append({'name':name, 'type':type, 'control':ctrl}) |
89 _proportion = 1 | 90 _proportion = 1 |
90 elif type=="button": | 91 elif type=="button": |
91 pass | 92 callback_id = elem.getAttribute("callback_id") |
93 ctrl = wx.Button(parent, -1, value) | |
94 ctrl.param_id = callback_id | |
95 parent.Bind(wx.EVT_BUTTON, self.onButtonClicked, ctrl) | |
92 else: | 96 else: |
93 error(_("FIXME FIXME FIXME: type [%s] is not implemented") % type) #FIXME ! | 97 error(_("FIXME FIXME FIXME: type [%s] is not implemented") % type) #FIXME ! |
94 raise NotImplementedError | 98 raise NotImplementedError |
95 parent.sizer.Add(ctrl, _proportion, flag=wx.EXPAND) | 99 parent.sizer.Add(ctrl, _proportion, flag=wx.EXPAND) |
96 | 100 |
172 panel.SetAutoLayout(True) | 176 panel.SetAutoLayout(True) |
173 panel.sizer.Fit(self) | 177 panel.sizer.Fit(self) |
174 self.sizer.Add(panel, 1, flag=wx.EXPAND) | 178 self.sizer.Add(panel, 1, flag=wx.EXPAND) |
175 cat_dom.unlink() | 179 cat_dom.unlink() |
176 | 180 |
181 ###events | |
182 | |
183 def onButtonClicked(self, event): | |
184 """Called when a button is pushed""" | |
185 callback_id = event.GetEventObject().param_id | |
186 data = {"callback_id":callback_id} | |
187 id = self.host.bridge.launchAction("button", data) | |
188 self.host.current_action_ids.add(id) | |
189 event.Skip() | |
190 | |
177 def onFormSubmitted(self, event): | 191 def onFormSubmitted(self, event): |
178 """Called when submit button is clicked""" | 192 """Called when submit button is clicked""" |
179 debug(_("Submitting form")) | 193 debug(_("Submitting form")) |
180 data = [] | 194 data = [] |
181 for ctrl in self.ctl_list: | 195 for ctrl in self.ctl_list: |