Shows Editor Screen vis
parent
9b57007d5e
commit
24e85d7005
@ -0,0 +1 @@
|
|||||||
|
__pycache__
|
@ -0,0 +1,16 @@
|
|||||||
|
from textual.app import App, ComposeResult
|
||||||
|
from textual.screen import Screen
|
||||||
|
from textual.widgets import Header, Footer, Placeholder, Label
|
||||||
|
|
||||||
|
class DashboardScreen(Screen):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
context = self.app.getContext()
|
||||||
|
context['dashboard'] = 'dashboard'
|
||||||
|
|
||||||
|
def compose(self) -> ComposeResult:
|
||||||
|
yield Header(show_clock=True)
|
||||||
|
yield Placeholder("Dashboard Screen")
|
||||||
|
yield Footer()
|
@ -0,0 +1,12 @@
|
|||||||
|
from textual.app import App, ComposeResult
|
||||||
|
from textual.screen import Screen
|
||||||
|
from textual.widgets import Header, Footer, Placeholder, Label
|
||||||
|
|
||||||
|
class HelpScreen(Screen):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
context = self.app.getContext()
|
||||||
|
def compose(self) -> ComposeResult:
|
||||||
|
yield Placeholder("Help Screen")
|
||||||
|
yield Footer()
|
||||||
|
|
@ -0,0 +1,39 @@
|
|||||||
|
from textual.app import App, ComposeResult
|
||||||
|
from textual.screen import Screen
|
||||||
|
from textual.widgets import Header, Footer, Placeholder, Label
|
||||||
|
|
||||||
|
from .shows_screen import ShowsScreen
|
||||||
|
from .warning_screen import WarningScreen
|
||||||
|
from .dashboard_screen import DashboardScreen
|
||||||
|
from .settings_screen import SettingsScreen
|
||||||
|
from .help_screen import HelpScreen
|
||||||
|
|
||||||
|
class ModesApp(App):
|
||||||
|
|
||||||
|
TITLE = "FFX"
|
||||||
|
|
||||||
|
BINDINGS = [
|
||||||
|
("q", "quit()", "Quit"),
|
||||||
|
# ("d", "switch_mode('dashboard')", "Dashboard"),
|
||||||
|
# ("s", "switch_mode('settings')", "Settings"),
|
||||||
|
# ("h", "switch_mode('help')", "Help"),
|
||||||
|
]
|
||||||
|
|
||||||
|
MODES = {
|
||||||
|
"shows": ShowsScreen,
|
||||||
|
"warning": WarningScreen,
|
||||||
|
"dashboard": DashboardScreen,
|
||||||
|
"settings": SettingsScreen,
|
||||||
|
"help": HelpScreen,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def __init__(self, context = {}):
|
||||||
|
super().__init__()
|
||||||
|
self.context = context
|
||||||
|
|
||||||
|
def on_mount(self) -> None:
|
||||||
|
self.switch_mode("shows")
|
||||||
|
|
||||||
|
def getContext(self):
|
||||||
|
return self.context
|
@ -0,0 +1,11 @@
|
|||||||
|
from textual.app import App, ComposeResult
|
||||||
|
from textual.screen import Screen
|
||||||
|
from textual.widgets import Header, Footer, Placeholder, Label
|
||||||
|
|
||||||
|
class SettingsScreen(Screen):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
context = self.app.getContext()
|
||||||
|
def compose(self) -> ComposeResult:
|
||||||
|
yield Placeholder("Settings Screen")
|
||||||
|
yield Footer()
|
@ -0,0 +1,85 @@
|
|||||||
|
|
||||||
|
from textual.app import App, ComposeResult
|
||||||
|
from textual.screen import Screen
|
||||||
|
from textual.widgets import Header, Footer, Placeholder, Label, ListView, ListItem, Static, DataTable, Button
|
||||||
|
from textual.containers import Grid, Horizontal
|
||||||
|
|
||||||
|
|
||||||
|
class ShowsScreen(Screen):
|
||||||
|
|
||||||
|
CSS = """
|
||||||
|
|
||||||
|
Grid {
|
||||||
|
grid-size: 1;
|
||||||
|
grid-rows: 2 auto;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
padding: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#top {
|
||||||
|
height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#two {
|
||||||
|
column-span: 2;
|
||||||
|
row-span: 2;
|
||||||
|
tint: magenta 40%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box {
|
||||||
|
height: 100%;
|
||||||
|
border: solid green;
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
|
||||||
|
BINDINGS = [
|
||||||
|
("q", "quit()", "Quit"),
|
||||||
|
("e", "switch_mode('settings')", "Edit Show"),
|
||||||
|
("n", "switch_mode('dashboard')", "New Show")
|
||||||
|
# ("h", "switch_mode('help')", "Help"),
|
||||||
|
]
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
context = self.app.getContext()
|
||||||
|
context['dashboard'] = 'dashboard'
|
||||||
|
|
||||||
|
def compose(self):
|
||||||
|
|
||||||
|
# Create the DataTable widget
|
||||||
|
table = DataTable()
|
||||||
|
|
||||||
|
# Define the columns with headers
|
||||||
|
table.add_column("ID", width=10)
|
||||||
|
table.add_column("Name", width=20)
|
||||||
|
table.add_column("Age", width=10)
|
||||||
|
table.add_column("Country", width=20)
|
||||||
|
|
||||||
|
table.cursor_type = 'row'
|
||||||
|
|
||||||
|
# Sample data for rows
|
||||||
|
data = [
|
||||||
|
(1, "John Doe", 28, "USA"),
|
||||||
|
(2, "Jane Smith", 34, "Canada"),
|
||||||
|
(3, "Alice Johnson", 29, "UK"),
|
||||||
|
(4, "Bob Brown", 45, "Australia"),
|
||||||
|
(5, "Charlie Davis", 23, "USA"),
|
||||||
|
]
|
||||||
|
|
||||||
|
# Add rows to the table
|
||||||
|
for i in range(20):
|
||||||
|
for row in data:
|
||||||
|
table.add_row(*map(str, row)) # Convert each element to a string before adding
|
||||||
|
|
||||||
|
yield Header()
|
||||||
|
|
||||||
|
with Grid():
|
||||||
|
|
||||||
|
yield Static("Shows") # , classes="box"
|
||||||
|
|
||||||
|
yield table
|
||||||
|
|
||||||
|
yield Footer()
|
@ -0,0 +1,11 @@
|
|||||||
|
from textual.app import App, ComposeResult
|
||||||
|
from textual.screen import Screen
|
||||||
|
from textual.widgets import Header, Footer, Placeholder, Label
|
||||||
|
|
||||||
|
class WarningScreen(Screen):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
context = self.app.getContext()
|
||||||
|
def compose(self) -> ComposeResult:
|
||||||
|
yield Label("Warning! This file is not compliant to the defined source schema!")
|
||||||
|
yield Footer()
|
Loading…
Reference in New Issue