primitivus: prefill "Join MUC" dialog with only the JID's node part when in debug version + display error directly from the DBus object

This commit is contained in:
souliane 2015-03-24 07:38:40 +01:00
commit 294b42f15c

View file

@ -622,13 +622,17 @@ class PrimitivusApp(QuickApp, InputHistory):
if callback and 'validated' in data:
callback(callback_id, data, profile)
def action_eb(failure):
self.showPopUp(sat_widgets.Alert(failure.fullname, failure.message, ok_cb=self.removePopUp))
self.bridge.launchAction(callback_id, data, profile, callback=action_cb, errback=self.showFailure)
self.bridge.launchAction(callback_id, data, profile, callback=action_cb, errback=action_eb)
def showFailure(self, failure):
"""Show a failure that has been returned by an asynchronous bridge method.
@param failure (defer.Failure): Failure instance
"""
self.showPopUp(sat_widgets.Alert(failure.classname, failure.message, ok_cb=self.removePopUp))
def askConfirmationHandler(self, confirmation_id, confirmation_type, data, profile):
answer_data={}
answer_data = {}
def dir_selected_cb(path):
dest_path = join(path, data['filename'])
@ -710,12 +714,7 @@ class PrimitivusApp(QuickApp, InputHistory):
def onJoinRoom(self, button, edit):
self.removePopUp()
room_jid = jid.JID(edit.get_edit_text())
if room_jid.is_valid():
self.bridge.joinMUC(room_jid, self.profiles[self.current_profile].whoami.node, {}, self.current_profile)
else:
message = _("'%s' is an invalid jid.JID !") % room_jid
log.error (message)
self.showPopUp(sat_widgets.Alert(_("Error"), message, ok_cb=self.removePopUp))
self.bridge.joinMUC(room_jid, self.profiles[self.current_profile].whoami.node, {}, self.current_profile, callback=lambda dummy: None, errback=self.showFailure)
#MENU EVENTS#
def onConnectRequest(self, menu):
@ -739,7 +738,7 @@ class PrimitivusApp(QuickApp, InputHistory):
def onJoinRoomRequest(self, menu):
"""User wants to join a MUC room"""
pop_up_widget = sat_widgets.InputDialog(_("Entering a MUC room"), _("Please enter MUC's JID"), default_txt = 'room@muc_service.server.tld', cancel_cb=self.removePopUp, ok_cb=self.onJoinRoom)
pop_up_widget = sat_widgets.InputDialog(_("Entering a MUC room"), _("Please enter MUC's JID"), default_txt=C.DEFAULT_MUC, cancel_cb=self.removePopUp, ok_cb=self.onJoinRoom)
self.showPopUp(pop_up_widget)
def onAboutRequest(self, menu):