comparison cagou/plugins/plugin_wid_chat.py @ 357:4d3a0c4f2430

core: better back key (ESC) management: - back key (which is mapped to esc keycode by SDL2 backend) is now handler with a platform specific method when on root widget (i.e. a default widget is selected, or nothing is selected). Default behaviour is to do nothing, while on Android the app is put to background - CagouWidget now has a default key_input method which go back to default widget.
author Goffi <goffi@goffi.org>
date Sat, 18 Jan 2020 23:12:52 +0100
parents 307c2501d8b2
children abb57182ebfb
comparison
equal deleted inserted replaced
356:307c2501d8b2 357:4d3a0c4f2430
884 self.screen_manager.current = '' 884 self.screen_manager.current = ''
885 else: 885 else:
886 G.host.switchWidget( 886 G.host.switchWidget(
887 self, factory(plugin_info, contact_jid, profiles=[self.profile])) 887 self, factory(plugin_info, contact_jid, profiles=[self.profile]))
888 888
889 @property
890 def profiles(self):
891 return [self.profile]
892
893 def key_input(self, window, key, scancode, codepoint, modifier):
894 if key == 27:
895 # we go back to root screen
896 G.host.switchWidget(self)
897 return True
898
899 889
900 PLUGIN_INFO["factory"] = Chat.factory 890 PLUGIN_INFO["factory"] = Chat.factory
901 quick_widgets.register(quick_chat.QuickChat, Chat) 891 quick_widgets.register(quick_chat.QuickChat, Chat)