def _key_handler(self, instance, KEY, *args): # Reakce na stisk systémové klávesy OS Android
print "Key: {0}".format(KEY)
if KEY == 1001:
if self.sm.current not in ('MainMenuScreen', 'GameScreen'):
if self.sm.current == "SettingsScreen":
self.sm.get_screen("SettingsScreen").dropdown.dismiss()
self.sm.current_screen.prev()
else:
if self.sm.current == 'MainMenuScreen':
text = self.L.STR_POPUP_EXIT
title = self.L.STR_POPUP_EXIT_TITLE
yes_callback = self.popupStop
else:
text = self.L.STR_POPUP_DISCONNECT
title = self.L.STR_POPUP_DISCONNECT_TITLE
yes_callback = self.popupDisconnect
content = BoxLayout(orientation='vertical')
content.add_widget(Label(text=text, font_name='font/Roboto-Regular.ttf', font_size='14dp'))
buttons = GridLayout(cols=2, rows=1, spacing=10, size_hint=(1, .3))
yes = Button(text=self.L.STR_YES)
yes.bind(on_press=yes_callback)
no = Button(text=self.L.STR_NO)
buttons.add_widget(yes)
buttons.add_widget(no)
content.add_widget(buttons)
self.popupExit = Popup(title=title, size_hint=(.7,.3), content=content, auto_dismiss=False)
no.bind(on_press=self.popupExit.dismiss)
self.popupExit.open()
elif KEY == 1002:
self.dispatch('on_pause')
elif KEY == 1004:
self.dispatch('on_pause')
评论列表
文章目录