From aa0742dd9641df720cea4c9454e0db73886e4b3b Mon Sep 17 00:00:00 2001 From: Grzegorz Bokota Date: Mon, 15 Jul 2024 12:01:00 +0200 Subject: [PATCH 1/2] fix: add pint call to enforce initialization of unit registry --- package/PartSeg/common_backend/base_settings.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/PartSeg/common_backend/base_settings.py b/package/PartSeg/common_backend/base_settings.py index f5ad8283b..e2a85c90b 100644 --- a/package/PartSeg/common_backend/base_settings.py +++ b/package/PartSeg/common_backend/base_settings.py @@ -13,6 +13,7 @@ import napari.utils.theme import numpy as np +import pint from napari.qt import get_stylesheet from napari.utils import Colormap from napari.utils.theme import get_theme @@ -471,6 +472,7 @@ def __init__(self, json_path: Union[Path, str], profile_name: str = "default"): self.history_index = -1 self.last_executed_algorithm = "" self._points = None + pint.get_application_registry()("nm") def _image_changed(self): super()._image_changed() From 3e34b5d846a24b5b2f3d2ff66a8b854b292af0ee Mon Sep 17 00:00:00 2001 From: Grzegorz Bokota Date: Mon, 15 Jul 2024 12:20:13 +0200 Subject: [PATCH 2/2] add comment with explanation --- package/PartSeg/common_backend/base_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/PartSeg/common_backend/base_settings.py b/package/PartSeg/common_backend/base_settings.py index e2a85c90b..d0f2a866a 100644 --- a/package/PartSeg/common_backend/base_settings.py +++ b/package/PartSeg/common_backend/base_settings.py @@ -472,7 +472,7 @@ def __init__(self, json_path: Union[Path, str], profile_name: str = "default"): self.history_index = -1 self.last_executed_algorithm = "" self._points = None - pint.get_application_registry()("nm") + pint.get_application_registry()("nm") # enforce pint registry initialization def _image_changed(self): super()._image_changed()