display.py 文件源码

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

项目:sshchan 作者: einchan 项目源码 文件源码
def button_press(self, button, data):
        """Generic callback method for buttons (not key-presses!).

        @button - button object instance that called the method,
        @data - (string) additional data provided by calling button
            instance, used to define what action should be taken.
        """
        if data in self.config.get_boardlist().keys():
            # Board button was pressed.
            # If the board was entered from any view other than MOTD
            # (e.g. other board view), pop the widget from stack, so
            # pressing ESC will return to MOTD.
            if not self.motd_flag:
                del self.loop.Widget
            self.motd_flag = False
            self.help_flag = False
            self.board.name = data
            # Transfer control to BoardView instance.
            BoardView(self.loop, self.config, self.board, self)
        elif data == "back":
            # Clear the help flag, to avoid bugs.
            self.help_flag = False
            # Go back, restore saved widgets from previous screen.
            del self.loop.Widget
            # Check if we're on the main screen to avoid bugs.
            if self.loop.stack_len == 1:
                self.motd_flag = True
        elif data == "quit":
            # Bai
            raise ur.ExitMainLoop()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号