Merge pull request #679 from mattrose/add-readonly

Add Readonly toggle to popup menu
This commit is contained in:
Matt Rose 2022-11-18 23:15:43 -05:00 committed by GitHub
commit 2aff8dbf30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -1047,6 +1047,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

@ -262,6 +262,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'))