2026-01-13 16:06:57 +11:00
|
|
|
from textual.app import App, ComposeResult
|
2026-01-14 14:43:57 +11:00
|
|
|
from textual.widgets import Footer, Tab, Tabs, Header
|
2026-01-13 16:06:57 +11:00
|
|
|
|
|
|
|
|
from ui.widgets.sidebar import Sidebar
|
2026-01-14 15:51:34 +11:00
|
|
|
from ui.widgets.timeline import Timeline, TimelineRow
|
2026-01-13 21:33:25 +11:00
|
|
|
from ui.widgets.project_settings import ProjectSettings
|
2026-01-14 15:51:34 +11:00
|
|
|
from ui.widgets.channel import Channel
|
|
|
|
|
|
|
|
|
|
from project import ProjectChannel
|
2026-01-13 16:06:57 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class AppUI(App):
|
2026-01-14 10:31:26 +11:00
|
|
|
CSS_PATH = "../assets/style.tcss"
|
|
|
|
|
|
2026-01-14 14:43:57 +11:00
|
|
|
theme = "tokyo-night"
|
|
|
|
|
|
2026-01-14 09:11:09 +11:00
|
|
|
def __init__(self, project):
|
2026-01-13 20:06:28 +11:00
|
|
|
super().__init__()
|
2026-01-14 07:02:32 +11:00
|
|
|
self.zoom_level = 0.05
|
2026-01-14 12:20:53 +11:00
|
|
|
self.last_zoom_level = self.zoom_level
|
2026-01-14 09:11:09 +11:00
|
|
|
self.project = project
|
2026-01-14 14:43:57 +11:00
|
|
|
|
2026-01-14 15:51:34 +11:00
|
|
|
def create_channel(self, name: str):
|
|
|
|
|
self.query_one("#channels").mount(Channel(
|
|
|
|
|
len(self.project.channels),
|
|
|
|
|
name,
|
|
|
|
|
), before=-1)
|
|
|
|
|
self.query_one("#rows").mount(TimelineRow())
|
|
|
|
|
|
|
|
|
|
self.project.channels.append(ProjectChannel(
|
|
|
|
|
name
|
|
|
|
|
))
|
|
|
|
|
|
2026-01-13 16:06:57 +11:00
|
|
|
def compose(self) -> ComposeResult:
|
2026-01-14 14:43:57 +11:00
|
|
|
with Tabs(id="top-menu"):
|
|
|
|
|
yield Tab("File")
|
|
|
|
|
yield Tab("Edit")
|
|
|
|
|
yield Tab("View")
|
|
|
|
|
yield Tab("Help")
|
2026-01-13 16:06:57 +11:00
|
|
|
yield Sidebar()
|
|
|
|
|
yield Timeline()
|
2026-01-13 21:33:25 +11:00
|
|
|
yield ProjectSettings()
|
2026-01-13 16:06:57 +11:00
|
|
|
yield Footer()
|