MCPcopy
hub / github.com/tanelpoder/0xtools / SimpleTableApp

Class SimpleTableApp

xtop/tests/test_simple_table.py:9–47  ·  view source on GitHub ↗

Test simple table

Source from the content-addressed store, hash-verified

7from textual.widgets import DataTable, Header, Footer, Static, TabbedContent, TabPane
8
9class SimpleTableApp(App):
10 """Test simple table"""
11
12 CSS = """
13 DataTable {
14 height: 100%;
15 border: solid green;
16 }
17 """
18
19 def compose(self) -> ComposeResult:
20 """Create layout"""
21 yield Header()
22 yield Static("Test Table App")
23
24 with TabbedContent():
25 with TabPane("Test Tab", id="tab-0"):
26 yield DataTable(id="test-table")
27
28 yield Footer()
29
30 def on_mount(self) -> None:
31 """Initialize table with test data"""
32 table = self.query_one("#test-table", DataTable)
33
34 # Add columns
35 table.add_column("Col1", key="col1")
36 table.add_column("Col2", key="col2")
37 table.add_column("Col3", key="col3")
38
39 # Add test data
40 for i in range(10):
41 table.add_row(f"Row {i}", f"Value {i}", f"Data {i}")
42
43 # Focus the table
44 table.focus()
45
46 # Log what we did
47 print(f"Added {len(table.columns)} columns and {table.row_count} rows")
48
49if __name__ == "__main__":
50 app = SimpleTableApp()

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected