comparison 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
comparison
equal deleted inserted replaced
2617:81b70eeb710f 2618:fe9888d3fcb6
791 """Called when a subsciption management signal is received""" 791 """Called when a subsciption management signal is received"""
792 entity = jid.JID(raw_jid) 792 entity = jid.JID(raw_jid)
793 if type == "subscribed": 793 if type == "subscribed":
794 # this is a subscription confirmation, we just have to inform user 794 # this is a subscription confirmation, we just have to inform user
795 # TODO: call self.getEntityMBlog to add the new contact blogs 795 # TODO: call self.getEntityMBlog to add the new contact blogs
796 self.showDialog(_("The contact %s has accepted your subscription") % entity.bare, _('Subscription confirmation')) 796 self.showDialog(_(u"The contact {contact} has accepted your subscription")
797 .format(contact=entity.bare), _(u'Subscription confirmation'))
797 elif type == "unsubscribed": 798 elif type == "unsubscribed":
798 # this is a subscription refusal, we just have to inform user 799 # this is a subscription refusal, we just have to inform user
799 self.showDialog(_("The contact %s has refused your subscription") % entity.bare, _('Subscription refusal'), 'error') 800 self.showDialog(_(u"The contact {contact} has refused your subscription")
801 .format(contact=entity.bare),
802 _(u'Subscription refusal'),
803 'error')
800 elif type == "subscribe": 804 elif type == "subscribe":
801 # this is a subscriptionn request, we have to ask for user confirmation 805 # this is a subscriptionn request, we have to ask for user confirmation
802 # TODO: use sat.stdui.ui_contact_list to display the groups selector 806 # TODO: use sat.stdui.ui_contact_list to display the groups selector
803 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)) 807 self.showDialog(_(u"The contact {contact} wants to subscribe to your presence"
808 u".\nDo you accept ?").format(contact=entity.bare),
809 _('Subscription confirmation'),
810 'yes/no',
811 answer_cb=self._subscribe_cb,
812 answer_data=(entity, profile))
804 813
805 def showDialog(self, message, title, type="info", answer_cb=None, answer_data=None): 814 def showDialog(self, message, title, type="info", answer_cb=None, answer_data=None):
815 """Show a dialog to user
816
817 Frontends must override this method
818 @param message(unicode): body of the dialog
819 @param title(unicode): title of the dialog
820 @param type(unicode): one of:
821 - "info": information dialog (callbacks not used)
822 - "warning": important information to notice (callbacks not used)
823 - "error": something went wrong (callbacks not used)
824 - "yes/no": a dialog with 2 choices (yes and no)
825 @param answer_cb(callable): method to call on answer.
826 Arguments depend on dialog type:
827 - "yes/no": argument is a boolean (True for yes)
828 @param answer_data(object): data to link on callback
829 """
830 # FIXME: misnamed method + types are not well chosen. Need to be rethought
806 raise NotImplementedError 831 raise NotImplementedError
807 832
808 def showAlert(self, message): 833 def showAlert(self, message):
834 # FIXME: doesn't seems used anymore, to remove?
809 pass #FIXME 835 pass #FIXME
810 836
811 def dialogFailure(self, failure): 837 def dialogFailure(self, failure):
812 log.warning(u"Failure: {}".format(failure)) 838 log.warning(u"Failure: {}".format(failure))
813 839