diff frontends/wix/param.py @ 22:bb72c29f3432

added action cb mechanism for buttons. Tested with a temporary new user registration button.
author Goffi <goffi@goffi.org>
date Tue, 01 Dec 2009 04:56:08 +0100
parents 633c5ed65701
children 925ab466c5ec
line wrap: on
line diff
--- a/frontends/wix/param.py	Sun Nov 08 01:49:08 2009 +0100
+++ b/frontends/wix/param.py	Tue Dec 01 04:56:08 2009 +0100
@@ -28,10 +28,10 @@
 
 
 class Param(wx.Frame):
-    def __init__(self, bridge, title="Configuration"):
+    def __init__(self, host, title="Configuration"):
         super(Param, self).__init__(None, title=title)
 
-        self.bridge = bridge
+        self.host = host
 
         self.modified={}  # dict of modified data (i.e. what we have to save)
 
@@ -46,7 +46,7 @@
         
         self.MakeModal()
 
-        for category in self.bridge.getParamsCategories():
+        for category in self.host.bridge.getParamsCategories():
             self.addCategory(category)
         
         self.Show()
@@ -55,7 +55,7 @@
         panel=wx.Panel(self.notebook)
         panel.sizer = wx.BoxSizer(wx.VERTICAL)
 
-        cat_dom = minidom.parseString(self.bridge.getParamsForCategory(category))
+        cat_dom = minidom.parseString(self.host.bridge.getParamsForCategory(category))
         
         for param in cat_dom.documentElement.getElementsByTagName("param"):
             name = param.getAttribute("name")
@@ -96,8 +96,12 @@
         
     def onButtonClicked(self, event):
         """Called when a paramated is modified"""
-        print "Button Clicked (%s/%s)" % event.GetEventObject().param_id#TODO: gof: appeler callback
-        #self.modified[event.GetEventObject().param_id]=event.GetString()
+        print "Button Clicked (%s/%s)" % event.GetEventObject().param_id
+        name, category = event.GetEventObject().param_id
+        data = {"name":name, "category":category}
+        id = self.host.bridge.launchAction("button", data)
+        self.host.current_action_ids.add(id)
+        print "action id:",id
         event.Skip()
 
     def onClose(self, event):
@@ -105,7 +109,7 @@
         debug("close")
         #now we save the modifier params
         for param in self.modified:
-            self.bridge.setParam(param[0], self.modified[param], param[1])
+            self.host.bridge.setParam(param[0], self.modified[param], param[1])
 
         self.MakeModal(False)
         event.Skip()