-
-
Notifications
You must be signed in to change notification settings - Fork 994
Closed
Description
No custom styling is applied either through file, CSS, or DEFAULT_CSS
the original styles for elements is correct, i just cannot modify any of it, despite everything I've tried
textual diagnose: https://pastebin.com/PuBBPfWV
no errors are showing up through textual console, just loads of Show, Resize events
Tested running in vscode integrated terminal, Kitty, and Konsole with no change.
Tested all different selectors, properties, combinations etc..
CSS File:
SearchList {
width: 100%;
height: auto;
margin: 1 1;
border: solid blue;
background: red;
}
SearchList > ListItem {
height: 3;
background: green;
}
SearchList > ListItem > HorizontalGroup {
width: 100%;
height: 100%;
}
SearchList > ListItem Label {
width: 100%;
text-align: left;
padding: 0 1;
}
* {
background: red;
}
Screen {
background: red;
}
App Class:
class TUI(App):
def compose(self) -> ComposeResult:
self.tabs = TabbedContent("■", "tab 2", "tab 3")
with self.tabs:
yield Search()
yield Markdown("# Tab 1\n\nThis is the content of Tab 1", id="tab1")
yield Markdown("# Tab 2\n\nThis is the content of Tab 2", id="tab2")
def on_mount(self) -> None:
self.tabs.titles[0] = "Search"
Search Class:
class SearchList(Static):
CSS_PATH = "/home/theo/Documents/github/odds-better/tui/search.tcss"
options: reactive[List[tuple[str,int]]] = reactive([])
def __init__(self, title: str, items: Iterable) -> None:
super().__init__()
self.title = title
self.options = sorted([(i.name, i.value) for i in items], key=lambda x: x[0])
def on_mount(self) -> None:
styles = Styles()
styles.width = 45
styles.height = len(self.options) + 2
styles.overflow_y = "hidden"
self.styles.merge(styles)
def compose(self) -> ComposeResult:
yield Label(self.title)
with VerticalGroup():
with ListView():
for i in self.options:
with ListItem():
with HorizontalGroup():
yield Label(i[0]) # name
class Search(VerticalGroup):
"""A search box with a label and input field."""
CSS='''
VerticalGroup {
background: red;
}
'''
def on_mount(self) -> None:
self.styles.overflow_y = "hidden"
def compose(self) -> ComposeResult:
with HorizontalGroup():
yield SearchList("Sport", Sport)
yield SearchList("Category", Category)
Metadata
Metadata
Assignees
Labels
No labels