Preliminary clockify support
This commit is contained in:
24
hamstertools/screens/clockify/projects.py
Normal file
24
hamstertools/screens/clockify/projects.py
Normal file
@ -0,0 +1,24 @@
|
||||
from textual.app import ComposeResult
|
||||
from textual.containers import VerticalScroll
|
||||
from textual.screen import Screen
|
||||
from textual.widgets import DataTable, Header, Footer
|
||||
|
||||
from hamstertools.db import ClockifyProject
|
||||
|
||||
|
||||
class ClockifyProjectScreen(Screen):
|
||||
"""Screen for listing Clockify projects"""
|
||||
|
||||
BINDINGS = [("q", "quit", "Quit")]
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Header()
|
||||
yield VerticalScroll(DataTable())
|
||||
yield Footer()
|
||||
|
||||
def on_mount(self) -> None:
|
||||
table = self.query_one(DataTable)
|
||||
table.add_columns("ID", "Name", "Workspace ID")
|
||||
|
||||
for project in ClockifyProject.select():
|
||||
table.add_row(project.clockify_id, project.name, project.workspace_id)
|
Reference in New Issue
Block a user