chatframe.py 文件源码

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

项目:ChatMaster3000 作者: pkrll 项目源码 文件源码
def __init__(self, delegate):
        """
            init
        """
        self.delegate = delegate
        # Create the components of the frame:
        # * The title and the clock in the header
        titleBar = TitleBar(("titleBar", "ChatMaster 3000"), align="center")
        clock = urwid.AttrMap(Clock(self.delegate, align="right"), "titleBar")
        # The actual title bar. The title has a relative width, while clock has a set width of 5 columns wide.
        self.titleBar = ColumnView([('weight', 1, titleBar), (5, clock)])

        self.chatLog = ChatWindow()
        self.chatBox = ChatBox("> ", self)
        # Create the channel list and set its label
        self.channelList = ChannelList()
        self.channelList.body.insert(0, urwid.Text(("channelList-text-bold", "Channels:")))
        # Wrap them with a display attribute. This will enable color application.
        header = self.titleBar.wrapWithAttribute("titleBar")
        footer = self.chatBox.wrapWithAttribute("footer")
        chatLog = self.chatLog.wrapWithAttribute("body")
        channelList = self.channelList.wrapWithAttribute("channelList")
        # Create a border between the channel list and the chat log
        channelListWithPadding = urwid.Padding(channelList, align="left", width=("relative", 95))
        channelListWithPadding = urwid.AttrMap(channelListWithPadding, "border")
        # Put them both in a columns widget
        self.columnView = ColumnView([(15, channelListWithPadding), ('weight', 1, chatLog)])
        # Call the super class and let it handle the heavy lifting.
        super(ChatFrame, self).__init__(self.columnView, header=header, footer=footer, focus_part='footer')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号