From 2bdea3e9ae684c1645efa70fe247eb2178958312 Mon Sep 17 00:00:00 2001 From: Robert Haase Date: Mon, 18 Apr 2022 08:39:22 +0200 Subject: [PATCH] suppress warning --- napari_skimage_regionprops/_table.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/napari_skimage_regionprops/_table.py b/napari_skimage_regionprops/_table.py index 9fc1cc4..c00cf2d 100644 --- a/napari_skimage_regionprops/_table.py +++ b/napari_skimage_regionprops/_table.py @@ -211,11 +211,17 @@ def get_table(labels_layer: napari.layers.Layer, viewer:napari.Viewer) -> TableW Searches inside a viewer for a given table and returns it. If it cannot find it, it will return None. """ - for widget in list(viewer.window._dock_widgets.values()): - potential_table_widget = widget.widget() - if isinstance(potential_table_widget, TableWidget): - if potential_table_widget._layer is labels_layer: - return potential_table_widget + import warnings + # see: https://github.com/napari/napari/issues/3944 + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + + for widget in list(viewer.window._dock_widgets.values()): + potential_table_widget = widget.widget() + if isinstance(potential_table_widget, TableWidget): + if potential_table_widget._layer is labels_layer: + return potential_table_widget + return None def _determine_frame_column(table):