From 721fe746b31d5d0b3eb8ccc0323de665e8a3d1db Mon Sep 17 00:00:00 2001 From: Core447 Date: Sun, 14 Jan 2024 13:56:39 +0100 Subject: [PATCH] Avoid unnecessary reloading of key images --- actions/RecPlayPause/RecPlayPause.py | 4 ++++ actions/ToggleRecord/ToggleRecord.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/actions/RecPlayPause/RecPlayPause.py b/actions/RecPlayPause/RecPlayPause.py index 770b00c..aaceeeb 100644 --- a/actions/RecPlayPause/RecPlayPause.py +++ b/actions/RecPlayPause/RecPlayPause.py @@ -5,6 +5,7 @@ class RecPlayPause(OBSActionBase): ACTION_NAME = "Recording Play/Pause" CONTROLS_KEY_IMAGE = True def __init__(self, deck_controller, page, coords): + self.current_state = -1 super().__init__(deck_controller=deck_controller, page=page, coords=coords) def on_ready(self): @@ -38,6 +39,9 @@ class RecPlayPause(OBSActionBase): 2: Paused 3: Stopping in progress """ + if state == self.current_state: + return + self.current_state = state image = "record_inactive.png" if state == 1: self.set_bottom_label("Pause", font_size=16) diff --git a/actions/ToggleRecord/ToggleRecord.py b/actions/ToggleRecord/ToggleRecord.py index 0d9822d..1fac12f 100644 --- a/actions/ToggleRecord/ToggleRecord.py +++ b/actions/ToggleRecord/ToggleRecord.py @@ -6,6 +6,7 @@ class ToggleRecord(OBSActionBase): ACTION_NAME = "Toggle Record" CONTROLS_KEY_IMAGE = True def __init__(self, deck_controller, page, coords): + self.current_state = -1 super().__init__(deck_controller=deck_controller, page=page, coords=coords) def on_ready(self): @@ -38,6 +39,9 @@ class ToggleRecord(OBSActionBase): 2: Paused 3: Stopping in progress """ + if state == self.current_state: + return + self.current_state = state image = "record_inactive.png" if state == 0: self.set_bottom_label(None)