]> skyeroc.xyz Git - obs-ctl/commitdiff
Bug fix
authorsbkelley <sb24kelley@gmail.com>
Fri, 5 Dec 2025 23:00:54 +0000 (18:00 -0500)
committersbkelley <sb24kelley@gmail.com>
Fri, 5 Dec 2025 23:00:54 +0000 (18:00 -0500)
src/obs_ctl/interface/molecule/settings_block/pane.py
src/obs_ctl/interface/molecule/settings_block/settings_block.py

index b7909ac68842258ab92445aa8df02b0da65fd21f..2474125c438f6f5db4f2b484de0e4e274740441f 100644 (file)
@@ -18,9 +18,10 @@ class SettingsMSGBase(MSGBase):
         self.value = value
 
 class SettingsType(Enum):
-    STRING = (partial(Input, compact=True), str, Input.Submitted)
-    FLOAT = (partial(Input, compact=True), float, Input.Submitted)
-    INT = (partial(Input, compact=True), int, Input.Submitted)
+    """(widget_class, setting type, listener message, widget-expected type)"""
+    STRING = (partial(Input, compact=True), str, Input.Submitted, str)
+    FLOAT = (partial(Input, compact=True), float, Input.Submitted, str)
+    INT = (partial(Input, compact=True), int, Input.Submitted, str)
 
     @property
     def widget(self):
@@ -33,6 +34,10 @@ class SettingsType(Enum):
     @property
     def msg(self):
         return self.value[2]
+    
+    @property
+    def expected_type(self):
+        return self.value[3]
 
 
 def pane_factory(cls_name: str, settings_list: list, settings_type_list: list, defaults_list) -> TabPane:
@@ -58,7 +63,8 @@ def pane_factory(cls_name: str, settings_list: list, settings_type_list: list, d
     def watch_func_factory(watch_id: str):
         def watch_func(self, value):
             input = self.query_exactly_one(watch_id)
-            input.value = value
+            if type(input) is Input:
+                input.value = str(value)
         
         return watch_func
 
@@ -76,7 +82,7 @@ def pane_factory(cls_name: str, settings_list: list, settings_type_list: list, d
                     for setting, control_and_type, setting_default in zip(settings_list, settings_type_list, defaults_list):
                         ctrl_id = f"{settings_type.widget.func.__name__.lower()}_{setting}"
                         yield Label(setting)
-                        yield control_and_type.widget(value=setting_default, id=ctrl_id)
+                        yield control_and_type.widget(value=control_and_type.expected_type(setting_default), id=ctrl_id)
         
         return output_func
 
index d8ef9778a1b57ab1811b6b432d66ed43f12c5dbe..9077afd58edcf0c6dc977a915e5bc2d931ee3272 100644 (file)
@@ -14,12 +14,23 @@ OBSSettingsPane = pane.pane_factory(
     [""]
 )
 
+OBSWebSocketPane = pane.pane_factory(
+    "OBSWebSocketPane",
+    ["host", "port", "password", "timeout"],
+    [pane.SettingsType.STRING, pane.SettingsType.INT, pane.SettingsType.STRING, pane.SettingsType.FLOAT],
+    ["localhost", 4455, "", 1.0]
+)
+
+OBSCTLPane = pane.pane_factory(
+    "OBSCTLPane",
+    ["nothing"],
+    [pane.SettingsType.STRING],
+    ["zilch"]
+)
+
 class SettingsBlock(Container):
     def compose(self):
         with TabbedContent(classes="settings_block--tabbed-content"):
             yield OBSSettingsPane("OBS Settings", id="settings-content")
-            # yield pane.OBSSettings(id="settings-content", classes="settings_block--obs_settings")
-            with TabPane("OBS Connection", id="connection-tab"):
-                yield Placeholder("CONNECTION BLOCK", id="conection-plc")
-            with TabPane("obs-ctl Settings", id="clients-tab"):
-                yield Placeholder("CLIENT SETTINGS BLOCK", id="client-plc")
+            yield OBSWebSocketPane("OBS WebSocket", id="websocket-content")
+            yield OBSCTLPane("obs-ctl Settings", id="obs-ctl-content")