From db55ccc75b7d0444e70c1601b477b9cbfca44bba Mon Sep 17 00:00:00 2001 From: Ian List Date: Mon, 24 Nov 2025 11:10:53 +0100 Subject: [PATCH] added if clause in case darkdetect returns None --- labeler/automation/auto_labeler.py | 4 ++-- labeler/views/gui.py | 3 ++- setup.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/labeler/automation/auto_labeler.py b/labeler/automation/auto_labeler.py index c65046c..afee637 100644 --- a/labeler/automation/auto_labeler.py +++ b/labeler/automation/auto_labeler.py @@ -113,11 +113,11 @@ def _extract_as_straight_box(self, image: np.ndarray, coords: list[list[int]]) - src_points = np.array(coords, dtype="float32") # Determine the bounding box dimensions (width and height of the rectangle) - width = max( # type: ignore[call-overload] + width = max( np.linalg.norm(src_points[0] - src_points[1]), np.linalg.norm(src_points[2] - src_points[3]), ) - height = max( # type: ignore[call-overload] + height = max( np.linalg.norm(src_points[0] - src_points[3]), np.linalg.norm(src_points[1] - src_points[2]), ) diff --git a/labeler/views/gui.py b/labeler/views/gui.py index 25f2b2f..c4ba9ad 100644 --- a/labeler/views/gui.py +++ b/labeler/views/gui.py @@ -726,7 +726,8 @@ def discard_tight(self, event: tk.Event | None = None): pass def start_gui(self): # pragma: no cover - sv_ttk.set_theme(darkdetect.theme()) + if theme := darkdetect.theme(): + sv_ttk.set_theme(theme) if self.image_folder: self.load_directory() self.mainloop() diff --git a/setup.py b/setup.py index 3fd19b9..3a502a2 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup PKG_NAME = "doctr-labeler" -VERSION = os.getenv("BUILD_VERSION", "0.2.0a0") +VERSION = os.getenv("BUILD_VERSION", "0.2.1") if __name__ == "__main__":