Skip to content

Commit

Permalink
Merge pull request #1471 from astrofrog/fix-update-viewers-numerical
Browse files Browse the repository at this point in the history
Fix updating of viewers when numerical values are changed
  • Loading branch information
astrofrog committed Nov 9, 2017
1 parent 7eac7f3 commit b2b6d33
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ v0.12.2 (unreleased)
v0.12.1 (2017-10-30)
--------------------

* Fix a bug that caused the 1D and 2D viewers to not update correctly
when the numerical values in data were changed. [#1471]

* Fix a bug that caused glue to crash when adding components to a dataset
after closing a viewer that had that data. [#1460, #1464]

Expand Down
2 changes: 1 addition & 1 deletion glue/viewers/common/qt/data_viewer_with_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def register_to_hub(self, hub):
filter=self._has_data_or_subset)

hub.subscribe(self, msg.NumericalDataChangedMessage,
handler=self._update_subset,
handler=self._update_data,
filter=self._has_data_or_subset)

hub.subscribe(self, msg.DataCollectionDeleteMessage,
Expand Down
12 changes: 12 additions & 0 deletions glue/viewers/matplotlib/qt/tests/test_data_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,3 +525,15 @@ def test_apply_roi_undo(self):

assert self.data.subsets[0].subset_state.lo == lo2
assert self.data.subsets[0].subset_state.hi == hi2

def test_numerical_data_changed(self):
self.init_draw_count()
self.init_subset()
assert self.draw_count == 0
self.viewer.add_data(self.data)
assert self.draw_count == 1
data = Data()
for cid in self.data.visible_components:
data.add_component(self.data[cid] * 2, cid.label)
self.data.update_values_from_data(data)
assert self.draw_count == 2

0 comments on commit b2b6d33

Please sign in to comment.