window.py 文件源码

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

项目:nvim-pygtk3 作者: rliang 项目源码 文件源码
def update(self, buflist: list, bufcurr: int):
        """Updates the widget's buttons.

        Increases the internal button cache if needed, then displays the
        appropriate amount of buttons, updating their state.

        :buflist: list of tuples (buffer-number, buffer-name, buffer-modified).
        :bufcurr: the active buffer's number.

        """
        self.props.updating = True
        self.bids = [id for id, *_ in buflist]
        for _ in range(len(buflist) - len(self.btns)):
            ico = Gtk.Image(icon_name='document-edit-symbolic')
            btn = Gtk.ToggleButton(None, can_focus=False, image=ico)
            btn.connect('toggled', self._do_button_toggled)
            self.btns.append(btn)
        for btn in self.get_children():
            self.remove(btn)
        for btn, (id, name, modified) in zip(self.btns, buflist):
            btn.set_label(name)
            btn.set_active(id == bufcurr)
            btn.set_always_show_image(modified)
            self.add(btn)
        self.show_all()
        self.props.updating = False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号