Skip to content

Commit

Permalink
Merge pull request #582 from astrofrog/info-scatter-image
Browse files Browse the repository at this point in the history
Provide an informational message if the user tries to instantiate an image from a catalog
  • Loading branch information
astrofrog committed Mar 4, 2015
2 parents 9bc6fb2 + 748f778 commit d425d84
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion glue/qt/widgets/image_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,22 @@ def add_data(self, data):
# need to delay callbacks, otherwise might
# try to set combo boxes to nonexisting items
with delay_callback(self.client, 'display_data', 'display_attribute'):

# If there is not already any image data set, we can't add 1-D
# datasets (tables/catalogs) to the image widget yet.
if data.data.ndim == 1 and self.client.display_data is None:
QMessageBox.information(self.window(), "Note",
"Cannot create image viewer from a 1-D "
"dataset. You will need to first "
"create an image viewer using data "
"with 2 or more dimensions, after "
"which you will be able to overlay 1-D "
"data as a scatter plot.",
buttons=QMessageBox.Ok)
return

r = self.client.add_layer(data)
if r is not None:
if r is not None and self.client.display_data is not None:
self.add_data_to_combo(data)
self.set_attribute_combo(self.client.display_data)

Expand Down

0 comments on commit d425d84

Please sign in to comment.