quick app: added missing docstring in showDialog

This commit is contained in:
Goffi 2018-06-26 07:09:49 +02:00
commit cf0d3af803
2 changed files with 39 additions and 7 deletions

View file

@ -48,9 +48,12 @@ class Const(constants.Const):
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 @@ class Const(constants.Const):
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

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