def _do_button_toggled(self, btn: Gtk.ToggleButton):
"""Handler for when a button is toggled.
Emits `nvim-switch-buffer` if the button was toggled ON, and the widget
isn't in the middle of an update.
Also avoids toggling off buttons, since the user can't "unswitch" to a
buffer.
:btn: the toggled button.
"""
if not self.props.updating:
if btn.get_active():
id = self.bids[self.btns.index(btn)]
self.emit('nvim-switch-buffer', id)
else:
btn.set_active(True)
评论列表
文章目录