From bcee99ac99b223ce38a17d83d78fc57846c0f92d Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Wed, 2 Mar 2022 22:44:36 -0800 Subject: [PATCH] Added a test back --- .gitignore | 2 ++ glue/viewers/common/qt/data_slice_widget.py | 2 +- glue/viewers/image/qt/slice_widget.py | 3 ++- glue/viewers/profile/tests/test_state.py | 7 +++++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 4b94e7cf4..8d2772682 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,5 @@ glue/qt/glue_qt_resources.py .tox .vscode .history + +.qt_for_python/ diff --git a/glue/viewers/common/qt/data_slice_widget.py b/glue/viewers/common/qt/data_slice_widget.py index c0c2a23c7..add7f3999 100644 --- a/glue/viewers/common/qt/data_slice_widget.py +++ b/glue/viewers/common/qt/data_slice_widget.py @@ -27,7 +27,7 @@ def __init__(self, label='', world=None, lo=0, hi=10, parent=None, world_unit=None, world_warning=False): - super(SliceWidget, self).__init__(parent=parent) + super(SliceWidget, self).__init__(parent) self.state = SliceState() self.state.label = label diff --git a/glue/viewers/image/qt/slice_widget.py b/glue/viewers/image/qt/slice_widget.py index 0184b313b..8223cae7c 100644 --- a/glue/viewers/image/qt/slice_widget.py +++ b/glue/viewers/image/qt/slice_widget.py @@ -11,7 +11,7 @@ class MultiSliceWidgetHelper(object): - def __init__(self, viewer_state=None, layout=None, *args, **kwargs): + def __init__(self, *args, viewer_state=None, layout=None, **kwargs): self.viewer_state = viewer_state @@ -60,6 +60,7 @@ def sync_state_from_sliders(self, *args): @avoid_circular def sync_sliders_from_state(self, *args): + if self.data is None or self.viewer_state.x_att is None or self.viewer_state.y_att is None: return diff --git a/glue/viewers/profile/tests/test_state.py b/glue/viewers/profile/tests/test_state.py index 017951b6f..3d68a803e 100644 --- a/glue/viewers/profile/tests/test_state.py +++ b/glue/viewers/profile/tests/test_state.py @@ -44,6 +44,13 @@ def test_basic(self): assert_allclose(x, [0, 1, 2]) assert_allclose(y, [3.5, 11.5, 19.5]) + def test_basic_world(self): + self.viewer_state.x_att = self.data.world_component_ids[0] + x, y = self.layer_state.profile + assert_allclose(x, [0, 1, 2]) + assert_allclose(y, [3.5, 11.5, 19.5]) + + def test_x_att(self): self.viewer_state.x_att = self.data.pixel_component_ids[0]