Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow selection after projection has been changed #2262

Merged
merged 3 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ v1.2.3 (unreleased)
* Remove bottleneck dependency as it is no longer maintained. Certain
array operations may be slower as a result. [#2258]

* Fixed a bug that caused selections to no longer work
in a scatter viewer once its projection had been changed. [#2262]

* Fixed a bug which prevented serialization for polar plots in degree
mode. [#2259]

Expand Down
9 changes: 9 additions & 0 deletions glue/viewers/common/qt/data_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@ def addToolBar(self, tb):
self._toolbars.append(tb)
self._tb_vis[tb] = True

def remove_toolbar(self, tb):
self._toolbars.remove(tb)
self._tb_vis.pop(tb, None)
super(DataViewer, self).removeToolBar(tb)

def remove_all_toolbars(self):
for tb in reversed(self._toolbars):
self.remove_toolbar(tb)

def initialize_toolbar(self):

from glue.config import viewer_tool
Expand Down
2 changes: 2 additions & 0 deletions glue/viewers/scatter/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ def _update_axes(self, *args):
def _update_projection(self, *args):
self.figure.delaxes(self.axes)
_, self.axes = init_mpl(self.figure, projection=self.state.plot_mode)
self.remove_all_toolbars()
self.initialize_toolbar()
for layer in self.layers:
layer._set_axes(self.axes)
layer.state.vector_mode = 'Cartesian'
Expand Down