-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
47 lines (35 loc) · 1003 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from textual.app import App, ComposeResult
from textual.binding import Binding
from textual.widgets import DataTable, Header, Footer, Placeholder
import csv
import io
CSV = ""
with open("data.csv") as f:
CSV = f.read()
class Script(DataTable):
pass
class MuteSheet(DataTable):
pass
class ShowRunner(App):
TITLE = "ShowRuner"
CSS_PATH = "styles.scss"
BINDINGS = [
Binding("ctrl+c,ctrl+q", "app.quit", "Quit", show=True),
]
script: Script
mute_sheet: MuteSheet
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.script = Script()
self.mute_sheet = MuteSheet()
def on_mount(self) -> None:
rows = csv.reader(io.StringIO(CSV))
self.script.add_columns(*next(rows))
self.script.add_rows(rows)
def compose(self) -> ComposeResult:
yield Header()
yield self.script
yield Footer()
if __name__ == "__main__":
app = ShowRunner()
app.run()