Skip to content

Commit

Permalink
Fix: Made intended behavior more clear to the user
Browse files Browse the repository at this point in the history
  • Loading branch information
SnuffSocket committed Oct 25, 2024
1 parent d956170 commit 2d26313
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
1 change: 1 addition & 0 deletions BabbleApp/Locale/English/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions BabbleApp/Locale/OwO/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions BabbleApp/Locale/Pirate Speak/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
27 changes: 21 additions & 6 deletions BabbleApp/babbleapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"""

import os
import time
import PySimpleGUI as sg
import queue
import requests
Expand Down Expand Up @@ -207,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]:
Expand All @@ -227,13 +228,15 @@ def main():

# Create the window
window = sg.Window(
f"{appversion}", layout, icon="Images/logo.ico", background_color=bg_color_clear
f"{appversion}", layout, icon="Images/logo.ico", background_color=bg_color_clear, finalize=True
)

fs = False
tint = 33
# 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):
Expand All @@ -259,10 +262,22 @@ def main():
)
return

# When focus is lost stop 'n slow down the loop here.
try:
if not window.TKroot.focus_get():
time.sleep(0.2)
# Check if the window has focus
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
wsize = window.size
window["-WINFOCUS-"].update(visible=True)
window["-WINFOCUS-"].unhide_row()
continue
except KeyError:
pass
Expand Down

0 comments on commit 2d26313

Please sign in to comment.