Mercurial > libervia-backend
changeset 2618:fe9888d3fcb6
quick app: added missing docstring in showDialog
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 26 Jun 2018 07:09:49 +0200 |
parents | 81b70eeb710f |
children | e7bd2945518f |
files | sat_frontends/quick_frontend/constants.py sat_frontends/quick_frontend/quick_app.py |
diffstat | 2 files changed, 39 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/sat_frontends/quick_frontend/constants.py Sun Jun 24 21:59:29 2018 +0200 +++ b/sat_frontends/quick_frontend/constants.py Tue Jun 26 07:09:49 2018 +0200 @@ -48,9 +48,12 @@ CONTACT_SPECIAL = 'special' CONTACT_SPECIAL_GROUP = 'group' # group chat special entity CONTACT_SELECTED = 'selected' - CONTACT_PROFILE = 'profile' # used in handler to track where the contact is coming from + # used in handler to track where the contact is coming from + CONTACT_PROFILE = 'profile' CONTACT_SPECIAL_ALLOWED = (CONTACT_SPECIAL_GROUP,) # allowed values for special flag - CONTACT_DATA_FORBIDDEN = {CONTACT_GROUPS, CONTACT_RESOURCES, CONTACT_MAIN_RESOURCE, CONTACT_SELECTED, CONTACT_PROFILE} # set of forbidden names for contact data + # set of forbidden names for contact data + CONTACT_DATA_FORBIDDEN = {CONTACT_GROUPS, CONTACT_RESOURCES, CONTACT_MAIN_RESOURCE, + CONTACT_SELECTED, CONTACT_PROFILE} # Chats CHAT_STATE_ICON = { @@ -79,9 +82,12 @@ UPDATE_MODIFY = 'MODIFY' UPDATE_ADD = 'ADD' UPDATE_SELECTION = 'SELECTION' - UPDATE_STRUCTURE = 'STRUCTURE' # high level update (i.e. not item level but organisation of items) + # high level update (i.e. not item level but organisation of items) + UPDATE_STRUCTURE = 'STRUCTURE' - LISTENERS = {'avatar', 'nick', 'presence', 'profilePlugged', 'disconnect', 'gotMenus', 'menu', 'notification', 'notificationsClear', 'progressFinished', 'progressError'} + LISTENERS = {'avatar', 'nick', 'presence', 'profilePlugged', 'disconnect', 'gotMenus', + 'menu', 'notification', 'notificationsClear', 'progressFinished', + 'progressError'} # Notifications NOTIFY_MESSAGE = 'MESSAGE' # a message has been received
--- a/sat_frontends/quick_frontend/quick_app.py Sun Jun 24 21:59:29 2018 +0200 +++ b/sat_frontends/quick_frontend/quick_app.py Tue Jun 26 07:09:49 2018 +0200 @@ -793,19 +793,45 @@ if type == "subscribed": # this is a subscription confirmation, we just have to inform user # TODO: call self.getEntityMBlog to add the new contact blogs - self.showDialog(_("The contact %s has accepted your subscription") % entity.bare, _('Subscription confirmation')) + self.showDialog(_(u"The contact {contact} has accepted your subscription") + .format(contact=entity.bare), _(u'Subscription confirmation')) elif type == "unsubscribed": # this is a subscription refusal, we just have to inform user - self.showDialog(_("The contact %s has refused your subscription") % entity.bare, _('Subscription refusal'), 'error') + self.showDialog(_(u"The contact {contact} has refused your subscription") + .format(contact=entity.bare), + _(u'Subscription refusal'), + 'error') elif type == "subscribe": # this is a subscriptionn request, we have to ask for user confirmation # TODO: use sat.stdui.ui_contact_list to display the groups selector - self.showDialog(_("The contact %s wants to subscribe to your presence.\nDo you accept ?") % entity.bare, _('Subscription confirmation'), 'yes/no', answer_cb=self._subscribe_cb, answer_data=(entity, profile)) + self.showDialog(_(u"The contact {contact} wants to subscribe to your presence" + u".\nDo you accept ?").format(contact=entity.bare), + _('Subscription confirmation'), + 'yes/no', + answer_cb=self._subscribe_cb, + answer_data=(entity, profile)) def showDialog(self, message, title, type="info", answer_cb=None, answer_data=None): + """Show a dialog to user + + Frontends must override this method + @param message(unicode): body of the dialog + @param title(unicode): title of the dialog + @param type(unicode): one of: + - "info": information dialog (callbacks not used) + - "warning": important information to notice (callbacks not used) + - "error": something went wrong (callbacks not used) + - "yes/no": a dialog with 2 choices (yes and no) + @param answer_cb(callable): method to call on answer. + Arguments depend on dialog type: + - "yes/no": argument is a boolean (True for yes) + @param answer_data(object): data to link on callback + """ + # FIXME: misnamed method + types are not well chosen. Need to be rethought raise NotImplementedError def showAlert(self, message): + # FIXME: doesn't seems used anymore, to remove? pass #FIXME def dialogFailure(self, failure):