# HG changeset patch # User souliane # Date 1427179120 -3600 # Node ID 0dca4f9b264da3df0f20ada55f79ce926563c7dd # Parent 73f8582c7c99c5c0da47ee0a447a22d0834c09f4 primitivus: prefill "Join MUC" dialog with only the JID's node part when in debug version + display error directly from the DBus object diff -r 73f8582c7c99 -r 0dca4f9b264d frontends/src/primitivus/primitivus --- a/frontends/src/primitivus/primitivus Tue Mar 24 07:34:32 2015 +0100 +++ b/frontends/src/primitivus/primitivus Tue Mar 24 07:38:40 2015 +0100 @@ -622,13 +622,17 @@ 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 @@ 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 @@ 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): diff -r 73f8582c7c99 -r 0dca4f9b264d frontends/src/quick_frontend/constants.py --- a/frontends/src/quick_frontend/constants.py Tue Mar 24 07:34:32 2015 +0100 +++ b/frontends/src/quick_frontend/constants.py Tue Mar 24 07:38:40 2015 +0100 @@ -42,13 +42,8 @@ XMLUI_STATUS_CANCELLED = constants.Const.XMLUI_DATA_CANCELLED # MUC - USER_CHAT_STATES = { - "active": u'✔', - "inactive": u'☄', - "gone": u'✈', - "composing": u'✎', - "paused": u"⦷" - } + DEFAULT_MUC_NODE = u'sat' + DEFAULT_MUC = DEFAULT_MUC_NODE if constants.Const.APP_VERSION.endswith(u'D') else u"%s@%s" % (DEFAULT_MUC_NODE, 'chat.jabberfr.org') # Roster CONTACT_GROUPS = 'groups' @@ -62,6 +57,13 @@ # Chats CHAT_ONE2ONE = 'one2one' CHAT_GROUP = 'group' + USER_CHAT_STATES = { + "active": u'✔', + "inactive": u'☄', + "gone": u'✈', + "composing": u'✎', + "paused": u"⦷" + } # Widgets management # FIXME: should be in quick_frontend.constant, but Libervia doesn't inherit from it diff -r 73f8582c7c99 -r 0dca4f9b264d frontends/src/tools/misc.py --- a/frontends/src/tools/misc.py Tue Mar 24 07:34:32 2015 +0100 +++ b/frontends/src/tools/misc.py Tue Mar 24 07:38:40 2015 +0100 @@ -18,10 +18,6 @@ # along with this program. If not, see . -# Default value for the "New discussion room" user input -DEFAULT_MUC = 'sat@chat.jabberfr.org' - - class InputHistory(object): def _updateInputHistory(self, text=None, step=None, callback=None, mode=""):