@on(RecordControls.OBSWSConnected, "#record_controls")
def on_obs_ws_connected(self, message: RecordControls.OBSWSConnected):
api: obs.API = self.query_exactly_one("#api")
- obs_websocket_pane = self.query_exactly_one("#obs_websocket_pane")
+ obs_websocket_pane: OBSWebSocketPane = self.query_exactly_one("#obs_websocket_pane")
host_setting = obs_websocket_pane.host
port_setting = obs_websocket_pane.port
password_setting = obs_websocket_pane.password
@on(RecordControls.OBSWSDisconnected, "#record_controls")
def on_obs_ws_disconnected(self, message: RecordControls.OBSWSDisconnected):
api: obs.API = self.query_exactly_one("#api")
- obs_websocket_pane = self.query_exactly_one("#obs_websocket_pane")
+ obs_websocket_pane: OBSWebSocketPane = self.query_exactly_one("#obs_websocket_pane")
self._query_api("disconnect")
if not api.is_connected:
obs_websocket_pane.enable_contents()
def update_monitors(self, obs_stats: obs.OBSStats):
record_controls: RecordControls = self.query_exactly_one("#record_controls")
- obs_settings = self.query_exactly_one("#obs_settings_pane")
+ obs_settings: OBSSettingsPane = self.query_exactly_one("#obs_settings_pane")
stats_display: StatsDisplay = self.query_exactly_one("#stats_display")
record_controls.obsws_connected = obs_stats.obsws_connection_active
--- /dev/null
+from typing import Any, Self, TypeVar
+from enum import Enum
+from functools import partial
+from textual.message import Message
+from textual.widget import Widget
+from textual.widgets import TabPane, Input
+from ...message import MSGBase
+
+class SettingsMSGBase(MSGBase):
+ value: Any
+ def __init__(self: Self, control: Widget, value: any, _log_me: bool): ...
+
+class PaneBase(TabPane):
+ def disable_contents(self: Self) -> None: ...
+ def enable_contents(self: Self) -> None: ...
+
+class SettingsType(Enum):
+ STRING = None
+ FLOAT = None
+ INT = None
+ widget: partial[Widget]
+ type: type
+ msg: Message
+ expected_type: type
+
+class MakePaneSubclassResult(PaneBase):
+ DEFAULT_CSS: str
+
+def make_pane_subclass(cls_name: str, settings: list[str], settings_type_list: list[SettingsType], defaults_list: list[Any]) -> MakePaneSubclassResult: ...
\ No newline at end of file
--- /dev/null
+from typing import Self, TypeVar
+from textual.containers import Container
+from textual.widgets import TabPane
+from textual.reactive import reactive
+from textual.message import Message
+from .pane import PaneBase, SettingsMSGBase, SettingsType
+
+class OBSSettingsPane(PaneBase):
+ record_path: reactive[str]
+ class RecordPathChanged(SettingsMSGBase): ...
+ def watch_record_path(self: Self, value: str): ...
+ def on_record_path_changed(self: Self, event: Message): ...
+
+class OBSWebSocketPane(PaneBase):
+ host: reactive[str]
+ port: reactive[int]
+ password: reactive[str]
+ timeout: reactive[float]
+ class HostChanged(SettingsMSGBase): ...
+ class PortChanged(SettingsMSGBase): ...
+ class PasswordChanged(SettingsMSGBase): ...
+ class TimeoutChanged(SettingsMSGBase): ...
+ def watch_host(self: Self, value: str): ...
+ def watch_port(self: Self, value: int): ...
+ def watch_password(self: Self, value: str): ...
+ def watch_timeout(self: Self, value: float): ...
+ def on_host_changed(self: Self, event: Message): ...
+ def on_port_changed(self: Self, event: Message): ...
+ def on_password_changed(self: Self, event: Message): ...
+ def on_timeout_changed(self: Self, event: Message): ...
+
+class OBSCTLPane(PaneBase): ...
+
+class SettingsBlock(Container): ...
\ No newline at end of file