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
3 changed files with 19 additions and 22 deletions

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):

View file

@ -42,13 +42,8 @@ class Const(constants.Const):
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 @@ class Const(constants.Const):
# 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

View file

@ -18,10 +18,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# 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=""):