-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎉 Show Boards on BoardOverview works
Try with proper formatting of listitem to show additional Infos. Otherwise using a datatable might be more appropiate
- Loading branch information
Showing
3 changed files
with
89 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from typing import Iterable, TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from kanban_tui.app import KanbanTui | ||
|
||
from textual.containers import VerticalScroll | ||
from textual.widget import Widget | ||
from textual.widgets import ListView, ListItem, Label | ||
|
||
from kanban_tui.classes.board import Board | ||
|
||
# Or use Datatable? | ||
|
||
|
||
class BoardList(VerticalScroll): | ||
app: "KanbanTui" | ||
|
||
def compose(self) -> Iterable[Widget]: | ||
self.id = "board_list" | ||
|
||
yield ListView( | ||
*[BoardListItem(board=board) for board in self.app.board_list], | ||
) | ||
|
||
return super().compose() | ||
|
||
def on_mount(self): | ||
self.query_one(ListView).index = None | ||
|
||
|
||
class BoardListItem(ListItem): | ||
def __init__(self, board: Board) -> None: | ||
self.board = board | ||
super().__init__(id=f"listitem_board_{self.board.board_id}") | ||
|
||
def compose(self) -> Iterable[Widget]: | ||
yield Label(self.board.name) | ||
|
||
return super().compose() |