added action cb mechanism for buttons. Tested with a temporary new user registration button.
This commit is contained in:
parent
bd70d6d7b6
commit
a103e8b41b
1 changed files with 226 additions and 66 deletions
|
|
@ -28,10 +28,10 @@ from logging import debug, info, error
|
|||
|
||||
|
||||
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 @@ class Param(wx.Frame):
|
|||
|
||||
self.MakeModal()
|
||||
|
||||
for category in self.bridge.getParamsCategories():
|
||||
for category in self.host.bridge.getParamsCategories():
|
||||
self.addCategory(category)
|
||||
|
||||
self.Show()
|
||||
|
|
@ -55,7 +55,7 @@ class Param(wx.Frame):
|
|||
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 @@ class Param(wx.Frame):
|
|||
|
||||
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 @@ class Param(wx.Frame):
|
|||
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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue