comparison cagou/core/cagou_widget.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 19422bbd9c8e
children 9ef01266e3fe
comparison
equal deleted inserted replaced
356:307c2501d8b2 357:4d3a0c4f2430
121 self.selector.dismiss() 121 self.selector.dismiss()
122 factory = plugin_info["factory"] 122 factory = plugin_info["factory"]
123 new_widget = factory(plugin_info, None, iter(G.host.profiles)) 123 new_widget = factory(plugin_info, None, iter(G.host.profiles))
124 G.host.switchWidget(self, new_widget) 124 G.host.switchWidget(self, new_widget)
125 125
126 def key_input(self, window, key, scancode, codepoint, modifier):
127 if key == 27:
128 # we go back to root screen
129 G.host.switchWidget(self)
130 return True
131
126 def onHeaderInput(self): 132 def onHeaderInput(self):
127 log.info("header input text entered") 133 log.info("header input text entered")
128 134
129 def onHeaderInputComplete(self, wid, text): 135 def onHeaderInputComplete(self, wid, text):
130 return 136 return