From 2aea7c6140e857d2115ce473b3b3f5d4e732debb Mon Sep 17 00:00:00 2001 From: mscrnt Date: Sun, 1 Oct 2023 17:00:47 -0700 Subject: [PATCH 1/2] dummy-monitor-splash --- diambra/arena/utils/splash_screen.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/diambra/arena/utils/splash_screen.py b/diambra/arena/utils/splash_screen.py index a72492d2..77f46082 100644 --- a/diambra/arena/utils/splash_screen.py +++ b/diambra/arena/utils/splash_screen.py @@ -1,11 +1,23 @@ import os import tkinter as tk import screeninfo +from screeninfo.common import ScreenInfoError, Monitor + gif_file_path = os.path.join(os.path.dirname(__file__), ".splash_screen.gif") def get_monitor_from_coord(x, y): - monitors = screeninfo.get_monitors() + try: + monitors = screeninfo.get_monitors() + if not monitors: + raise ScreenInfoError("No monitors available") + except ScreenInfoError: + # Fallback to a dummy monitor if no monitors are available + width = 1024 + height = 768 + width_mm = 361 + height_mm = 203 + return Monitor(0, 0, width, height, width_mm, height_mm) for m in reversed(monitors): if m.x <= x <= m.width + m.x and m.y <= y <= m.height + m.y: From 3dd50533f33781a89e81d9f28417ca4a317649b6 Mon Sep 17 00:00:00 2001 From: mscrnt Date: Sun, 1 Oct 2023 17:07:24 -0700 Subject: [PATCH 2/2] Corrected Error Message --- diambra/arena/utils/splash_screen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diambra/arena/utils/splash_screen.py b/diambra/arena/utils/splash_screen.py index 77f46082..850e3433 100644 --- a/diambra/arena/utils/splash_screen.py +++ b/diambra/arena/utils/splash_screen.py @@ -10,7 +10,7 @@ def get_monitor_from_coord(x, y): try: monitors = screeninfo.get_monitors() if not monitors: - raise ScreenInfoError("No monitors available") + raise ScreenInfoError("No enumerators available") except ScreenInfoError: # Fallback to a dummy monitor if no monitors are available width = 1024