Avoid unnecessary reloading of key images

This commit is contained in:
Core447 2024-01-14 13:56:39 +01:00
parent 9f5ca70e10
commit 721fe746b3
No known key found for this signature in database
GPG Key ID: 5B97C0BD62F98516
2 changed files with 8 additions and 0 deletions

View File

@ -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)

View File

@ -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)