mirror of
https://github.com/EyeTrackVR/EyeTrackVR.git
synced 2025-11-04 14:39:42 +08:00
feat: gui off WIP
This commit is contained in:
parent
9b9763b132
commit
932fc782cf
@ -117,18 +117,18 @@ class CameraWidget:
|
||||
|
||||
self.roi_layout = [
|
||||
[
|
||||
sg.Button(
|
||||
"Mark Out",
|
||||
key=self.gui_mask_markup,
|
||||
button_color="#6f4ca1",
|
||||
tooltip="Mark out stuff that is not your eye.",
|
||||
),
|
||||
sg.Button(
|
||||
"Lighten",
|
||||
key=self.gui_mask_lighten,
|
||||
button_color="#6f4ca1",
|
||||
tooltip="Lighten shadowed areas.",
|
||||
),
|
||||
# sg.Button(
|
||||
# "Mark Out",
|
||||
# key=self.gui_mask_markup,
|
||||
# button_color="#6f4ca1",
|
||||
# tooltip="Mark out stuff that is not your eye.",
|
||||
# ),
|
||||
# sg.Button(
|
||||
# "Lighten",
|
||||
# key=self.gui_mask_lighten,
|
||||
# button_color="#6f4ca1",
|
||||
# tooltip="Lighten shadowed areas.",
|
||||
# ),
|
||||
sg.Checkbox(
|
||||
"Camera Widget Padding",
|
||||
default=self.config.gui_rotation_ui_padding,
|
||||
@ -497,23 +497,23 @@ class CameraWidget:
|
||||
window[self.gui_tracking_fps].update(self._movavg_fps(self.camera.fps))
|
||||
window[self.gui_tracking_bps].update(self._movavg_bps(self.camera.bps))
|
||||
|
||||
if event == self.gui_mask_lighten:
|
||||
while True:
|
||||
try:
|
||||
maybe_image = self.roi_queue.get(block=False)
|
||||
imgbytes = cv2.imencode(".ppm", maybe_image[0])[1].tobytes()
|
||||
image = cv2.imdecode(
|
||||
np.frombuffer(imgbytes, np.uint8), cv2.IMREAD_COLOR
|
||||
)
|
||||
# if event == self.gui_mask_lighten:
|
||||
# while True:
|
||||
# try:
|
||||
# maybe_image = self.roi_queue.get(block=False)
|
||||
# imgbytes = cv2.imencode(".ppm", maybe_image[0])[1].tobytes()
|
||||
# image = cv2.imdecode(
|
||||
# np.frombuffer(imgbytes, np.uint8), cv2.IMREAD_COLOR
|
||||
# )
|
||||
|
||||
cv2.imshow("Image", image)
|
||||
cv2.waitKey(1)
|
||||
cv2.destroyAllWindows()
|
||||
print("lighen")
|
||||
except Empty:
|
||||
pass
|
||||
if event == self.gui_mask_markup:
|
||||
print("markup")
|
||||
# cv2.imshow("Image", image)
|
||||
# cv2.waitKey(1)
|
||||
# cv2.destroyAllWindows()
|
||||
# print("lighen")
|
||||
#except Empty:
|
||||
# pass
|
||||
# if event == self.gui_mask_markup:
|
||||
# print("markup")
|
||||
|
||||
if self.in_roi_mode:
|
||||
try:
|
||||
@ -686,6 +686,8 @@ class CameraWidget:
|
||||
pass
|
||||
|
||||
else:
|
||||
def back(*args):
|
||||
pass
|
||||
try:
|
||||
window[self.gui_roi_message].update(visible=False)
|
||||
window[self.gui_output_graph].update(visible=False)
|
||||
|
||||
@ -38,6 +38,9 @@ from settings.algo_settings_widget import AlgoSettingsWidget
|
||||
from osc.osc import OSCManager
|
||||
from osc.OSCMessage import OSCMessage
|
||||
from utils.misc_utils import is_nt, resource_path
|
||||
import time
|
||||
import cv2
|
||||
import numpy as np
|
||||
|
||||
if is_nt:
|
||||
from winotify import Notification
|
||||
@ -258,10 +261,38 @@ def main():
|
||||
background_color="#292929",
|
||||
)
|
||||
|
||||
while True:
|
||||
print('main loop')
|
||||
if config.settings.gui_disable_gui:
|
||||
timeout = 10 #TODO: test this on windows, on mac im not seeing a negitive side effect
|
||||
layout = [[sg.Button("Enable GUI")]]
|
||||
|
||||
# Create the window
|
||||
window = sg.Window("Simple Button", layout)
|
||||
|
||||
# Event loop to process events and get the values of the inputs
|
||||
while True:
|
||||
event, values = window.read()
|
||||
|
||||
# If user closes window or clicks the button, break the loop
|
||||
if event == sg.WINDOW_CLOSED:
|
||||
break
|
||||
elif event == "Enable GUI":
|
||||
print("Button clicked!")
|
||||
config.settings.gui_disable_gui = False
|
||||
config.save()
|
||||
break
|
||||
|
||||
# Close the window
|
||||
window.close()
|
||||
|
||||
else:
|
||||
timeout = 1
|
||||
# GUI Render loop
|
||||
while True:
|
||||
|
||||
# First off, check for any events from the GUI
|
||||
event, values = window.read(timeout=1) # this higher timeout saves some cpu usage
|
||||
event, values = window.read(timeout=timeout) # this higher timeout saves some cpu usage
|
||||
|
||||
# If we're in either mode and someone hits q, quit immediately
|
||||
if event == "Exit" or event == sg.WIN_CLOSED:
|
||||
@ -379,6 +410,7 @@ def main():
|
||||
window[ALGO_SETTINGS_NAME].update(visible=False)
|
||||
config.eye_display_id = EyeId.GUIOFF
|
||||
config.save()
|
||||
break
|
||||
|
||||
else:
|
||||
# Otherwise, render all
|
||||
|
||||
Loading…
Reference in New Issue
Block a user