system/ui: Fix crash when exiting the application with CTRL+C (KeyboardInterrupt). (#35221)

handle KeyboardInterrupt
pull/35225/head
Dean Lee 1 week ago committed by GitHub
parent 64b0ede9ae
commit f1c0109c89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 19
      system/ui/lib/application.py

@ -131,17 +131,20 @@ class GuiApplication:
rl.close_window() rl.close_window()
def render(self): def render(self):
while not (self._window_close_requested or rl.window_should_close()): try:
rl.begin_drawing() while not (self._window_close_requested or rl.window_should_close()):
rl.clear_background(rl.BLACK) rl.begin_drawing()
rl.clear_background(rl.BLACK)
yield yield
if DEBUG_FPS: if DEBUG_FPS:
rl.draw_fps(10, 10) rl.draw_fps(10, 10)
rl.end_drawing() rl.end_drawing()
self._monitor_fps() self._monitor_fps()
except KeyboardInterrupt:
pass
def font(self, font_weight: FontWeight=FontWeight.NORMAL): def font(self, font_weight: FontWeight=FontWeight.NORMAL):
return self._fonts[font_weight] return self._fonts[font_weight]

Loading…
Cancel
Save