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

Provide an informational message if the user tries to instantiate an image from a catalog #582

Merged
merged 1 commit into from Mar 4, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 15 additions & 1 deletion glue/qt/widgets/image_widget.py
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