mirror of
https://github.com/Project-Babble/ProjectBabble.git
synced 2026-11-21 09:31:16 -08:00
Merge pull request #52 from SnuffSocket/focus-branch
Feat: Lower CPU usage when not in focus
This commit is contained in:
5 files changed
+28
-2
No files matched your search
@@ -16,6 +16,7 @@
|
||||
"general.recalibrate": "Recalibrate Address",
|
||||
"general.recalibrateTooltip": "OSC address we use for recalibrating",
|
||||
"general.uvcCameraSettings": "UVC Camera Settings",
|
||||
"general.windowFocus": "Interface Paused",
|
||||
"general.useRedChannel": "Use Red Channel",
|
||||
"general.useRedChannelTooltip": "Uses only the red channel for Omnicept capture",
|
||||
"general.xResolution": "X Resolution",
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"general.recalibrate": "Wecawibwate Addwess :3",
|
||||
"general.recalibrateTooltip": "OSC addwess we use fow wecawibwating OwO",
|
||||
"general.uvcCameraSettings": "UVC Camewa Settings UwU",
|
||||
"general.windowFocus": "Intwaface Pawused",
|
||||
"general.useRedChannel": "Use Wed Channew >w<",
|
||||
"general.useRedChannelTooltip": "Uses onwy the wed channew fow Omnicept captuwe nya~",
|
||||
"general.xResolution": "X Wesowution :3",
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"general.recalibrate": "Recalibrate Yer Bearings",
|
||||
"general.recalibrateTooltip": "OSC bearings we use fer recalibratin'",
|
||||
"general.uvcCameraSettings": "Spyglass Settings",
|
||||
"general.windowFocus": "Interfayce Be Paused",
|
||||
"general.useRedChannel": "Use th' Red Channel",
|
||||
"general.useRedChannelTooltip": "Uses only th' red channel fer Omnicept plunderin'",
|
||||
"general.xResolution": "X Marks th' Spot",
|
||||
|
||||
@@ -134,7 +134,7 @@ class BabbleProcessor:
|
||||
self.image_queue_outgoing.put((image_stack, output_information))
|
||||
if self.image_queue_outgoing.qsize() > 1:
|
||||
self.image_queue_outgoing.get()
|
||||
|
||||
|
||||
self.previous_image = self.current_image
|
||||
self.previous_rotation = self.config.rotation_angle
|
||||
|
||||
|
||||
+24
-1
@@ -206,6 +206,8 @@ def main():
|
||||
background_color=bg_color_highlight,
|
||||
),
|
||||
],
|
||||
# Keep at bottom!
|
||||
[sg.Text(f'- - - {lang._instance.get_string("general.windowFocus")} - - -', key="-WINFOCUS-", background_color=bg_color_clear, text_color="#F0F0F0", justification="center", expand_x=True, visible=False)],
|
||||
]
|
||||
|
||||
if config.cam_display_id in [Tab.CAM]:
|
||||
@@ -229,10 +231,12 @@ def main():
|
||||
f"{appversion}", layout, icon="Images/logo.ico", background_color=bg_color_clear
|
||||
)
|
||||
|
||||
tint = 33
|
||||
fs = False
|
||||
# GUI Render loop
|
||||
while True:
|
||||
# First off, check for any events from the GUI
|
||||
event, values = window.read(timeout=30)
|
||||
event, values = window.read(timeout=tint)
|
||||
|
||||
# If we're in either mode and someone hits q, quit immediately
|
||||
if event in ("Exit", sg.WIN_CLOSED):
|
||||
@@ -258,6 +262,25 @@ def main():
|
||||
)
|
||||
return
|
||||
|
||||
try:
|
||||
# If window isn't in focus increase timeout and stop loop early
|
||||
if window.TKroot.focus_get():
|
||||
if fs:
|
||||
fs = False
|
||||
tint = 33
|
||||
window["-WINFOCUS-"].update(visible=False)
|
||||
window["-WINFOCUS-"].hide_row()
|
||||
window.refresh()
|
||||
else:
|
||||
if not fs:
|
||||
fs = True
|
||||
tint = 100
|
||||
window["-WINFOCUS-"].update(visible=True)
|
||||
window["-WINFOCUS-"].unhide_row()
|
||||
continue
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
if values[CAM_RADIO_NAME] and config.cam_display_id != Tab.CAM:
|
||||
cams[0].start()
|
||||
settings[0].stop()
|
||||
|
||||
Reference in new issue
Block a user