mirror of
https://github.com/Foltik/dotfiles
synced 2024-11-27 21:19:51 -05:00
Add enable/disable all hotkey
This commit is contained in:
parent
72c6abb1b6
commit
9d181f9f8c
16
lib/menu.py
16
lib/menu.py
@ -109,12 +109,28 @@ class ChecklistMenu(Menu):
|
||||
text_mode = curses.A_REVERSE if index == self.position else curses.A_NORMAL
|
||||
self.window.addstr(index + 3, 1, text, text_mode)
|
||||
|
||||
def all(self, val):
|
||||
for i in range(0, len(self.states)):
|
||||
self.states[i] = val
|
||||
|
||||
for item in self.items:
|
||||
fn = item[1]
|
||||
if isinstance(fn, LambdaType):
|
||||
fn(val)
|
||||
|
||||
|
||||
def input(self, key):
|
||||
super().input(key)
|
||||
|
||||
if key == ord('\t'):
|
||||
self.expand(self.position)
|
||||
|
||||
if key == ord('e'):
|
||||
self.all(True)
|
||||
|
||||
if key == ord('d'):
|
||||
self.all(False)
|
||||
|
||||
def expand(self, index):
|
||||
if len(self.items[index]) >= 3:
|
||||
self.items[index][2]()
|
||||
|
Loading…
Reference in New Issue
Block a user