quick app: added missing docstring in showDialog

This commit is contained in:
Goffi 2018-06-26 07:09:49 +02:00
commit cf0d3af803

View file

@ -793,19 +793,45 @@ class QuickApp(object):
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):