Mercurial > libervia-backend
comparison frontends/src/bridge/DBus.py @ 1237:c1e916594e09
bridge (frontends side): fixed call of async method in blocking context
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 16 Oct 2014 20:18:40 +0200 |
parents | f0c9b149ed99 |
children | e3a9ea76de35 |
comparison
equal
deleted
inserted
replaced
1236:251ae99a6c0e | 1237:c1e916594e09 |
---|---|
124 return getPluginMethod | 124 return getPluginMethod |
125 def addContact(self, entity_jid, profile_key="@DEFAULT@"): | 125 def addContact(self, entity_jid, profile_key="@DEFAULT@"): |
126 return self.db_core_iface.addContact(entity_jid, profile_key) | 126 return self.db_core_iface.addContact(entity_jid, profile_key) |
127 | 127 |
128 def asyncConnect(self, profile_key="@DEFAULT@", password='', callback=None, errback=None): | 128 def asyncConnect(self, profile_key="@DEFAULT@", password='', callback=None, errback=None): |
129 return self.db_core_iface.asyncConnect(profile_key, password, timeout=const_TIMEOUT, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err))) | 129 error_handler = None if callback is None else lambda err:errback(dbus_to_bridge_exception(err)) |
130 return self.db_core_iface.asyncConnect(profile_key, password, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) | |
130 | 131 |
131 def asyncCreateProfile(self, profile, password='', callback=None, errback=None): | 132 def asyncCreateProfile(self, profile, password='', callback=None, errback=None): |
132 return self.db_core_iface.asyncCreateProfile(profile, password, timeout=const_TIMEOUT, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err))) | 133 error_handler = None if callback is None else lambda err:errback(dbus_to_bridge_exception(err)) |
134 return self.db_core_iface.asyncCreateProfile(profile, password, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) | |
133 | 135 |
134 def asyncDeleteProfile(self, profile, callback=None, errback=None): | 136 def asyncDeleteProfile(self, profile, callback=None, errback=None): |
135 return self.db_core_iface.asyncDeleteProfile(profile, timeout=const_TIMEOUT, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err))) | 137 error_handler = None if callback is None else lambda err:errback(dbus_to_bridge_exception(err)) |
138 return self.db_core_iface.asyncDeleteProfile(profile, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) | |
136 | 139 |
137 def asyncGetParamA(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None): | 140 def asyncGetParamA(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None): |
138 return unicode(self.db_core_iface.asyncGetParamA(name, category, attribute, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err)))) | 141 error_handler = None if callback is None else lambda err:errback(dbus_to_bridge_exception(err)) |
142 return unicode(self.db_core_iface.asyncGetParamA(name, category, attribute, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)) | |
139 | 143 |
140 def confirmationAnswer(self, id, accepted, data, profile): | 144 def confirmationAnswer(self, id, accepted, data, profile): |
141 return self.db_core_iface.confirmationAnswer(id, accepted, data, profile) | 145 return self.db_core_iface.confirmationAnswer(id, accepted, data, profile) |
142 | 146 |
143 def delContact(self, entity_jid, profile_key="@DEFAULT@"): | 147 def delContact(self, entity_jid, profile_key="@DEFAULT@"): |
144 return self.db_core_iface.delContact(entity_jid, profile_key) | 148 return self.db_core_iface.delContact(entity_jid, profile_key) |
145 | 149 |
146 def discoInfos(self, entity_jid, profile_key, callback=None, errback=None): | 150 def discoInfos(self, entity_jid, profile_key, callback=None, errback=None): |
147 return self.db_core_iface.discoInfos(entity_jid, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err))) | 151 error_handler = None if callback is None else lambda err:errback(dbus_to_bridge_exception(err)) |
152 return self.db_core_iface.discoInfos(entity_jid, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) | |
148 | 153 |
149 def discoItems(self, entity_jid, profile_key, callback=None, errback=None): | 154 def discoItems(self, entity_jid, profile_key, callback=None, errback=None): |
150 return self.db_core_iface.discoItems(entity_jid, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err))) | 155 error_handler = None if callback is None else lambda err:errback(dbus_to_bridge_exception(err)) |
156 return self.db_core_iface.discoItems(entity_jid, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) | |
151 | 157 |
152 def disconnect(self, profile_key="@DEFAULT@"): | 158 def disconnect(self, profile_key="@DEFAULT@"): |
153 return self.db_core_iface.disconnect(profile_key) | 159 return self.db_core_iface.disconnect(profile_key) |
154 | 160 |
155 def getConfig(self, section, name): | 161 def getConfig(self, section, name): |
163 | 169 |
164 def getEntityData(self, jid, keys, profile): | 170 def getEntityData(self, jid, keys, profile): |
165 return self.db_core_iface.getEntityData(jid, keys, profile) | 171 return self.db_core_iface.getEntityData(jid, keys, profile) |
166 | 172 |
167 def getHistory(self, from_jid, to_jid, limit, between=True, search='', profile="@NONE@", callback=None, errback=None): | 173 def getHistory(self, from_jid, to_jid, limit, between=True, search='', profile="@NONE@", callback=None, errback=None): |
168 return self.db_core_iface.getHistory(from_jid, to_jid, limit, between, search, profile, timeout=const_TIMEOUT, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err))) | 174 error_handler = None if callback is None else lambda err:errback(dbus_to_bridge_exception(err)) |
175 return self.db_core_iface.getHistory(from_jid, to_jid, limit, between, search, profile, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) | |
169 | 176 |
170 def getLastResource(self, contact_jid, profile_key="@DEFAULT@"): | 177 def getLastResource(self, contact_jid, profile_key="@DEFAULT@"): |
171 return unicode(self.db_core_iface.getLastResource(contact_jid, profile_key)) | 178 return unicode(self.db_core_iface.getLastResource(contact_jid, profile_key)) |
172 | 179 |
173 def getMenuHelp(self, menu_id, language): | 180 def getMenuHelp(self, menu_id, language): |
178 | 185 |
179 def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"): | 186 def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"): |
180 return unicode(self.db_core_iface.getParamA(name, category, attribute, profile_key)) | 187 return unicode(self.db_core_iface.getParamA(name, category, attribute, profile_key)) |
181 | 188 |
182 def getParams(self, security_limit=-1, app='', profile_key="@DEFAULT@", callback=None, errback=None): | 189 def getParams(self, security_limit=-1, app='', profile_key="@DEFAULT@", callback=None, errback=None): |
183 return unicode(self.db_core_iface.getParams(security_limit, app, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err)))) | 190 error_handler = None if callback is None else lambda err:errback(dbus_to_bridge_exception(err)) |
191 return unicode(self.db_core_iface.getParams(security_limit, app, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)) | |
184 | 192 |
185 def getParamsCategories(self, ): | 193 def getParamsCategories(self, ): |
186 return self.db_core_iface.getParamsCategories() | 194 return self.db_core_iface.getParamsCategories() |
187 | 195 |
188 def getParamsForCategory(self, category, security_limit=-1, app='', profile_key="@DEFAULT@", callback=None, errback=None): | 196 def getParamsForCategory(self, category, security_limit=-1, app='', profile_key="@DEFAULT@", callback=None, errback=None): |
189 return unicode(self.db_core_iface.getParamsForCategory(category, security_limit, app, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err)))) | 197 error_handler = None if callback is None else lambda err:errback(dbus_to_bridge_exception(err)) |
198 return unicode(self.db_core_iface.getParamsForCategory(category, security_limit, app, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)) | |
190 | 199 |
191 def getParamsUI(self, security_limit=-1, app='', profile_key="@DEFAULT@", callback=None, errback=None): | 200 def getParamsUI(self, security_limit=-1, app='', profile_key="@DEFAULT@", callback=None, errback=None): |
192 return unicode(self.db_core_iface.getParamsUI(security_limit, app, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err)))) | 201 error_handler = None if callback is None else lambda err:errback(dbus_to_bridge_exception(err)) |
202 return unicode(self.db_core_iface.getParamsUI(security_limit, app, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)) | |
193 | 203 |
194 def getPresenceStatuses(self, profile_key="@DEFAULT@"): | 204 def getPresenceStatuses(self, profile_key="@DEFAULT@"): |
195 return self.db_core_iface.getPresenceStatuses(profile_key) | 205 return self.db_core_iface.getPresenceStatuses(profile_key) |
196 | 206 |
197 def getProfileName(self, profile_key="@DEFAULT@"): | 207 def getProfileName(self, profile_key="@DEFAULT@"): |
202 | 212 |
203 def getProgress(self, id, profile): | 213 def getProgress(self, id, profile): |
204 return self.db_core_iface.getProgress(id, profile) | 214 return self.db_core_iface.getProgress(id, profile) |
205 | 215 |
206 def getReady(self, callback=None, errback=None): | 216 def getReady(self, callback=None, errback=None): |
207 return self.db_core_iface.getReady(timeout=const_TIMEOUT, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err))) | 217 error_handler = None if callback is None else lambda err:errback(dbus_to_bridge_exception(err)) |
218 return self.db_core_iface.getReady(timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) | |
208 | 219 |
209 def getVersion(self, ): | 220 def getVersion(self, ): |
210 return unicode(self.db_core_iface.getVersion()) | 221 return unicode(self.db_core_iface.getVersion()) |
211 | 222 |
212 def getWaitingConf(self, profile_key): | 223 def getWaitingConf(self, profile_key): |
217 | 228 |
218 def isConnected(self, profile_key="@DEFAULT@"): | 229 def isConnected(self, profile_key="@DEFAULT@"): |
219 return self.db_core_iface.isConnected(profile_key) | 230 return self.db_core_iface.isConnected(profile_key) |
220 | 231 |
221 def launchAction(self, callback_id, data, profile_key="@DEFAULT@", callback=None, errback=None): | 232 def launchAction(self, callback_id, data, profile_key="@DEFAULT@", callback=None, errback=None): |
222 return self.db_core_iface.launchAction(callback_id, data, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err))) | 233 error_handler = None if callback is None else lambda err:errback(dbus_to_bridge_exception(err)) |
234 return self.db_core_iface.launchAction(callback_id, data, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) | |
223 | 235 |
224 def loadParamsTemplate(self, filename): | 236 def loadParamsTemplate(self, filename): |
225 return self.db_core_iface.loadParamsTemplate(filename) | 237 return self.db_core_iface.loadParamsTemplate(filename) |
226 | 238 |
227 def paramsRegisterApp(self, xml, security_limit=-1, app=''): | 239 def paramsRegisterApp(self, xml, security_limit=-1, app=''): |
229 | 241 |
230 def saveParamsTemplate(self, filename): | 242 def saveParamsTemplate(self, filename): |
231 return self.db_core_iface.saveParamsTemplate(filename) | 243 return self.db_core_iface.saveParamsTemplate(filename) |
232 | 244 |
233 def sendMessage(self, to_jid, message, subject='', mess_type="auto", extra={}, profile_key="@NONE@", callback=None, errback=None): | 245 def sendMessage(self, to_jid, message, subject='', mess_type="auto", extra={}, profile_key="@NONE@", callback=None, errback=None): |
234 return self.db_core_iface.sendMessage(to_jid, message, subject, mess_type, extra, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err))) | 246 error_handler = None if callback is None else lambda err:errback(dbus_to_bridge_exception(err)) |
247 return self.db_core_iface.sendMessage(to_jid, message, subject, mess_type, extra, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler) | |
235 | 248 |
236 def setParam(self, name, value, category, security_limit=-1, profile_key="@DEFAULT@"): | 249 def setParam(self, name, value, category, security_limit=-1, profile_key="@DEFAULT@"): |
237 return self.db_core_iface.setParam(name, value, category, security_limit, profile_key) | 250 return self.db_core_iface.setParam(name, value, category, security_limit, profile_key) |
238 | 251 |
239 def setPresence(self, to_jid='', show='', statuses={}, profile_key="@DEFAULT@"): | 252 def setPresence(self, to_jid='', show='', statuses={}, profile_key="@DEFAULT@"): |