Add Readonly toggle to popup menu

Fixes #649
This commit is contained in:
Matthew Rose 2022-11-18 21:14:42 -05:00
parent 1aa437d6e3
commit 0d362fc0f5
2 changed files with 8 additions and 0 deletions

View File

@ -1045,6 +1045,9 @@ class Terminal(Gtk.VBox):
menu = TerminalPopupMenu(self)
menu.show(widget, event)
def do_readonly_toggle(self):
self.vte.props.input_enabled = not self.vte.props.input_enabled
def do_scrollbar_toggle(self):
"""Show or hide the terminal scrollbar"""
self.toggle_widget_visibility(self.scrollbar)

View File

@ -234,6 +234,11 @@ class TerminalPopupMenu(object):
menu.append(item)
menu.append(Gtk.SeparatorMenuItem())
item = self.menu_item(Gtk.CheckMenuItem, 'toggle_readonly', '_read only')
item.set_active(not(terminal.vte.get_input_enabled()))
item.connect('toggled', lambda x: terminal.do_readonly_toggle())
menu.append(item)
item = self.menu_item(Gtk.CheckMenuItem, 'toggle_scrollbar',
'Show _scrollbar')
item.set_active(terminal.scrollbar.get_property('visible'))