From cf3e3b061db2ef5ec310daedb59b42e33dfdc752 Mon Sep 17 00:00:00 2001 From: Dimitar Tasev <dimtasev@gmail.com> Date: Thu, 24 Jan 2019 11:09:29 +0000 Subject: [PATCH] Sort workspace now uses the algorithm, re #24547 --- qt/python/mantidqt/widgets/tableworkspacedisplay/model.py | 7 ++++--- .../mantidqt/widgets/tableworkspacedisplay/presenter.py | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/qt/python/mantidqt/widgets/tableworkspacedisplay/model.py b/qt/python/mantidqt/widgets/tableworkspacedisplay/model.py index 012b2a9ff1d..a24729795b5 100644 --- a/qt/python/mantidqt/widgets/tableworkspacedisplay/model.py +++ b/qt/python/mantidqt/widgets/tableworkspacedisplay/model.py @@ -107,7 +107,8 @@ class TableWorkspaceDisplayModel: def sort(self, column_index, sort_ascending): column_name = self.ws.getColumnNames()[column_index] if self.is_peaks_workspace(): - SortPeaksWorkspace(self.ws, ColumnNameToSortBy=column_name, SortAscending=sort_ascending) + SortPeaksWorkspace(InputWorkspace=self.ws, OutputWorkspace=self.ws, ColumnNameToSortBy=column_name, + SortAscending=sort_ascending) else: - SortTableWorkspace(InputWorkspace=self.ws, OutputWorkspace=self.ws, Columns=[column_name], - Ascending=[sort_ascending]) + SortTableWorkspace(InputWorkspace=self.ws, OutputWorkspace=self.ws, Columns=column_name, + Ascending=sort_ascending) diff --git a/qt/python/mantidqt/widgets/tableworkspacedisplay/presenter.py b/qt/python/mantidqt/widgets/tableworkspacedisplay/presenter.py index f580f36f5d6..f80689987ff 100644 --- a/qt/python/mantidqt/widgets/tableworkspacedisplay/presenter.py +++ b/qt/python/mantidqt/widgets/tableworkspacedisplay/presenter.py @@ -56,7 +56,7 @@ class TableWorkspaceDisplay(ObservingPresenter): """ self.model = model if model else TableWorkspaceDisplayModel(ws) - self.name = self.model.get_name() if name is None else name + self.name = name if name else self.model.get_name() self.view = view if view else TableWorkspaceDisplayView(self, parent, self.name) self.parent = parent self.plot = plot @@ -83,6 +83,9 @@ class TableWorkspaceDisplay(ObservingPresenter): def replace_workspace(self, workspace_name, workspace): if self.model.workspace_equals(workspace_name): self.model = TableWorkspaceDisplayModel(workspace) + # block signals to prevent triggering of handleItemChanged event + # which causes an infinite recursion and a stack overflow error + self.view.blockSignals(True) self.load_data(self.view) self.view.emit_repaint() -- GitLab