delete tui module
Its code is in main now
This commit is contained in:
parent
dd42e6119c
commit
1b565e5a4e
1 changed files with 0 additions and 59 deletions
|
|
@ -1,59 +0,0 @@
|
||||||
from textual.app import ComposeResult
|
|
||||||
from textual.containers import HorizontalGroup
|
|
||||||
from textual.screen import Screen
|
|
||||||
from textual.widget import Widget
|
|
||||||
from textual.widgets import Button, DataTable, Footer, Header, Input, Static
|
|
||||||
|
|
||||||
from .models import load_initial_data
|
|
||||||
|
|
||||||
|
|
||||||
TEILCHEN_DATA_HEADER = "pk Name Description Number Tags".split()
|
|
||||||
|
|
||||||
|
|
||||||
class SearchBar(Static):
|
|
||||||
DEFAULT_CSS = """
|
|
||||||
#teilchen-input {
|
|
||||||
width: 4fr;
|
|
||||||
}
|
|
||||||
#button-search, #button-add {
|
|
||||||
width: 1fr;
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
|
|
||||||
def compose(self) -> ComposeResult:
|
|
||||||
with HorizontalGroup(id="search-bar-widget"):
|
|
||||||
yield Input(
|
|
||||||
placeholder='This is a name. "This is the description" #these #are #tags',
|
|
||||||
tooltip=(
|
|
||||||
"Enter a name followed by a period, then a description "
|
|
||||||
'enclosed in double quotes ("). You should use #hashtags for any meta information. '
|
|
||||||
"Hashtags can be placed anywhere."
|
|
||||||
),
|
|
||||||
id="teilchen-input",
|
|
||||||
type="text",
|
|
||||||
)
|
|
||||||
yield Button("Add", variant="success", classes="search-bar-buttons", id="button-add")
|
|
||||||
yield Button(
|
|
||||||
"Search",
|
|
||||||
variant="default",
|
|
||||||
classes="search-bar-buttons",
|
|
||||||
id="button-search",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class SearchResults(Widget):
|
|
||||||
def compose(self) -> ComposeResult:
|
|
||||||
yield DataTable(id="table-search-result", cursor_type="row", zebra_stripes=True)
|
|
||||||
|
|
||||||
async def on_mount(self) -> None:
|
|
||||||
table: DataTable = self.query_one(DataTable)
|
|
||||||
table.add_columns(*TEILCHEN_DATA_HEADER)
|
|
||||||
table.add_rows(await load_initial_data())
|
|
||||||
|
|
||||||
|
|
||||||
class AddInventoryScreen(Screen):
|
|
||||||
def compose(self) -> ComposeResult:
|
|
||||||
yield Header()
|
|
||||||
yield SearchBar()
|
|
||||||
yield SearchResults()
|
|
||||||
yield Footer()
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue