Skip to content
Snippets Groups Projects
Unverified Commit 64a12f52 authored by Gemma Guest's avatar Gemma Guest Committed by GitHub
Browse files

Remove custom dialog for CreateSampleShape (#27010)

Remove custom dialog for CreateSampleShape
parents 3eb02a69 f45a25bf
No related branches found
No related tags found
No related merge requests found
......@@ -25,9 +25,12 @@ See :doc:`mantidworkbench`.
SliceViewer and Vates Simple Interface
--------------------------------------
:ref:`Release 4.2.0 <v4.2.0>`
Miscellaneous
-------------
- Error Reporter text entry and information made more user friendly.
\ No newline at end of file
- Error Reporter text entry and information made more user friendly.
- The custom dialog for :ref:`CreateSampleShape <algm-CreateSampleShape>`
has been removed. It will now fall back to the generic one.
:ref:`Release 4.2.0 <v4.2.0>`
set(SRC_FILES
src/CatalogPublishDialog.cpp
src/CreateSampleShapeDialog.cpp
src/ConvertTableToMatrixWorkspaceDialog.cpp
src/StartLiveDataDialog.cpp
src/FitDialog.cpp
src/LoadDialog.cpp
src/LoadDAEDialog.cpp
src/LoadRawDialog.cpp
src/LOQScriptInputDialog.cpp
src/MantidGLWidget.cpp
src/PeriodicTableWidget.cpp
src/PlotAsymmetryByLogValueDialog.cpp
src/SampleShapeHelpers.cpp
src/SmoothNeighboursDialog.cpp
src/SortTableWorkspaceDialog.cpp)
set(
SRC_FILES
src/CatalogPublishDialog.cpp
src/ConvertTableToMatrixWorkspaceDialog.cpp
src/StartLiveDataDialog.cpp
src/FitDialog.cpp
src/LoadDialog.cpp
src/LoadDAEDialog.cpp
src/LoadRawDialog.cpp
src/LOQScriptInputDialog.cpp
src/MantidGLWidget.cpp
src/PeriodicTableWidget.cpp
src/PlotAsymmetryByLogValueDialog.cpp
src/SampleShapeHelpers.cpp
src/SmoothNeighboursDialog.cpp
src/SortTableWorkspaceDialog.cpp
)
set(MOC_FILES
set(
MOC_FILES
inc/MantidQtWidgets/Plugins/AlgorithmDialogs/CatalogPublishDialog.h
inc/MantidQtWidgets/Plugins/AlgorithmDialogs/CreateSampleShapeDialog.h
inc/MantidQtWidgets/Plugins/AlgorithmDialogs/ConvertTableToMatrixWorkspaceDialog.h
inc/MantidQtWidgets/Plugins/AlgorithmDialogs/StartLiveDataDialog.h
inc/MantidQtWidgets/Plugins/AlgorithmDialogs/FitDialog.h
......@@ -30,15 +31,15 @@ set(MOC_FILES
inc/MantidQtWidgets/Plugins/AlgorithmDialogs/PlotAsymmetryByLogValueDialog.h
inc/MantidQtWidgets/Plugins/AlgorithmDialogs/SampleShapeHelpers.h
inc/MantidQtWidgets/Plugins/AlgorithmDialogs/SmoothNeighboursDialog.h
inc/MantidQtWidgets/Plugins/AlgorithmDialogs/SortTableWorkspaceDialog.h)
inc/MantidQtWidgets/Plugins/AlgorithmDialogs/SortTableWorkspaceDialog.h
)
# Include files aren't required, but this makes them appear in Visual Studio
set(INC_FILES
${MOC_FILES})
set(INC_FILES ${MOC_FILES})
set(UI_FILES
set(
UI_FILES
inc/MantidQtWidgets/Plugins/AlgorithmDialogs/CatalogPublishDialog.ui
inc/MantidQtWidgets/Plugins/AlgorithmDialogs/CreateSampleShapeDialog.ui
inc/MantidQtWidgets/Plugins/AlgorithmDialogs/ConvertTableToMatrixWorkspaceDialog.ui
inc/MantidQtWidgets/Plugins/AlgorithmDialogs/DiagScriptInputDialog.ui
inc/MantidQtWidgets/Plugins/AlgorithmDialogs/LOQScriptInputDialog.ui
......@@ -47,9 +48,13 @@ set(UI_FILES
inc/MantidQtWidgets/Plugins/AlgorithmDialogs/LoadDialog.ui
inc/MantidQtWidgets/Plugins/AlgorithmDialogs/StartLiveDataDialog.ui
inc/MantidQtWidgets/Plugins/AlgorithmDialogs/FitDialog.ui
inc/MantidQtWidgets/Plugins/AlgorithmDialogs/SortTableWorkspaceDialog.ui)
inc/MantidQtWidgets/Plugins/AlgorithmDialogs/SortTableWorkspaceDialog.ui
)
include_directories(inc inc/MantidQtWidgets/Plugins/AlgorithmDialogs)
include_directories(
inc
inc/MantidQtWidgets/Plugins/AlgorithmDialogs
)
mtd_add_qt_library(
TARGET_NAME MantidQtWidgetsPluginsAlgorithmDialogs
......@@ -57,11 +62,11 @@ mtd_add_qt_library(
SRC ${SRC_FILES}
MOC ${MOC_FILES}
NOMOC ${INC_FILES}
UI ${UI_FILES}
PRECOMPILED
UI
${UI_FILES}
PRECOMPILED
inc/MantidQtWidgets/Plugins/AlgorithmDialogs/PrecompiledHeader.h
SYSTEM_INCLUDE_DIRS
${Boost_INCLUDE_DIRS}
SYSTEM_INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
LINK_LIBS
${TCMALLOC_LIBRARIES_LINKTIME}
${CORE_MANTIDLIBS}
......@@ -69,16 +74,12 @@ mtd_add_qt_library(
${Boost_LIBRARIES}
${QT_LIBRARIES}
${OPENGL_LIBRARIES}
QT4_LINK_LIBS
Qt4::QtOpenGL
MTD_QT_LINK_LIBS
MantidQtWidgetsCommon
OSX_INSTALL_RPATH
@loader_path/../../Contents/MacOS
LINUX_INSTALL_RPATH
"\$ORIGIN/../../${LIB_DIR}"
INSTALL_DIR_BASE
${PLUGINS_DIR})
QT4_LINK_LIBS Qt4::QtOpenGL
MTD_QT_LINK_LIBS MantidQtWidgetsCommon
OSX_INSTALL_RPATH @loader_path/../../Contents/MacOS
LINUX_INSTALL_RPATH "\$ORIGIN/../../${LIB_DIR}"
INSTALL_DIR_BASE ${PLUGINS_DIR}
)
mtd_add_qt_library(
TARGET_NAME MantidQtWidgetsPluginsAlgorithmDialogs
......@@ -86,8 +87,9 @@ mtd_add_qt_library(
SRC ${SRC_FILES}
MOC ${MOC_FILES}
NOMOC ${INC_FILES}
UI ${UI_FILES}
PRECOMPILED
UI
${UI_FILES}
PRECOMPILED
inc/MantidQtWidgets/Plugins/AlgorithmDialogs/PrecompiledHeader.h
LINK_LIBS
${TCMALLOC_LIBRARIES_LINKTIME}
......@@ -96,13 +98,9 @@ mtd_add_qt_library(
${Boost_LIBRARIES}
${QT_LIBRARIES}
${OPENGL_LIBRARIES}
QT5_LINK_LIBS
Qt5::OpenGL
MTD_QT_LINK_LIBS
MantidQtWidgetsCommon
OSX_INSTALL_RPATH
@loader_path/../../Contents/MacOS
LINUX_INSTALL_RPATH
"\$ORIGIN/../../${LIB_DIR}"
INSTALL_DIR_BASE
${WORKBENCH_PLUGINS_DIR})
QT5_LINK_LIBS Qt5::OpenGL
MTD_QT_LINK_LIBS MantidQtWidgetsCommon
OSX_INSTALL_RPATH @loader_path/../../Contents/MacOS
LINUX_INSTALL_RPATH "\$ORIGIN/../../${LIB_DIR}"
INSTALL_DIR_BASE ${WORKBENCH_PLUGINS_DIR}
)
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright &copy; 2009 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#ifndef MANTIDQT_CUSTOMDIALOGS_CREATESAMPLESHAPEDIALOG_H_
#define MANTIDQT_CUSTOMDIALOGS_CREATESAMPLESHAPEDIALOG_H_
//---------------------------
// Includes
//--------------------------
#include "MantidQtWidgets/Common/AlgorithmDialog.h"
#include "ui_CreateSampleShapeDialog.h"
#include <QHash>
#include <QItemDelegate>
#include <QMap>
#include <QPoint>
#include <QTreeWidget>
#include <QVector>
//-----------------------------------
// Qt Forward declarations
//---------------------------------
class QCloseEvent;
namespace MantidQt {
namespace CustomDialogs {
class BinaryTreeWidget;
class BinaryTreeWidgetItem;
class ShapeDetails;
struct BaseInstantiator;
struct Operation;
class MantidGLWidget;
/**
This class gives specialised dialog for the sample shape definition
algorithm
@author Martyn Gigg, Tessella Support Services plc
@date 13/03/2009
*/
class CreateSampleShapeDialog : public MantidQt::API::AlgorithmDialog {
Q_OBJECT
public:
/// Default constructor
CreateSampleShapeDialog(QWidget *parent = nullptr);
/// Destructor
~CreateSampleShapeDialog() override;
private slots:
/// Context menu request
void handleTreeContextMenuRequest(const QPoint &pos);
/// Toggle the flag on
void toggleShapeComplement(bool state);
/// Add a new shape
void addShape(QAction *shape);
/// Add operation node based on menu action
void addOperation(QAction *shape);
/// Connects to the delete slot
void handleDeleteRequest();
/// Remove an item from the tree (recursive)
void removeItem(BinaryTreeWidgetItem *item);
/// Setup the details box based currently selected item
void setupDetailsBox();
/// Change item data
void changeTreeData(BinaryTreeWidgetItem *item, int data);
/// Update the object within the 3D widget
void update3DView();
private:
/// Initialize the layout
void initLayout() override;
/// Get the input out of the dialog
void parseInput() override;
/// Find the parent
BinaryTreeWidgetItem *getSelectedItem();
/// Create a details widget based upon the shape name given
ShapeDetails *createDetailsWidget(const QString &shapename) const;
/// Construct the XML from the current tree
QString constructShapeXML() const;
private:
/// The form generated with Qt Designer
Ui::CreateSampleShapeDialog m_uiForm;
/// A pointer to the model for the shape tree
BinaryTreeWidget *m_shapeTree;
/// A map of shape names to instantiator objects
QHash<QString, BaseInstantiator *> m_setup_map;
/// A map of QTreeWidgetItem objects to their details objects
QMap<BinaryTreeWidgetItem *, ShapeDetails *> m_details_map;
/// A map of QTreeWidgetItem objects to their operation objects
QMap<BinaryTreeWidgetItem *, Operation *> m_ops_map;
/// The 3D object viewer
MantidGLWidget *m_object_viewer;
};
/**
* A custom item to use in the BinaryTree widget
*/
class BinaryTreeWidgetItem : public QTreeWidgetItem {
public:
/// Default Constructor
BinaryTreeWidgetItem(int type = QTreeWidgetItem::UserType);
/// Constructor taking a string list and an optional type
BinaryTreeWidgetItem(const QStringList &strings,
int type = QTreeWidgetItem::UserType);
/// Add a child item
bool addChildItem(BinaryTreeWidgetItem *child);
/// A pointer to the left child
BinaryTreeWidgetItem *leftChild() const;
/// A pointer to the right child
BinaryTreeWidgetItem *rightChild() const;
private:
/// The index of the left child (0 or 1)
int m_left_index;
/// The index of the right child (0 or 1)
int m_right_index;
};
/**
* A widget to implement a binary tree display.
*/
class BinaryTreeWidget : public QTreeWidget {
Q_OBJECT
public:
/// Default constructor
BinaryTreeWidget(QWidget *parent = nullptr);
// Return the root of the binary tree
BinaryTreeWidgetItem *root() const;
/// Recurse through the tree in a post-order
void traverseInPostOrder(BinaryTreeWidgetItem *node,
QList<BinaryTreeWidgetItem *> &expression);
/// Called when the data in the model is changed
#if QT_VERSION < 0x050000
void dataChanged(const QModelIndex &topLeft,
const QModelIndex &bottomRight) override;
#else
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
const QVector<int> &roles = QVector<int>()) override;
#endif
signals:
/// Emitted when data has changed
void treeDataChange(BinaryTreeWidgetItem *item, int data);
};
/**
* A custom delegate class used for item editing
*/
class ComboBoxDelegate : public QItemDelegate {
Q_OBJECT
public:
/// Default constructor
ComboBoxDelegate(QWidget *parent = nullptr);
/// Create an editor for the item
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const override;
/// Set the data for the editor when it has been created
void setEditorData(QWidget *editor, const QModelIndex &index) const override;
/// Set the data for the model when editing has finished
void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const override;
/// Ensure that the editor has the correct geometry when it is created
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
const QModelIndex &index) const override;
};
} // namespace CustomDialogs
} // namespace MantidQt
#endif // MANTIDQT_CUSTOMDIALOGS_CREATESAMPLESHAPE_H_
<ui version="4.0" >
<class>CreateSampleShapeDialog</class>
<widget class="QDialog" name="CreateSampleShapeDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>796</width>
<height>354</height>
</rect>
</property>
<property name="windowTitle" >
<string>Sample Shape Definition</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<layout class="QHBoxLayout" name="horizontalLayout" >
<item>
<widget class="QGroupBox" name="shape_box" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" >
<string>Object Tree</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="details_box" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" >
<string>Details</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2" >
<item>
<widget class="QScrollArea" name="details_scroll" >
<property name="frameShape" >
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<property name="widgetResizable" >
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>232</width>
<height>258</height>
</rect>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="view_box" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" >
<string>3D View</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="bottomlayout" >
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>Workspace</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="wksp_opt" />
</item>
<item>
<spacer name="horizontalSpacer" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="helpButton" >
<property name="maximumSize" >
<size>
<width>25</width>
<height>16777215</height>
</size>
</property>
<property name="text" >
<string>?</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="createBtn" >
<property name="text" >
<string>Create Shape</string>
</property>
<property name="default" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelBtn" >
<property name="text" >
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>createBtn</sender>
<signal>clicked()</signal>
<receiver>CreateSampleShapeDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>741</x>
<y>379</y>
</hint>
<hint type="destinationlabel" >
<x>438</x>
<y>201</y>
</hint>
</hints>
</connection>
<connection>
<sender>cancelBtn</sender>
<signal>clicked()</signal>
<receiver>CreateSampleShapeDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>827</x>
<y>379</y>
</hint>
<hint type="destinationlabel" >
<x>438</x>
<y>201</y>
</hint>
</hints>
</connection>
</connections>
<designerdata>
<property name="gridDeltaX" >
<number>10</number>
</property>
<property name="gridDeltaY" >
<number>10</number>
</property>
<property name="gridSnapX" >
<bool>false</bool>
</property>
<property name="gridSnapY" >
<bool>false</bool>
</property>
<property name="gridVisible" >
<bool>true</bool>
</property>
</designerdata>
</ui>
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