Mercurial > libervia-backend
diff sat_frontends/quick_frontend/quick_app.py @ 2618:fe9888d3fcb6
quick app: added missing docstring in showDialog
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 26 Jun 2018 07:09:49 +0200 |
parents | bd9d92bc0d6c |
children | 56f94936df1e |
line wrap: on
line diff
--- 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):