mirror of https://github.com/python/cpython
Support underlining of menu labels
This commit is contained in:
parent
6e0a413693
commit
b5eed0328f
|
@ -82,17 +82,18 @@ class EditorWindow:
|
||||||
self.saved_change_hook()
|
self.saved_change_hook()
|
||||||
|
|
||||||
menu_specs = [
|
menu_specs = [
|
||||||
("file", "File"),
|
("file", "_File"),
|
||||||
("edit", "Edit"),
|
("edit", "_Edit"),
|
||||||
("help", "Help"),
|
("help", "_Help"),
|
||||||
]
|
]
|
||||||
|
|
||||||
def createmenubar(self):
|
def createmenubar(self):
|
||||||
mbar = self.menubar
|
mbar = self.menubar
|
||||||
self.menudict = mdict = {}
|
self.menudict = mdict = {}
|
||||||
for name, label in self.menu_specs:
|
for name, label in self.menu_specs:
|
||||||
|
underline, label = self.Bindings.prepstr(label)
|
||||||
mdict[name] = menu = Menu(mbar, name=name)
|
mdict[name] = menu = Menu(mbar, name=name)
|
||||||
mbar.add_cascade(label=label, menu=menu)
|
mbar.add_cascade(label=label, menu=menu, underline=underline)
|
||||||
self.Bindings.fill_menus(self.text, mdict)
|
self.Bindings.fill_menus(self.text, mdict)
|
||||||
|
|
||||||
def about_dialog(self, event=None):
|
def about_dialog(self, event=None):
|
||||||
|
|
|
@ -21,7 +21,7 @@ class MultiEditorWindow(EditorWindow):
|
||||||
|
|
||||||
# Override menu bar specs
|
# Override menu bar specs
|
||||||
menu_specs = EditorWindow.menu_specs[:]
|
menu_specs = EditorWindow.menu_specs[:]
|
||||||
menu_specs.insert(len(menu_specs)-1, ("windows", "Windows"))
|
menu_specs.insert(len(menu_specs)-1, ("windows", "_Windows"))
|
||||||
|
|
||||||
def __init__(self, flist, filename, key):
|
def __init__(self, flist, filename, key):
|
||||||
self.flist = flist
|
self.flist = flist
|
||||||
|
|
Loading…
Reference in New Issue