From 01ac263197c7b01ad5d1baa5400d5b8e3b04b44c Mon Sep 17 00:00:00 2001 From: Mathieu Doucet <doucetm@ornl.gov> Date: Wed, 6 Jul 2011 15:48:52 +0000 Subject: [PATCH] Fixed data proxy for displaying instrument. Re #3311 --- .../reduction_gui/reduction/sans/eqsans_data_proxy.py | 8 ++++++-- .../Interface/reduction_gui/widgets/base_widget.py | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Code/Mantid/scripts/Interface/reduction_gui/reduction/sans/eqsans_data_proxy.py b/Code/Mantid/scripts/Interface/reduction_gui/reduction/sans/eqsans_data_proxy.py index 2a4ec50242e..b302fba1942 100755 --- a/Code/Mantid/scripts/Interface/reduction_gui/reduction/sans/eqsans_data_proxy.py +++ b/Code/Mantid/scripts/Interface/reduction_gui/reduction/sans/eqsans_data_proxy.py @@ -19,13 +19,17 @@ class DataProxy(object): def __init__(self, data_file, workspace_name=None): self.errors = [] if HAS_MANTID: - print "loading", data_file try: if workspace_name is None: self.data_ws = "__raw_data_file" else: self.data_ws = str(workspace_name) - LoadEventNexus(Filename=data_file, OutputWorkspace=workspace_name) + try: + LoadEventNexus(Filename=data_file, OutputWorkspace=workspace_name) + except: + self.errors.append("Error loading data file as Nexus event file:\n%s" % sys.exc_value) + LoadNexus(Filename=data_file, OutputWorkspace=workspace_name) + self.errors = [] except: self.data_ws = None self.errors.append("Error loading data file:\n%s" % sys.exc_value) diff --git a/Code/Mantid/scripts/Interface/reduction_gui/widgets/base_widget.py b/Code/Mantid/scripts/Interface/reduction_gui/widgets/base_widget.py index 17606b813fa..7f6af0ebd00 100644 --- a/Code/Mantid/scripts/Interface/reduction_gui/widgets/base_widget.py +++ b/Code/Mantid/scripts/Interface/reduction_gui/widgets/base_widget.py @@ -160,7 +160,7 @@ class BaseWidget(QtGui.QWidget): # Check that the file exists. if not os.path.exists(file_name): - QtGui.QMessageBox.warning(self.widgets[0], "File Not Found", "The supplied mask file can't be found on the file system") + QtGui.QMessageBox.warning(self, "File Not Found", "The supplied mask file can't be found on the file system") if self._data_proxy is not None: proxy = self._data_proxy(file_name, workspace) @@ -169,8 +169,8 @@ class BaseWidget(QtGui.QWidget): MaskDetectors(proxy.data_ws, DetectorList=mask) _show_ws_instrument(proxy.data_ws) else: - QtGui.QMessageBox.warning(self.widgets[0], "Mask Error", "Mantid doesn't know how to load this file") + QtGui.QMessageBox.warning(self, "Mask Error", "Mantid doesn't know how to load this file") else: - QtGui.QMessageBox.warning(self.widgets[0], "Mask Error", "Mantid doesn't know how to load this file") + QtGui.QMessageBox.warning(self, "Mask Error", "Mantid doesn't know how to load this file") -- GitLab