Skip to content

Commit

Permalink
Open new viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Jul 23, 2018
1 parent f424ab1 commit 325d003
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
18 changes: 16 additions & 2 deletions glue/plugins/tools/pv_slicer/qt/pv_slicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from glue.viewers.common.qt.toolbar_mode import PathMode
from glue.config import viewer_tool
from glue.viewers.common.qt.toolbar_mode import ToolbarModeBase
from glue.viewers.image.qt import ImageViewer


class PVSliceData(Data):
Expand Down Expand Up @@ -75,12 +76,25 @@ def _extract_callback(self, mode):

selected = self.viewer.session.application.selected_layers()

print(selected)

if len(selected) == 1 and isinstance(selected[0], PVSliceData):
selected[0].update_values_from_data(data)
data = selected[0]
for tab in self.viewer.session.application.viewers:
for viewer in tab:
if data in viewer._layer_artist_container:
open_viewer = False
break
if not open_viewer:
break
else:
open_viewer = True
else:
self.viewer.session.data_collection.append(data)
open_viewer = True

print("OPEN VIEWER", open_viewer)
if open_viewer:
self.viewer.session.application.new_data_viewer(ImageViewer, data=data)


@viewer_tool
Expand Down
1 change: 0 additions & 1 deletion glue/viewers/image/qt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
from .data_viewer import ImageViewer # noqa
from .standalone_image_viewer import StandaloneImageViewer # noqa

0 comments on commit 325d003

Please sign in to comment.