fix keybindings when bottom window is out of focus

This commit is contained in:
yequari 2023-07-04 17:39:04 -07:00
parent 55196c60fe
commit 2c130bf515
1 changed files with 9 additions and 7 deletions

16
nex.py
View File

@ -120,10 +120,10 @@ class Browser(ptg.WindowManager):
vertical_align=ptg.VerticalAlignment.TOP)
self.footer = ptg.Window(
ptg.Splitter(
ptg.KeyboardButton("Back", self.back, bound='b'),
ptg.KeyboardButton("Forward", self.forward, bound='f'),
ptg.KeyboardButton("Reload", self.reload, bound='r'),
ptg.KeyboardButton("Quit", self.stop, bound='q')
["(B)ack", self.back],
["(F)orward", self.forward],
["(R)eload", self.reload],
["(Q)uit", lambda *_: self.stop()]
),
box="EMPTY",
is_persistant=True
@ -134,10 +134,13 @@ class Browser(ptg.WindowManager):
self.update()
def _create_key_bindings(self):
self.bind('j', lambda *_: self.body.scroll(5))
self.bind(ptg.keys.DOWN, lambda *_: self.body.scroll(5))
self.bind('k', lambda *_: self.body.scroll(-5))
self.bind(ptg.keys.UP, lambda *_: self.body.scroll(-5))
self.bind('j', lambda *_: self.body.scroll(5))
self.bind('k', lambda *_: self.body.scroll(-5))
self.bind('b', self.back)
self.bind('f', self.forward)
self.bind('r', self.reload)
self.bind('q', lambda *_: self.stop())
for i in range(10):
@ -148,7 +151,6 @@ class Browser(ptg.WindowManager):
self.layout.add_break()
self.layout.add_slot("Footer", height=1)
# self.add(self.header)
self.add(self.body)
self.add(self.footer)