From 226bf6e8dbc51a7c930feb6c6c2fb24bb28d1a95 Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Thu, 2 Apr 2020 15:18:55 +0100 Subject: [PATCH 1/2] Don't sync color and transparency of image layers by default --- CHANGES.md | 2 ++ glue/viewers/image/state.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index c0a77fe6d..ddad10f3a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,8 @@ Full changelog v0.16.0 (unreleased) -------------------- +* Don't sync color and transparency of image layers by default. [#2116] + * Python 2.7 and 3.5 are no longer supported. [#2075] * Fixed bugs in the profile viewer that occurred when using the profile viewer and diff --git a/glue/viewers/image/state.py b/glue/viewers/image/state.py index 3d082e2d9..2fe588794 100644 --- a/glue/viewers/image/state.py +++ b/glue/viewers/image/state.py @@ -493,9 +493,9 @@ class ImageLayerState(BaseImageLayerState): stretch = DDSCProperty(docstring='The stretch used to render the layer, ' 'which should be one of ``linear``, ' '``sqrt``, ``log``, or ``arcsinh``') - global_sync = DDCProperty(True, docstring='Whether the color and transparency ' - 'should be synced with the global ' - 'color and transparency for the data') + global_sync = DDCProperty(False, docstring='Whether the color and transparency ' + 'should be synced with the global ' + 'color and transparency for the data') def __init__(self, layer=None, viewer_state=None, **kwargs): From e17be55daf818a408e811b1fe7fe262f2041c3a0 Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Thu, 2 Apr 2020 17:47:25 +0100 Subject: [PATCH 2/2] Fix test that assumed global_sync was True --- glue/viewers/image/qt/tests/test_data_viewer.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/glue/viewers/image/qt/tests/test_data_viewer.py b/glue/viewers/image/qt/tests/test_data_viewer.py index f4d6d75b7..ed744f326 100644 --- a/glue/viewers/image/qt/tests/test_data_viewer.py +++ b/glue/viewers/image/qt/tests/test_data_viewer.py @@ -44,6 +44,19 @@ def init_data(self): def test_double_add_ignored(self): pass + def test_update_data_processed_if_data_present(self): + + # Patch for the main test of the same name - we need to explicilty set + # global_sync to True here for things to work correctly. + + self.init_draw_count() + self.data_collection.append(self.data) + self.viewer.add_data(self.data) + ct0 = self.draw_count + self.viewer.state.layers[0].global_sync = True + self.data.style.color = 'blue' + assert self.draw_count > ct0 + def test_slice_change_single_draw(self): # Regression test for a bug that caused Matplotlib to draw once per