diff 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
line wrap: on
line diff
--- a/frontends/wix/xmlui.py	Wed Jun 23 17:26:21 2010 +0800
+++ b/frontends/wix/xmlui.py	Sat Jun 26 15:33:16 2010 +0800
@@ -62,6 +62,7 @@
                 error(message)
                 raise Exception(message)
             _proportion = 0
+            id = elem.getAttribute("id")
             name = elem.getAttribute("name")
             type = elem.getAttribute("type")
             value = elem.getAttribute("value") if elem.hasAttribute('value') else u''
@@ -88,7 +89,10 @@
                 self.ctl_list.append({'name':name, 'type':type, 'control':ctrl})
                 _proportion = 1
             elif type=="button":
-                pass
+                callback_id = elem.getAttribute("callback_id")
+                ctrl = wx.Button(parent, -1, value)
+                ctrl.param_id = callback_id
+                parent.Bind(wx.EVT_BUTTON, self.onButtonClicked, ctrl)
             else:
                 error(_("FIXME FIXME FIXME: type [%s] is not implemented") % type)  #FIXME !
                 raise NotImplementedError
@@ -174,6 +178,16 @@
         self.sizer.Add(panel, 1, flag=wx.EXPAND)
         cat_dom.unlink()
 
+    ###events
+
+    def onButtonClicked(self, event):
+        """Called when a button is pushed"""
+        callback_id = event.GetEventObject().param_id
+        data = {"callback_id":callback_id}
+        id = self.host.bridge.launchAction("button", data)
+        self.host.current_action_ids.add(id)
+        event.Skip()
+
     def onFormSubmitted(self, event):
         """Called when submit button is clicked"""
         debug(_("Submitting form"))