main.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:Mobile-TetriNET 作者: Smug28 项目源码 文件源码
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')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号