Mercurial > libervia-backend
diff frontends/src/primitivus/chat.py @ 1580:641cfd2faefe
Primitivus: better popups handling:
- widget to remove can now be specified in removePopUp: if it is not the current one, it will be removed from queue
- Primitivus.Alert method is a shortcut to display an Alert which will be removed on "OK" press
- showDialog is now obsolete and removed, if generic dialog creation is needed, XMLUI can be used
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 11 Nov 2015 18:32:59 +0100 |
parents | e2e75c3c7c7b |
children | 95ea323e7d04 |
line wrap: on
line diff
--- a/frontends/src/primitivus/chat.py Wed Nov 11 18:29:32 2015 +0100 +++ b/frontends/src/primitivus/chat.py Wed Nov 11 18:32:59 2015 +0100 @@ -22,7 +22,7 @@ log = logging.getLogger(__name__) import urwid from urwid_satext import sat_widgets -from urwid_satext.files_management import FileDialog +# from urwid_satext.files_management import FileDialog # FIXME from sat_frontends.quick_frontend import quick_widgets from sat_frontends.quick_frontend.quick_chat import QuickChat from sat_frontends.quick_frontend import quick_games @@ -378,27 +378,29 @@ def onSendFileRequest(self, menu): # TODO: move this to core with dynamic menus - dialog = FileDialog(ok_cb=self.onFileSelected, cancel_cb=self.host.removePopUp) - self.host.showPopUp(dialog, 80, 80) + pass + # dialog = FileDialog(ok_cb=self.onFileSelected, cancel_cb=self.host.removePopUp) # FIXME: to be removed + # self.host.showPopUp(dialog, 80, 80) # MISC EVENTS # - def onFileSelected(self, filepath): - self.host.removePopUp() - try: - filepath = filepath.decode('utf-8') # FIXME: correctly manage unicode - except UnicodeError: - log.error("FIXME: filepath with unicode error are not managed yet") - self.host.showDialog(_(u"File has a unicode error in its name, it's not yet managed by SàT"), title=_("Can't send file"), type_="error") - return - # FIXME: check last_resource: what if self.target.resource exists ? - last_resource = self.host.bridge.getMainResource(unicode(self.target.bare), self.profile) - if last_resource: - full_jid = jid.JID("%s/%s" % (self.target.bare, last_resource)) - else: - full_jid = self.target - progress_id = self.host.bridge.sendFile(full_jid, filepath, {}, self.profile) - self.host.addProgress(progress_id, filepath) - self.host.showDialog(_(u"You file request has been sent, we are waiting for your contact answer"), title=_("File request sent")) + # FIXME: to be removed + # def onFileSelected(self, filepath): + # self.host.removePopUp() + # try: + # filepath = filepath.decode('utf-8') # FIXME: correctly manage unicode + # except UnicodeError: + # log.error("FIXME: filepath with unicode error are not managed yet") + # self.host.showDialog(_(u"File has a unicode error in its name, it's not yet managed by SàT"), title=_("Can't send file"), type_="error") + # return + # # FIXME: check last_resource: what if self.target.resource exists ? + # last_resource = self.host.bridge.getMainResource(unicode(self.target.bare), self.profile) + # if last_resource: + # full_jid = jid.JID("%s/%s" % (self.target.bare, last_resource)) + # else: + # full_jid = self.target + # progress_id = self.host.bridge.sendFile(full_jid, filepath, {}, self.profile) + # self.host.addProgress(progress_id, filepath) + # self.host.showDialog(_(u"You file request has been sent, we are waiting for your contact answer"), title=_("File request sent")) def onDelete(self): QuickChat.onDelete(self)