Skip to content
Snippets Groups Projects
Commit 3ac47317 authored by Peterson, Peter's avatar Peterson, Peter
Browse files

Fix right-click segfault in new workbench

The error appears to be solved in newer versions of sip / python-qt5,
but that isn't what is available on rhel7. This removes the ability to
have a different `MantidDisplayBase` from the workbench, but it doesn't
appear to be a necessary abstraction for now.
parent 8a5da1fc
No related branches found
No related tags found
No related merge requests found
...@@ -22,7 +22,6 @@ import functools ...@@ -22,7 +22,6 @@ import functools
# third-party library imports # third-party library imports
from mantid.api import AnalysisDataService, MatrixWorkspace, WorkspaceGroup from mantid.api import AnalysisDataService, MatrixWorkspace, WorkspaceGroup
from mantid.kernel import Logger from mantid.kernel import Logger
from mantidqt.widgets.workspacewidget.mantidtreemodel import MantidTreeModel
from mantidqt.widgets.workspacewidget.plotselectiondialog import get_plot_selection from mantidqt.widgets.workspacewidget.plotselectiondialog import get_plot_selection
from mantidqt.widgets.workspacewidget.workspacetreewidget import WorkspaceTreeWidget from mantidqt.widgets.workspacewidget.workspacetreewidget import WorkspaceTreeWidget
from qtpy.QtWidgets import QVBoxLayout from qtpy.QtWidgets import QVBoxLayout
...@@ -72,18 +71,17 @@ class WorkspaceWidget(PluginWidget): ...@@ -72,18 +71,17 @@ class WorkspaceWidget(PluginWidget):
super(WorkspaceWidget, self).__init__(parent) super(WorkspaceWidget, self).__init__(parent)
# layout # layout
workspacewidget = WorkspaceTreeWidget(MantidTreeModel()) self.workspacewidget = WorkspaceTreeWidget()
self.workspacewidget = workspacewidget
layout = QVBoxLayout() layout = QVBoxLayout()
layout.addWidget(self.workspacewidget) layout.addWidget(self.workspacewidget)
self.setLayout(layout) self.setLayout(layout)
# behaviour # behaviour
workspacewidget.plotSpectrumClicked.connect(functools.partial(self._do_plot_spectrum, self.workspacewidget.plotSpectrumClicked.connect(functools.partial(self._do_plot_spectrum,
errors=False)) errors=False))
workspacewidget.plotSpectrumWithErrorsClicked.connect(functools.partial(self._do_plot_spectrum, self.workspacewidget.plotSpectrumWithErrorsClicked.connect(functools.partial(self._do_plot_spectrum,
errors=True)) errors=True))
workspacewidget.plotColorfillClicked.connect(self._do_plot_colorfill) self.workspacewidget.plotColorfillClicked.connect(self._do_plot_colorfill)
# ----------------- Plugin API -------------------- # ----------------- Plugin API --------------------
......
...@@ -214,8 +214,7 @@ class WorkspaceTreeWidgetSimple : WorkspaceTreeWidget { ...@@ -214,8 +214,7 @@ class WorkspaceTreeWidgetSimple : WorkspaceTreeWidget {
#include "MantidQtWidgets/Common/WorkspacePresenter/WorkspaceTreeWidgetSimple.h" #include "MantidQtWidgets/Common/WorkspacePresenter/WorkspaceTreeWidgetSimple.h"
%End %End
public: public:
WorkspaceTreeWidgetSimple(MantidDisplayBase *mdb /Transfer/, WorkspaceTreeWidgetSimple(QWidget *parent /TransferThis/ = nullptr);
QWidget *parent /TransferThis/ = nullptr);
signals: signals:
void plotSpectrumClicked(const QStringList & workspaceName); void plotSpectrumClicked(const QStringList & workspaceName);
......
...@@ -50,9 +50,7 @@ class EXPORT_OPT_MANTIDQT_COMMON WorkspaceTreeWidgetSimple ...@@ -50,9 +50,7 @@ class EXPORT_OPT_MANTIDQT_COMMON WorkspaceTreeWidgetSimple
: public WorkspaceTreeWidget { : public WorkspaceTreeWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit WorkspaceTreeWidgetSimple( explicit WorkspaceTreeWidgetSimple(QWidget *parent = nullptr);
MantidQt::MantidWidgets::MantidDisplayBase *mdb,
QWidget *parent = nullptr);
~WorkspaceTreeWidgetSimple(); ~WorkspaceTreeWidgetSimple();
// Context Menu Handlers // Context Menu Handlers
......
#include "MantidQtWidgets/Common/WorkspacePresenter/WorkspaceTreeWidgetSimple.h" #include "MantidQtWidgets/Common/WorkspacePresenter/WorkspaceTreeWidgetSimple.h"
#include <MantidQtWidgets/Common/MantidTreeWidget.h> #include <MantidQtWidgets/Common/MantidTreeWidget.h>
#include <MantidQtWidgets/Common/MantidTreeWidgetItem.h> #include <MantidQtWidgets/Common/MantidTreeWidgetItem.h>
#include "MantidQtWidgets/Common/MantidTreeModel.h"
#include <MantidAPI/AlgorithmManager.h> #include <MantidAPI/AlgorithmManager.h>
#include <MantidAPI/FileProperty.h> #include <MantidAPI/FileProperty.h>
...@@ -17,9 +18,8 @@ using namespace Mantid::Kernel; ...@@ -17,9 +18,8 @@ using namespace Mantid::Kernel;
namespace MantidQt { namespace MantidQt {
namespace MantidWidgets { namespace MantidWidgets {
WorkspaceTreeWidgetSimple::WorkspaceTreeWidgetSimple(MantidDisplayBase *mdb, WorkspaceTreeWidgetSimple::WorkspaceTreeWidgetSimple(QWidget *parent)
QWidget *parent) : WorkspaceTreeWidget(new MantidTreeModel(), parent),
: WorkspaceTreeWidget(mdb, parent),
m_plotSpectrum(new QAction("spectrum...", this)), m_plotSpectrum(new QAction("spectrum...", this)),
m_plotSpectrumWithErrs(new QAction("spectrum with errors...", this)), m_plotSpectrumWithErrs(new QAction("spectrum with errors...", this)),
m_plotColorfill(new QAction("colorfill", this)) { m_plotColorfill(new QAction("colorfill", this)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment