Skip to content

Commit

Permalink
Introduced distinction between hiding and disabling gui.
Browse files Browse the repository at this point in the history
Running app with gui enabled will still allow for toggling gui visibility
Running app with gui disabled (--nogui) will not allow toggling gui visibility
  • Loading branch information
RealDanTheMan committed Jun 8, 2024
1 parent 9e72ba2 commit b534310
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
3 changes: 1 addition & 2 deletions pyrousel/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ def Run(settings: ApplicationSettings = ApplicationSettings()) -> None:
print(f'--Startup model: {settings.startup_model}')
print('\n')

app_window = AppWindow(settings.window_width, settings.window_height)
app_window = AppWindow(settings.window_width, settings.window_height, settings.enable_gui)
app_window.Init()
app_window.draw_gui = settings.enable_gui

if settings.startup_model is not None:
app_window.OnModelRequested(settings.startup_model)
Expand Down
17 changes: 10 additions & 7 deletions pyrousel/appwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from .camera import Camera

class AppWindow(object):
def __init__(self, width: int = 1280, height: int = 720):
def __init__(self, width: int = 1280, height: int = 720, enable_gui=True):
self.__width = width
self.__height = height
self.__aspec_ratio = self.__width / self.__height
Expand Down Expand Up @@ -42,12 +42,15 @@ def __init__(self, width: int = 1280, height: int = 720):
glfw.swap_interval(0)

# App user interface (IMGui)
self.gui = None
self.gui = AppGUI(self.__win)
self.gui.import_settings.ModelRequestSignal.connect(self.OnModelRequested)
self.gui.import_settings.ModelReloadSignal.connect(self.OnModelReloadRequested)
self.gui.camera_settings.CameraFocusRequested.connect(self.OnCameraFocusRequested)
self.draw_gui = True
if enable_gui:
self.gui = AppGUI(self.__win)
self.gui.import_settings.ModelRequestSignal.connect(self.OnModelRequested)
self.gui.import_settings.ModelReloadSignal.connect(self.OnModelReloadRequested)
self.gui.camera_settings.CameraFocusRequested.connect(self.OnCameraFocusRequested)
self.draw_gui = True
else:
self.gui = None
self.draw_gui = False

def Init(self) -> None:
"""Initialises OpenGL graphics renderer"""
Expand Down

0 comments on commit b534310

Please sign in to comment.