def on_obs_ws_disconnected(self, message: RecordControls.OBSWSDisconnected):
self.get_api().disconnect()
- @on(OBSSettingsPane.RecordPathChanged, "#obs_settings_pane")
- def on_settings_block_record_path_changed(self, message: OBSSettingsPane.RecordPathChanged):
+ @on(OBSSettingsPane.RecordPathSubmitted, "#obs_settings_pane")
+ def on_settings_block_record_path_changed(self, message: OBSSettingsPane.RecordPathSubmitted):
self.get_api().set_record_path(message.value)
type SettingsWidgetWidget = type[Input | Select[Any]]
type SettingsWidgetType = type[int | float | str]
-type SettingsWidgetMsg = type[Input.Submitted | Select.Changed]
+type SettingsWidgetMsg = Input.Submitted | Input.Changed
+type SettingsWidgetMsgType = type[Input.Submitted | Select.Changed]
type SettingsWidgetExpectedType = type[str]
class SettingsWidget(Enum):
"""(widget_class, setting type, listener message, widget-expected type)"""
return self.value[1]
@property
- def msg(self) -> SettingsWidgetMsg:
+ def msg(self) -> SettingsWidgetMsgType:
"""The message this SettingsType's widget posts when user interacts"""
return self.value[2]
return watch_func
def make_on_control_message(
- listener_message: SettingsWidgetMsg,
+ listener_message: SettingsWidgetMsgType,
listener_id: str,
reactive: reactive[Any],
post_message: type[SettingsMSGBase]):
new_dict: dict[str, Any] = dict()
for setting_name, setting_type, setting_default, _ in loop_list:
setting_control_id: str = f"{setting_type.widget.__name__.lower()}_{setting_name}"
- SettingChanged_name: str = f"{_snake_to_camel(setting_name)}Changed"
+ SettingChanged_name: str = f"{_snake_to_camel(setting_name)}Submitted"
watch_setting_name: str = f"watch_{setting_name}"
- on_setting_changed_name: str = f"on_{setting_name}_changed"
+ on_setting_changed_name: str = f"on_{setting_name}_submitted"
# For each desired setting (e.g. 'record_path'):
# Set up a record_path reactive
new_dict[setting_name] = reactive(setting_type.type(setting_default))
from enum import Enum
from typing import Any, ClassVar, Literal, Mapping, Self, Sequence, overload
+from textual.widget import Widget
from textual.widgets import Input, Select, TabPane
from textual.reactive import reactive
+from ...message import MSGBase
+class SettingsMSGBase(MSGBase):
+ value: Any
+ def __init__(self: Self, control: Widget, value: Any, *, _log_me: bool) -> None: ...
type SettingsWidgetWidget = type[Input | Select[Any]]
type SettingsWidgetType = type[int | float | str]
class OBSSettingsPane(PaneBaseSubclass):
record_path: ClassVar[reactive[str]]
- class RecordPathChanged(pane.SettingsMSGBase): ...
+ class RecordPathSubmitted(pane.SettingsMSGBase): ...
def watch_record_path(self: Self, value: str) -> None: ...
- def on_record_path_changed(self: Self, event: pane.SettingsMSGBase) -> None: ...
+ def on_record_path_submitted(self: Self, event: pane.SettingsMSGBase) -> None: ...
def compose(self: Self) -> ComposeResult: ...
class OBSWebSocketPane(PaneBaseSubclass):
port: ClassVar[reactive[int]]
password: ClassVar[reactive[str]]
timeout: ClassVar[reactive[float]]
- class HostChanged(pane.SettingsMSGBase): ...
- class PortChanged(pane.SettingsMSGBase): ...
- class PasswordChanged(pane.SettingsMSGBase): ...
- class TimeoutChanged(pane.SettingsMSGBase): ...
+ class HostSubmitted(pane.SettingsMSGBase): ...
+ class PortSubmitted(pane.SettingsMSGBase): ...
+ class PasswordSubmitted(pane.SettingsMSGBase): ...
+ class TimeoutSubmitted(pane.SettingsMSGBase): ...
def watch_host(self: Self, value: str) -> None: ...
def watch_port(self: Self, value: str) -> None: ...
def watch_password(self: Self, value: str) -> None: ...
def watch_timeout(self: Self, value: str) -> None: ...
- def on_host_changed(self: Self, event: pane.SettingsMSGBase) -> None: ...
- def on_port_changed(self: Self, event: pane.SettingsMSGBase) -> None: ...
- def on_password_changed(self: Self, event: pane.SettingsMSGBase) -> None: ...
- def on_timeout_changed(self: Self, event: pane.SettingsMSGBase) -> None: ...
+ def on_host_submitted(self: Self, event: pane.SettingsMSGBase) -> None: ...
+ def on_port_submitted(self: Self, event: pane.SettingsMSGBase) -> None: ...
+ def on_password_submitted(self: Self, event: pane.SettingsMSGBase) -> None: ...
+ def on_timeout_submitted(self: Self, event: pane.SettingsMSGBase) -> None: ...
def compose(self: Self) -> ComposeResult: ...
class OBSCTLPane(PaneBaseSubclass): ...