Skip to content

Commit

Permalink
Merge pull request #116 from stsewd/refactor-lists
Browse files Browse the repository at this point in the history
TUI: refactor list widgets
  • Loading branch information
Seburath authored Nov 21, 2020
2 parents 4688d0a + 25494ca commit 713fbeb
Show file tree
Hide file tree
Showing 8 changed files with 442 additions and 95 deletions.
17 changes: 5 additions & 12 deletions lira/tui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self):
self.status = StatusBar(self)

self.menu = SidebarMenu(self)
self.menu.push(BooksList(self))
self.menu.reset(BooksList(self))

self.container = HSplit(
[
Expand Down Expand Up @@ -52,24 +52,17 @@ def __init__(self):
def get_key_bindings(self):
keys = KeyBindings()

@keys.add("tab")
@keys.add("down")
@keys.add(Keys.Tab)
def _(event):
focus_next(event)

@keys.add("s-tab")
@keys.add("up")
@keys.add(Keys.BackTab)
def _(event):
focus_previous(event)

@keys.add(Keys.Backspace)
@keys.add(Keys.ControlC)
@keys.add(Keys.ControlQ)
def _(event):
self.menu.pop()

@keys.add("c-c")
@keys.add("c-q")
def _(event):
"""Pressing Ctrl-Q or Ctrl-C will exit the user interface."""
exit_app()

return keys
Expand Down
3 changes: 3 additions & 0 deletions lira/tui/themes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

themes = {
"default": {
# Basic elements
"text": "#fff",
"strong": "#fff bold",
"literal": "#fff",
"emphasis": "#fff italic",
"title": "#fff bold",
"separator": "#aaa",
# Widgets
"list-item.focused": "bg:#0055aa #ffffff",
}
}

Expand Down
Loading

0 comments on commit 713fbeb

Please sign in to comment.