comparison sat_bridge/DBus.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 6928e3cb73a8
children 53e921c8a357
comparison
equal deleted inserted replaced
21:633c5ed65701 22:bb72c29f3432
71 @dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX, 71 @dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX,
72 signature='ssa{ss}') 72 signature='ssa{ss}')
73 def askConfirmation(self, type, id, data): 73 def askConfirmation(self, type, id, data):
74 debug("asking for confirmation: id = [%s] type = %s data = %s", id, type, data) 74 debug("asking for confirmation: id = [%s] type = %s data = %s", id, type, data)
75 75
76 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, 76 @dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX,
77 signature='ssa{ss}') 77 signature='ssa{ss}')
78 def sendAnswer(self, type, id, data): 78 def actionResult(self, type, id, data):
79 debug("sending answer: id = [%s] type = %s data = %s", id, type, data) 79 debug("result of action: id = [%s] type = %s data = %s", id, type, data)
80 80
81 ### methods ### 81 ### methods ###
82 82
83 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, 83 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
84 in_signature='sssi', out_signature='s') 84 in_signature='sssi', out_signature='s')
126 def setParam(self, name, value, category): 126 def setParam(self, name, value, category):
127 self.cb["setParam"](name, str(value), category) 127 self.cb["setParam"](name, str(value), category)
128 128
129 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, 129 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
130 in_signature='ss', out_signature='s') 130 in_signature='ss', out_signature='s')
131 def getParamV(self, name, category="default"): 131 def getParamA(self, name, category="default"):
132 return self.cb["getParamV"](name, category) 132 return self.cb["getParamA"](name, category)
133 133
134 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, 134 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
135 in_signature='', out_signature='s') 135 in_signature='', out_signature='s')
136 def getParams(self): 136 def getParams(self):
137 return self.cb["getParams"]() 137 return self.cb["getParams"]()
168 in_signature='', out_signature='b') 168 in_signature='', out_signature='b')
169 def isConnected(self): 169 def isConnected(self):
170 debug("Connection status requested") 170 debug("Connection status requested")
171 return self.cb["isConnected"]() 171 return self.cb["isConnected"]()
172 172
173 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
174 in_signature='sa{ss}', out_signature='s')
175 def launchAction(self, type, data):
176 return self.cb["launchAction"](type, data)
177
173 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, 178 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
174 in_signature='sba{ss}', out_signature='') 179 in_signature='sba{ss}', out_signature='')
175 def confirmationAnswer(self, id, accepted, data): 180 def confirmationAnswer(self, id, accepted, data):
176 debug("Answer for confirmation [%s]: %s", id, "Accepted" if accepted else "Refused") 181 debug("Answer for confirmation [%s]: %s", id, "Accepted" if accepted else "Refused")
177 return self.cb["confirmationAnswer"](id, accepted, data) 182 return self.cb["confirmationAnswer"](id, accepted, data)
245 self.dbus_bridge.contactDeleted(jid) 250 self.dbus_bridge.contactDeleted(jid)
246 251
247 def askConfirmation(self, type, id, data): 252 def askConfirmation(self, type, id, data):
248 self.dbus_bridge.askConfirmation(type, id, data) 253 self.dbus_bridge.askConfirmation(type, id, data)
249 254
250 def sendAnswer(self, type, id, data): 255 def actionResult(self, type, id, data):
251 self.dbus_bridge.sendAnswer(type, id, data) 256 self.dbus_bridge.actionResult(type, id, data)
252 257
253 def register(self, name, callback): 258 def register(self, name, callback):
254 debug("registering DBus bridge method [%s]",name) 259 debug("registering DBus bridge method [%s]",name)
255 self.dbus_bridge.register(name, callback) 260 self.dbus_bridge.register(name, callback)
256 261