Mercurial > libervia-backend
diff frontends/src/primitivus/chat.py @ 2022:88c41a195728
primitivus (chat): added :topic (and :subject and :title aliases) to change subject with a dialog (/!\ urwid SàText need to be updated)
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 24 Jul 2016 19:00:50 +0200 |
parents | f67da1cab6d3 |
children | 01aff34e8873 |
line wrap: on
line diff
--- a/frontends/src/primitivus/chat.py Sun Jul 24 18:59:02 2016 +0200 +++ b/frontends/src/primitivus/chat.py Sun Jul 24 19:00:50 2016 +0200 @@ -603,5 +603,18 @@ self.title_dynamic = C.CHAT_STATE_ICON[state] self.host.redraw() # FIXME: should not be necessary + def _onSubjectDialogCb(self, button, dialog): + self.changeSubject(dialog.text) + self.host.removePopUp(dialog) + + def onSubjectDialog(self, new_subject=None): + dialog = sat_widgets.InputDialog( + _(u'Change title'), + _(u'Enter the new title'), + default_txt=new_subject if new_subject is not None else self.subject) + dialog.setCallback('ok', self._onSubjectDialogCb, dialog) + dialog.setCallback('cancel', lambda dummy: self.host.removePopUp(dialog)) + self.host.showPopUp(dialog) + quick_widgets.register(quick_chat.QuickChat, Chat) quick_widgets.register(quick_games.Tarot, game_tarot.TarotGame)