1
0
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:
Jack Foltz 2018-12-08 23:46:22 -05:00
parent 72c6abb1b6
commit 9d181f9f8c
Signed by: foltik
GPG Key ID: D1F0331758D1F29A

View File

@ -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]()