Merge pull request #42 from nbeaver/add-layout-launcher

Add layout launcher to terminal popup menu.
This commit is contained in:
Matt Rose 2020-05-16 21:04:15 -04:00 committed by GitHub
commit 396038f18f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -13,6 +13,7 @@ from .util import err, dbg
from .config import Config from .config import Config
from .prefseditor import PrefsEditor from .prefseditor import PrefsEditor
from . import plugin from . import plugin
from .layoutlauncher import LayoutLauncher
class TerminalPopupMenu(object): class TerminalPopupMenu(object):
"""Class implementing the Terminal context menu""" """Class implementing the Terminal context menu"""
@ -211,6 +212,7 @@ class TerminalPopupMenu(object):
submenu.append(item) submenu.append(item)
self.add_encoding_items(menu) self.add_encoding_items(menu)
self.add_layout_launcher(menu)
try: try:
menuitems = [] menuitems = []
@ -233,6 +235,11 @@ class TerminalPopupMenu(object):
return(True) return(True)
def add_layout_launcher(self, menu):
"""Add the layout list to the menu"""
item = Gtk.MenuItem.new_with_mnemonic(_('_Layouts...'))
item.connect('activate', lambda x: LayoutLauncher())
menu.append(item)
def add_encoding_items(self, menu): def add_encoding_items(self, menu):
"""Add the encoding list to the menu""" """Add the encoding list to the menu"""
@ -299,4 +306,3 @@ class TerminalPopupMenu(object):
radioitem.connect ('activate', terminal.on_encoding_change, radioitem.connect ('activate', terminal.on_encoding_change,
encoding[1]) encoding[1])
submenu.append (radioitem) submenu.append (radioitem)