diff --git a/Code/Mantid/MantidPlot/pymantidplot/proxies.py b/Code/Mantid/MantidPlot/pymantidplot/proxies.py index 052bb7f3bca2a37af9ba17fa10687b5e31c65a7d..90099772f1d850181a11b100b733da15ba0c14a3 100644 --- a/Code/Mantid/MantidPlot/pymantidplot/proxies.py +++ b/Code/Mantid/MantidPlot/pymantidplot/proxies.py @@ -8,6 +8,7 @@ from PyQt4 import QtCore, QtGui from PyQt4.QtCore import Qt, pyqtSlot import __builtin__ import mantid +import mantidqtpython #----------------------------------------------------------------------------- #--------------------------- MultiThreaded Access ---------------------------- @@ -906,3 +907,27 @@ class TiledWindowProxy(QtProxyObject): Clear the content this TiledWindow. """ threadsafe_call(self._getHeldObject().clear) + +def showHelpPage(page_name=None): + """Show a page in the help system""" + window = threadsafe_call(mantidqtpython.MantidQt.API.InterfaceManager().showHelpPage, page_name) + +def showWikiPage(page_name=None): + """Show a wiki page through the help system""" + window = threadsafe_call(mantidqtpython.MantidQt.API.InterfaceManager().showWikiPage, page_name) + +def showAlgorithmHelp(algorithm=None, version=-1): + """Show an algorithm help page""" + window = threadsafe_call(mantidqtpython.MantidQt.API.InterfaceManager().showAlgorithmHelp, algorithm, version) + +def showConceptHelp(name=None): + """Show a concept help page""" + window = threadsafe_call(mantidqtpython.MantidQt.API.InterfaceManager().showConceptHelp, name) + +def showFitFunctionHelp(name=None): + """Show a fit function help page""" + window = threadsafe_call(mantidqtpython.MantidQt.API.InterfaceManager().showFitFunctionHelp, name) + +def showCustomInterfaceHelp(name=None): + """Show a custom interface help page""" + window = threadsafe_call(mantidqtpython.MantidQt.API.InterfaceManager().showCustomInterfaceHelp, name) diff --git a/Code/Mantid/MantidQt/API/inc/MantidQtAPI/InterfaceManager.h b/Code/Mantid/MantidQt/API/inc/MantidQtAPI/InterfaceManager.h index d864c1f1fa6125a9437835c71ef99dbbf0da18f6..b86e753ec4f83b4bae4526373638601f4416e2af 100644 --- a/Code/Mantid/MantidQt/API/inc/MantidQtAPI/InterfaceManager.h +++ b/Code/Mantid/MantidQt/API/inc/MantidQtAPI/InterfaceManager.h @@ -109,6 +109,26 @@ public: * @return the help window */ MantidHelpInterface *createHelpWindow() const; + + /// @param url Relative URL of help page to show. + void showHelpPage(const QString &url = QString()); + + /// @param page Wiki page to show help for + void showWikiPage(const QString &page = QString()); + + /// @param name of algorithm to show help for + /// @param version of algorithm + void showAlgorithmHelp(const QString &name, const int version = -1); + + /// @param name of concept to show help for + void showConceptHelp(const QString &name); + + /// @param name of fit function to show help for + void showFitFunctionHelp(const QString &name = QString()); + + /// @param name of interface to show help for + void showCustomInterfaceHelp(const QString &name); + /** * Registration function for the help window factory. * @param factory the factory instance diff --git a/Code/Mantid/MantidQt/API/inc/MantidQtAPI/MantidHelpInterface.h b/Code/Mantid/MantidQt/API/inc/MantidQtAPI/MantidHelpInterface.h index e5d69ed02069b90e86f4d996f0c3490b6bb6612e..c7f4da234a5eff40811453664345256d584c6635 100644 --- a/Code/Mantid/MantidQt/API/inc/MantidQtAPI/MantidHelpInterface.h +++ b/Code/Mantid/MantidQt/API/inc/MantidQtAPI/MantidHelpInterface.h @@ -51,11 +51,13 @@ public: virtual void showPage(const QString & url); virtual void showPage(const QUrl & url); virtual void showWikiPage(const std::string &page=std::string()); + virtual void showWikiPage(const QString &page); virtual void showAlgorithm(const std::string &name=std::string(), const int version=-1); virtual void showAlgorithm(const QString &name, const int version=-1); virtual void showConcept(const std::string &name); virtual void showConcept(const QString &name); virtual void showFitFunction(const std::string &name=std::string()); + virtual void showFitFunction(const QString &name); virtual void showCustomInterface(const std::string &name); virtual void showCustomInterface(const QString &name); diff --git a/Code/Mantid/MantidQt/API/src/InterfaceManager.cpp b/Code/Mantid/MantidQt/API/src/InterfaceManager.cpp index 45047ac64bcb84ad1cbbedf8c648d30ea8012b88..9bba267c27daf9362ab6344cc4508745b45ec889 100644 --- a/Code/Mantid/MantidQt/API/src/InterfaceManager.cpp +++ b/Code/Mantid/MantidQt/API/src/InterfaceManager.cpp @@ -245,3 +245,34 @@ MantidHelpInterface *InterfaceManager::createHelpWindow() const return interface; } } + +void InterfaceManager::showHelpPage(const QString &url) { + auto window = createHelpWindow(); + window->showPage(url); +} + +void InterfaceManager::showWikiPage(const QString &page) { + auto window = createHelpWindow(); + window->showWikiPage(page); +} + +void InterfaceManager::showAlgorithmHelp(const QString &name, + const int version) { + auto window = createHelpWindow(); + window->showAlgorithm(name, version); +} + +void InterfaceManager::showConceptHelp(const QString &name) { + auto window = createHelpWindow(); + window->showConcept(name); +} + +void InterfaceManager::showFitFunctionHelp(const QString &name) { + auto window = createHelpWindow(); + window->showFitFunction(name); +} + +void InterfaceManager::showCustomInterfaceHelp(const QString &name) { + auto window = createHelpWindow(); + window->showCustomInterface(name); +} diff --git a/Code/Mantid/MantidQt/API/src/MantidHelpInterface.cpp b/Code/Mantid/MantidQt/API/src/MantidHelpInterface.cpp index 52fafb2673819e96a4ea6e05c16b4a6d8e761828..c5d67b0569f1ded10fa2a60a33e6df3da56d4325 100644 --- a/Code/Mantid/MantidQt/API/src/MantidHelpInterface.cpp +++ b/Code/Mantid/MantidQt/API/src/MantidHelpInterface.cpp @@ -31,6 +31,11 @@ void MantidHelpInterface::showWikiPage(const std::string &page) UNUSED_ARG(page); } +void MantidHelpInterface::showWikiPage(const QString &page) +{ + UNUSED_ARG(page); +} + void MantidHelpInterface::showConcept(const std::string &page) { UNUSED_ARG(page); @@ -57,6 +62,11 @@ void MantidHelpInterface::showFitFunction(const std::string &name) UNUSED_ARG(name); } +void MantidHelpInterface::showFitFunction(const QString &name) +{ + UNUSED_ARG(name); +} + void MantidHelpInterface::showCustomInterface(const std::string &name) { UNUSED_ARG(name); diff --git a/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/MantidHelpWindow.h b/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/MantidHelpWindow.h index 3bbe46a13a368687ff38532910bf108817f3f179..d3a6921200e0b0f60a9df260e97393d486248a5c 100644 --- a/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/MantidHelpWindow.h +++ b/Code/Mantid/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/MantidHelpWindow.h @@ -29,11 +29,13 @@ public: virtual void showPage(const QString & url); virtual void showPage(const QUrl & url); virtual void showWikiPage(const std::string &page=std::string()); + virtual void showWikiPage(const QString &page); virtual void showAlgorithm(const std::string &name=std::string(), const int version=-1); virtual void showAlgorithm(const QString &name, const int version=-1); virtual void showConcept(const std::string &name); virtual void showConcept(const QString &name); virtual void showFitFunction(const std::string &name=std::string()); + virtual void showFitFunction(const QString &name); virtual void showCustomInterface(const std::string &name=std::string()); virtual void showCustomInterface(const QString &name); diff --git a/Code/Mantid/MantidQt/MantidWidgets/src/MantidHelpWindow.cpp b/Code/Mantid/MantidQt/MantidWidgets/src/MantidHelpWindow.cpp index 02e286257fa05460a5cf792325d5481168e76746..110d04a7ce3b306156982e09c7d770337e3c11f1 100644 --- a/Code/Mantid/MantidQt/MantidWidgets/src/MantidHelpWindow.cpp +++ b/Code/Mantid/MantidQt/MantidWidgets/src/MantidHelpWindow.cpp @@ -187,6 +187,17 @@ void MantidHelpWindow::showWikiPage(const string &page) this->openWebpage(WIKI_BASE_URL + page.c_str()); } +/** + * Convenience method for HelpWindowImpl::showWikiPage(const string &). + * + * @param page The name of the wiki page to show. If this is empty show + * the wiki homepage. + */ +void MantidHelpWindow::showWikiPage(const QString &page) +{ + this->showWikiPage(page.toStdString()); +} + /** * Show the help page for a particular algorithm. The page is picked * using matching naming conventions. @@ -215,7 +226,7 @@ void MantidHelpWindow::showAlgorithm(const string &name, const int version) else // qt-assistant disabled { if (name.empty()) - this->showWikiPage("Category:Algorithms"); + this->showWikiPage(std::string("Category:Algorithms")); else this->showWikiPage(name); } @@ -236,7 +247,7 @@ void MantidHelpWindow::showAlgorithm(const QString &name, const int version) /** - * Show the help page for a particular concept. + * Show the help page for a particular concept. * * @param name The name of the concept to show. If this is empty show * the concept index. @@ -256,7 +267,7 @@ void MantidHelpWindow::showConcept(const string &name) else // qt-assistant disabled { if (name.empty()) - this->showWikiPage("Category:Concepts"); + this->showWikiPage(std::string("Category:Concepts")); else this->showWikiPage(name); } @@ -264,7 +275,7 @@ void MantidHelpWindow::showConcept(const string &name) /** - * Show the help page for a particular concept. + * Show the help page for a particular concept. * * @param name The name of the concept to show. If this is empty show * the concept index. @@ -297,12 +308,24 @@ void MantidHelpWindow::showFitFunction(const std::string &name) else // qt-assistant disabled { if (name.empty()) - this->showWikiPage("Category:Fit_functions"); + this->showWikiPage(std::string("Category:Fit_functions")); else this->showWikiPage(name); } } +/** + * Show the help page for a particular fit function. The page is + * picked using matching naming conventions. + * + * @param name The name of the fit function to show. If it is empty show + * the fit function index. + */ +void MantidHelpWindow::showFitFunction(const QString &name) +{ + this->showFitFunction(name.toStdString()); +} + /** * Show the help page for a given custom interface. * @@ -355,7 +378,7 @@ void MantidHelpWindow::findCollectionFile(std::string &binDir) m_collectionFile = ""; QDir searchDir(QString::fromStdString(binDir)); - + // try next to the executable QString path = searchDir.absoluteFilePath(COLLECTION_FILE); g_log.debug() << "Trying \"" << path.toStdString() << "\"\n"; diff --git a/Code/Mantid/MantidQt/Python/mantidqt.in.sip b/Code/Mantid/MantidQt/Python/mantidqt.in.sip deleted file mode 100644 index b44a820a5b2bae5434bf747f1ebccc3736fa16e4..0000000000000000000000000000000000000000 --- a/Code/Mantid/MantidQt/Python/mantidqt.in.sip +++ /dev/null @@ -1,418 +0,0 @@ -/***************************************************************************/ -/** - This file is a SIP file for binding C++ methods of the - MantidQt widgets (SliceViewer and RefDetectorViewer in particular) - to Python. - -*/ -/***************************************************************************/ - -// Define the module name. This has to match the library filename -%Module mantidqtpython - -/******************************** SIP Imports ****************/ -%Import QtCore/QtCoremod.sip -%Import QtGui/QtGuimod.sip -%Include qwttypes.sip - -/***************************************************************************/ -/**************** Exceptions ***********************************************/ -/***************************************************************************/ -%Exception std::exception(SIP_Exception) /PyName=StdException/ -{ -%TypeHeaderCode -#include <stdexcept> -%End -%RaiseCode - const char *detail = sipExceptionRef.what(); - - SIP_BLOCK_THREADS - PyErr_SetString(sipException_std_exception, detail); - SIP_UNBLOCK_THREADS -%End -}; - -%Exception std::invalid_argument(SIP_Exception) /PyName=StdInvalidArgument/ -{ -%TypeHeaderCode -#include <stdexcept> -%End -%RaiseCode - const char *detail = sipExceptionRef.what(); - - SIP_BLOCK_THREADS - PyErr_SetString(sipException_std_invalid_argument, detail); - SIP_UNBLOCK_THREADS -%End -}; - -%Exception std::runtime_error(SIP_Exception) /PyName=StdRuntimeError/ -{ -%TypeHeaderCode -#include <stdexcept> -%End -%RaiseCode - const char *detail = sipExceptionRef.what(); - - SIP_BLOCK_THREADS - PyErr_SetString(sipException_std_runtime_error, detail); - SIP_UNBLOCK_THREADS -%End -}; - - -namespace Mantid -{ -namespace API -{ - - -enum MDNormalization -{ -//%TypeHeaderCode -//#include "../Framework/API/inc/MantidAPI/IMDWorkspace.h" -//%End - NoNormalization, - VolumeNormalization, - NumEventsNormalization -}; - -}; // end namespace -}; // end namespace - - -namespace MantidQt -{ -namespace SliceViewer -{ - -//*WIKI* == Classes == -//*WIKI* Here follows a list of the classes exposed to python and the methods you can execute on them. - - -/***************************************************************************/ -/***************************************************************************/ -/***************************************************************************/ -class SliceViewerWindow : QMainWindow -{ -%TypeHeaderCode -#include "SliceViewer/inc/MantidQtSliceViewer/SliceViewerWindow.h" -%End -%Docstring - -SliceViewerWindow -================= - - The SliceViewerWindow is a window containing a SliceViewer widget - and a LineViewer Widget. - - It allows you to look at 2D slices in a workspace such as a - MDEventWorkspace or a MDHistoWorkspace, and then perform 1D line - sections. - - You can access the two contained widgets using: - getSlicer() (for the SliceViewer) - getLiner() (for the LineViewer) - - However, the methods of the SliceViewer are exposed to the - SliceViewerWindow, so you do not need to get the SliceViewer - widget directly; you can call the methods on the SliceViewerWindow - directly. For example: - - svw.setSlicePoint(2, 10.5) - - See the methods for SliceViewer, below. - -%End - -public: - SliceViewerWindow(const QString& wsName, const QString& label, Qt::WFlags f); - MantidQt::SliceViewer::SliceViewer* getSlicer(); - MantidQt::SliceViewer::LineViewer* getLiner(); - const QString& getLabel() const; - -}; - - - - -/***************************************************************************/ -/***************************************************************************/ -/***************************************************************************/ -class LineViewer : QWidget -{ -%TypeHeaderCode -#include "SliceViewer/inc/MantidQtSliceViewer/LineViewer.h" -%End - -%Docstring - -LineViewer -========== - - The LineViewer is a widget to select 1D line sections out of - a workspace such as the MDEventWorkspace or a MDHistoWorkspace. - - It is connected to the SliceViewer. - -%End - -public: - -void apply() throw (std::runtime_error); -void showPreview(); -void showFull(); - -//*WIKI* ==== Start/End Points ==== -void setStartXY(double x, double y) throw (std::runtime_error); -void setEndXY(double x, double y) throw (std::runtime_error); - -//*WIKI* ==== Width ==== -void setThickness(double width); -void setThickness(int dim, double width) throw (std::invalid_argument, std::runtime_error); -void setThickness(const QString & dim, double width) throw (std::invalid_argument, std::runtime_error); -void setPlanarWidth(double width); -double getPlanarWidth() const; - -//*WIKI* ==== Binning ==== -void setNumBins(int numBins) throw (std::invalid_argument); -void setFixedBinWidthMode(bool fixedWidth, double binWidth) throw (std::invalid_argument); -double getFixedBinWidth() const; -bool getFixedBinWidthMode() const; -int getNumBins() const; -double getBinWidth() const; - -////*WIKI* ==== Plotting ==== -void setPlotAxis(int choice); -int getPlotAxis() const; - -}; - - -/***************************************************************************/ -/***************************************************************************/ -/***************************************************************************/ -class SliceViewer : QWidget -{ -%TypeHeaderCode -#include "SliceViewer/inc/MantidQtSliceViewer/SliceViewer.h" -%End - -%Docstring - -SliceViewer -=========== - - The SliceViewer is a widget showing a 2D slice of a multi-dimensional - workspace such as the MDEventWorkspace or a MDHistoWorkspace. - -%End - -public: - //*WIKI* ==== Basics ==== - void setWorkspace(const QString & wsName) throw (std::runtime_error); - QString getWorkspaceName() const; - void showControls(bool visible); - void openFromXML(const QString & xml) throw (std::invalid_argument, std::runtime_error); - QPixmap getImage(); - void saveImage(const QString & filename); - void copyImageToClipboard(); - void setFastRender(bool fast); - bool getFastRender() const; - void toggleLineMode(bool lineMode); - - //*WIKI* ==== X/Y Dimension ==== - void setXYDim(int indexX, int indexY) throw (std::invalid_argument); - void setXYDim(const QString & dimX, const QString & dimY) throw (std::invalid_argument, std::runtime_error); - int getDimX() const; - int getDimY() const; - - //*WIKI* ==== Slice Point ==== - void setSlicePoint(int dim, double value) throw (std::invalid_argument); - void setSlicePoint(const QString & dim, double value) throw (std::invalid_argument, std::runtime_error); - double getSlicePoint(int dim) const throw (std::invalid_argument); - double getSlicePoint(const QString & dim) const throw (std::invalid_argument, std::runtime_error); - - //*WIKI* ==== View Limits ==== - void setXYLimits(double xleft, double xright, double ybottom, double ytop); - QwtDoubleInterval getXLimits() const; - QwtDoubleInterval getYLimits() const; - void zoomBy(double factor); - void setXYCenter(double x, double y); - void resetZoom(); - - //*WIKI* ==== Color Map and Scale ==== - void loadColorMap(QString filename); - void setColorScale(double min, double max, bool log) throw (std::invalid_argument); - void setColorScaleMin(double min) throw (std::invalid_argument); - void setColorScaleMax(double max) throw (std::invalid_argument); - void setColorScaleLog(bool log); - double getColorScaleMin() const; - double getColorScaleMax() const; - bool getColorScaleLog() const; - void setColorScaleAutoFull(); - void setColorScaleAutoSlice() ; - void setColorMapBackground(int r, int g, int b); - void setTransparentZeros(bool transparent); - void setNormalization(Mantid::API::MDNormalization norm); - Mantid::API::MDNormalization getNormalization() const; - - //*WIKI* ==== Dynamic Rebinning ==== - void setRebinThickness(int dim, double thickness) throw (std::runtime_error); - void setRebinNumBins(int xBins, int yBins) throw (std::runtime_error); - void setRebinMode(bool mode, bool locked) throw (std::runtime_error); - void refreshRebin() throw (std::runtime_error); -}; - - -}; // end namespace -}; // end namespace - - - - - - - - -namespace MantidQt -{ -namespace Factory -{ - -/***************************************************************************/ -/***************************************************************************/ -/***************************************************************************/ -class WidgetFactory -{ -%TypeHeaderCode -#include "Factory/inc/MantidQtFactory/WidgetFactory.h" -#include <QVector> -%End - -%Docstring -WidgetFactory -============= - - The WidgetFactory is a class to create custom widgets. - It currently supports creating SliceViewerWindows using: - WidgetFactory.Instance().createSliceViewerWindow() - - You can also retrieve a previously-created window with: - WidgetFactory.Instance().getSliceViewerWindow() - This applies to windows created by Python or via the GUI. - -%End - - -public: - static MantidQt::Factory::WidgetFactory* Instance(); - MantidQt::SliceViewer::SliceViewerWindow* createSliceViewerWindow(const QString& wsName, const QString& label); - MantidQt::SliceViewer::SliceViewerWindow* getSliceViewerWindow(const QString& wsName, const QString& label) throw (std::runtime_error); - void closeAllSliceViewerWindows(); - - MantidQt::SliceViewer::SliceViewer* createSliceViewer(const QString& wsName); - -private: - WidgetFactory(); -}; - -}; // end namespace -}; // end namespace - - - -/**************************************************************************** -/*** RefDetectorViewer ****************************************************** -/**************************************************************************** -namespace MantidQt -{ -namespace RefDetectorViewer -{ - -//*WIKI* == Classes == -//*WIKI* Here follows a list of the classes exposed to python and the methods you can execute on them. - - - - - - - - -/**************************************/ -/**************************************/ -/**************************************/ - -class ArrayDataSource -{ -%TypeHeaderCode -#include "RefDetectorViewer/inc/MantidQtRefDetectorViewer/ArrayDataSource.h" -%End -%Docstring - -ArrayDataSource -=============== - - This class provides a wrapper around a simple 2D array of doubles stored - in row-major order in a 1D array, so that the array can be viewed using - the RefDetector data viewer. - -%End - -public: - ArrayDataSource(double total_xmin, double total_xmax, - double total_ymin, double total_ymax, - int total_rows, int total_cols, - float* data); - MantidQt::RefDetectorViewer::DataArray* getDataArray( double xmin, - double xmax, - double ymin, - double ymax, - int n_rows, - int n_cols, - bool is_log_x); - -}; - - - - - - - -/**************************************/ -/**************************************/ -/**************************************/ - -class ImageView : QMainWindow -{ -%TypeHeaderCode -#include "RefDetectorViewer/inc/MantidQtRefDetectorViewer/ImageView.h" -%End -%Docstring - -ImageView -========= - - This is the QMainWindow for the RefDetectorViewer. Data is - displayed in an ImageView by constructing the ImageView object - and specifying a particular Data Source - -%End - -public: - ImageView(ImageDataSource* dataSource); - -}; - -}; // end namespace -}; // end namespace - - - - - - - - diff --git a/Code/Mantid/MantidQt/Python/mantidqt.sip b/Code/Mantid/MantidQt/Python/mantidqt.sip index 89b157802ef4eb028147b0af50470e9ab5506ac7..d3b4d115d6ea77d5710e1f6a5a26eb540be05cd7 100644 --- a/Code/Mantid/MantidQt/Python/mantidqt.sip +++ b/Code/Mantid/MantidQt/Python/mantidqt.sip @@ -1,9 +1,9 @@ /***************************************************************************/ /** - This file is a SIP file for binding C++ methods of the + This file is a SIP file for binding C++ methods of the MantidQt widgets (SliceViewer in particular) to Python. - + */ /***************************************************************************/ @@ -120,6 +120,17 @@ public: QWidget* = 0, bool = false); MantidQt::API::UserSubWindow* createSubWindow(const QString& interface_name, QWidget* parent = 0); + void showHelpPage(const QString & url=QString()); + + void showWikiPage(const QString &page=QString()); + + void showAlgorithmHelp(const QString &name, const int version=-1); + + void showConceptHelp(const QString &name); + + void showFitFunctionHelp(const QString &name=QString()); + + void showCustomInterfaceHelp(const QString &name); }; }; @@ -198,10 +209,10 @@ MantidQt::SliceViewer::SliceViewer* SliceViewerWindow::getSlicer() Get the SliceViewer widget inside the SliceViewerWindow. This is the main widget for controlling the 2D views and slice points. - + Returns: a pointer to the SliceViewer widget. - + %End MantidQt::SliceViewer::LineViewer* getLiner(); @@ -211,10 +222,10 @@ MantidQt::SliceViewer::LineViewer* SliceViewerWindow::getLiner() Get the LineViewer widget inside the SliceViewerWindow. This is the widget for controlling the 1D line integration settings. - + Returns: a pointer to the LineViewer widget. - + %End const QString& getLabel() const; @@ -249,10 +260,10 @@ void apply() throw (std::runtime_error); void LineViewer::apply() ------------------------ Perform the 1D integration using the current parameters. - + Raises: std::runtime_error if an error occurs. - + %End void showPreview(); @@ -260,7 +271,7 @@ void showPreview(); void LineViewer::showPreview() ------------------------------ Calculate and show the preview (non-integrated) line, - using the current parameters. + using the current parameters. %End void showFull(); @@ -269,7 +280,7 @@ void LineViewer::showFull() --------------------------- Calculate and show the full (integrated) line, using the latest integrated workspace. The apply() method must have been called - before calling this. + before calling this. %End @@ -279,13 +290,13 @@ void setStartXY(double x, double y) throw (std::runtime_error); void LineViewer::setStartXY(double x, double y) ----------------------------------------------- Set the start point of the line to integrate - + Args: x :: position of the start in the "X" dimension (as shown in the SliceViewer). y :: position of the start in the "Y" dimension (as shown in the SliceViewer). - + %End void setEndXY(double x, double y) throw (std::runtime_error); @@ -293,13 +304,13 @@ void setEndXY(double x, double y) throw (std::runtime_error); void LineViewer::setEndXY(double x, double y) --------------------------------------------- Set the start point of the line to integrate - + Args: x :: position of the start in the "X" dimension (as shown in the SliceViewer). y :: position of the start in the "Y" dimension (as shown in the SliceViewer). - + %End @@ -309,13 +320,13 @@ void setThickness(double width); void LineViewer::setThickness(double width) ------------------------------------------- Set the thickness to integrate to be the same in all dimensions - + This sets the planar width and all the other dimensions' thicknesses to the same value. - + Args: width :: width of integration, in the units of all dimensions - + %End void setThickness(int dim, double width) throw (std::invalid_argument, std::runtime_error); @@ -323,19 +334,19 @@ void setThickness(int dim, double width) throw (std::invalid_argument, std::ru void LineViewer::setThickness(int dim, double width) ---------------------------------------------------- Set the thickness to integrate in a particular dimension. - + Integration is performed perpendicular to the XY plane, from -thickness below to +thickness above the center. - + Use setPlanarWidth() to set the width along the XY plane. - + Args: dim :: index of the dimension to change width :: width of integration, in the units of the dimension. - + Raises: std::invalid_argument if the index is invalid - + %End void setThickness(const QString & dim, double width) throw (std::invalid_argument, std::runtime_error); @@ -343,19 +354,19 @@ void setThickness(const QString & dim, double width) throw (std::invalid_argum void LineViewer::setThickness(const QString & dim, double width) ---------------------------------------------------------------- Set the thickness to integrate in a particular dimension. - + Integration is performed perpendicular to the XY plane, from -thickness below to +thickness above the center. - + Use setPlanarWidth() to set the width along the XY plane. - + Args: dim :: name of the dimension to change width :: thickness of integration, in the units of the dimension. - + Raises: std::runtime_error if the name is not found in the workspace - + %End void setPlanarWidth(double width); @@ -364,18 +375,18 @@ void LineViewer::setPlanarWidth(double width) --------------------------------------------- Set the width of the line in the planar dimension only. Other dimensions' widths will follow unless they were manually changed - + Args: - width :: width in the plane. + width :: width in the plane. %End double getPlanarWidth() const; %Docstring double LineViewer::getPlanarWidth() ----------------------------------- - + Returns: - the width in the plane, or the width in dimension 0 if not restricted to a plane + the width in the plane, or the width in dimension 0 if not restricted to a plane %End @@ -385,13 +396,13 @@ void setNumBins(int numBins) throw (std::invalid_argument); void LineViewer::setNumBins(int numBins) ---------------------------------------- Set the number of bins in the line. - + Args: numBins :: # of bins - + Raises: std::invalid_argument if numBins < 1 - + %End void setFixedBinWidthMode(bool fixedWidth, double binWidth) throw (std::invalid_argument); @@ -399,21 +410,21 @@ void setFixedBinWidthMode(bool fixedWidth, double binWidth) throw (std::invali void LineViewer::setFixedBinWidthMode(bool fixedWidth, double binWidth) ----------------------------------------------------------------------- Sets the fixed bin width mode on or off. - + In fixed bin width mode, the width of each bin along the line length is constant, and the number of bins is adjusted to as the line gets longer. If off, then you use a fixed number of bins, and the bin width is then simply: width = length / number_of_bins. - + Args: fixedWidth :: if True, then keep the bin width fixed. binWidth :: for fixed bin width mode, this specified the desired bin width. Must be > 0. Ignored for non-fixed-bin-width mode. - + Raises: std::invalid_argument if binWidth <= 0 - + %End double getFixedBinWidth() const; @@ -421,10 +432,10 @@ double getFixedBinWidth() const; double LineViewer::getFixedBinWidth() ------------------------------------- For fixed-bin-width mode, get the desired fixed bin width. - + Returns: the desired fixed bin width - + %End bool getFixedBinWidthMode() const; @@ -432,10 +443,10 @@ bool getFixedBinWidthMode() const; bool LineViewer::getFixedBinWidthMode() --------------------------------------- Is the LineViewer in fixed-bin-width mode? - + Returns: True if in fixed bin width mode. - + %End int getNumBins() const; @@ -443,10 +454,10 @@ int getNumBins() const; int LineViewer::getNumBins() ---------------------------- Get the number of bins - + Returns: the number of bins in the line to integrate (int) - + %End double getBinWidth() const; @@ -454,10 +465,10 @@ double getBinWidth() const; double LineViewer::getBinWidth() -------------------------------- Get the width of each bin - + Returns: the width of each bin (double) - + %End int getXAxisDimensionIndex() const; @@ -465,10 +476,10 @@ int getXAxisDimensionIndex() const; int LineViewer::getXAxisDimensionIndex() -------------------------------- Get the index of the dimension used for the x axis - + Returns: the index of the dimension used for the x axis (int) - + %End @@ -478,10 +489,10 @@ void setPlotAxis(int choice); void LineViewer::setPlotAxis(int choice) ---------------------------------------- Choose which coordinates to use as the X axis to plot in the line view. - + Args: choice :: PlotAxisChoice, either Auto, X, Y or Distance. - + %End int getPlotAxis() const; @@ -489,10 +500,10 @@ int getPlotAxis() const; int LineViewer::getPlotAxis() ----------------------------- Return which coordinates to use as the X axis to plot in the line view. - + Returns: PlotAxisChoice, either Auto, X, Y or Distance. - + %End @@ -522,46 +533,46 @@ public: void PeaksPresenter::setForegroundColor(const QColor color) ------------------------------------------------------ Sets the Foreground color of the peaks workspace as displayed in the peaks overlay. - + Args: color :: color to change foreground to -%End +%End virtual void setForegroundColor(const QColor) = 0; %Docstring void PeaksPresenter::setBackgroundColor(const QColor color) ------------------------------------------------------ Sets the Background color of the peaks workspace as displayed in the peaks overlay. - + Args: color :: color to change background to -%End +%End virtual void setBackgroundColor(const QColor) = 0; %Docstring void PeaksPresenter::showBackgroundRadius(const bool shown) ------------------------------------------------------ Toggle the background radius on and off. - + Args: shown :: True to show the background radius, otherwise false. -%End +%End virtual void showBackgroundRadius(const bool shown) = 0; %Docstring void PeaksPresenter::setShown(const bool shown) ------------------------------------------------------ Toggle the overplotted state of this PeaksWorkspace in the PeaksOverlay - + Args: shown :: True to show. False to hide. -%End +%End virtual void setShown(const bool shown) = 0; %Docstring void PeaksPresenter::zoomToPeak(const int index) ------------------------------------------------------ Zoom in on a peak of the PeaksWorkspace. Provide an index (0 based) to go to the peak. - + Args: index :: Index into the peaks workspace (0 based) to zoom to. -%End +%End virtual void zoomToPeak(const int index) = 0; }; @@ -610,24 +621,24 @@ void SliceViewer::setWorkspace(const QString & wsName) Set the workspace to view using its name. The workspace should be a MDHistoWorkspace or a MDEventWorkspace, with at least 2 dimensions. - + Args: wsName :: name of the MDWorkspace to look for - + Raises: std::runtime_error if the workspace is not found or is a MatrixWorkspace - + %End QString getWorkspaceName() const; %Docstring QString SliceViewer::getWorkspaceName() --------------------------------------- - + Returns: the name of the workspace selected, or a blank string if no workspace is set. - + %End void showControls(bool visible); @@ -635,10 +646,10 @@ QString SliceViewer::getWorkspaceName() void SliceViewer::showControls(bool visible) -------------------------------------------- Programmatically show/hide the controls (sliders etc) - + Args: visible :: true if you want to show the controls. - + %End void openFromXML(const QString & xml) throw (std::invalid_argument, std::runtime_error); @@ -647,13 +658,13 @@ void SliceViewer::openFromXML(const QString & xml) -------------------------------------------------- Opens a workspace and sets the view and slice points given the XML from the MultiSlice view in XML format. - + Args: xml :: string describing workspace, slice point, etc. - + Raises: std::runtime_error if error in parsing XML - + %End QPixmap getImage(); @@ -662,12 +673,12 @@ QPixmap SliceViewer::getImage() ------------------------------- Grab the 2D view as an image. The image is rendered at the current window size, with the color scale but without the text boxes for changing them. - + See also saveImage() and copyImageToClipboard() - + Returns: QPixmap containing the image. - + %End void saveImage(const QString & filename); @@ -675,12 +686,12 @@ QPixmap SliceViewer::getImage() void SliceViewer::saveImage(const QString & filename) ----------------------------------------------------- Save the rendered 2D slice to an image file. - + Args: filename :: full path to the file to save, including extension (e.g. .png). If not specified or empty, then a dialog will prompt the user to pick a file. - + %End void copyImageToClipboard(); @@ -688,7 +699,7 @@ void SliceViewer::saveImage(const QString & filename) void SliceViewer::copyImageToClipboard() ---------------------------------------- Copy the rendered 2D image to the clipboard - + %End void setFastRender(bool fast); @@ -697,15 +708,15 @@ void SliceViewer::setFastRender(bool fast) ------------------------------------------ Sets whether the image should be rendered in "fast" mode, where the workspace's resolution is used to guess how many pixels to render. - + If false, each pixel on screen will be rendered. This is the most accurate view but the slowest. - + This redraws the screen. - + Args: fast :: true to use "fast" rendering mode. - + %End bool getFastRender() const; @@ -713,14 +724,14 @@ void SliceViewer::setFastRender(bool fast) bool SliceViewer::getFastRender() --------------------------------- Return true if the image is in "fast" rendering mode. - + In "fast" mode, the workspace's resolution is used to guess how many pixels to render. If false, each pixel on screen will be rendered. This is the most accurate view but the slowest. - + Returns: True if the image is in "fast" rendering mode. - + %End void toggleLineMode(bool lineMode); @@ -728,10 +739,10 @@ bool SliceViewer::getFastRender() void SliceViewer::toggleLineMode(bool lineMode) ----------------------------------------------- Toggle "line-drawing" mode (to draw 1D lines using the mouse) - + Args: lineMode :: True to go into line mode, False to exit it. - + %End @@ -743,16 +754,16 @@ void SliceViewer::setXYDim(int indexX, int indexY) Set the index of the dimensions that will be shown as the X and Y axis of the plot. You cannot set both axes to be the same. - + To be called from Python, primarily. - + Args: indexX :: index of the X dimension, from 0 to NDims-1. indexY :: index of the Y dimension, from 0 to NDims-1. - + Raises: std::invalid_argument if an index is invalid or repeated. - + %End void setXYDim(const QString & dimX, const QString & dimY) throw (std::invalid_argument, std::runtime_error); @@ -760,36 +771,36 @@ void SliceViewer::setXYDim(int indexX, int indexY) void SliceViewer::setXYDim(const QString & dimX, const QString & dimY) ---------------------------------------------------------------------- Set the dimensions that will be shown as the X and Y axes - + Args: dimX :: name of the X dimension. Must match the workspace dimension names. dimY :: name of the Y dimension. Must match the workspace dimension names. - + Raises: std::runtime_error if the dimension name is not found. - + %End int getDimX() const; %Docstring int SliceViewer::getDimX() -------------------------- - + Returns: the index of the dimension that is currently being shown as the X axis of the plot. - + %End int getDimY() const; %Docstring int SliceViewer::getDimY() -------------------------- - + Returns: the index of the dimension that is currently being shown as the Y axis of the plot. - + %End @@ -800,15 +811,15 @@ void SliceViewer::setSlicePoint(int dim, double value) ------------------------------------------------------ Sets the slice point in the given dimension: that is, what is the position of the plane in that dimension - + Args: dim :: index of the dimension to change value :: value of the slice point, in the units of the given dimension. This should be within the range of min/max for that dimension. - + Raises: std::invalid_argument if the index is invalid - + %End void setSlicePoint(const QString & dim, double value) throw (std::invalid_argument, std::runtime_error); @@ -817,15 +828,15 @@ void SliceViewer::setSlicePoint(const QString & dim, double value) ------------------------------------------------------------------ Sets the slice point in the given dimension: that is, what is the position of the plane in that dimension - + Args: dim :: name of the dimension to change value :: value of the slice point, in the units of the given dimension. This should be within the range of min/max for that dimension. - + Raises: std::runtime_error if the name is not found in the workspace - + %End double getSlicePoint(int dim) const throw (std::invalid_argument); @@ -833,17 +844,17 @@ void SliceViewer::setSlicePoint(const QString & dim, double value) double SliceViewer::getSlicePoint(int dim) ------------------------------------------ Returns the slice point in the given dimension - + Args: dim :: index of the dimension - + Returns: slice point for that dimension. Value has no significance for the X or Y display dimensions. - + Raises: std::invalid_argument if the index is invalid - + %End double getSlicePoint(const QString & dim) const throw (std::invalid_argument, std::runtime_error); @@ -851,17 +862,17 @@ double SliceViewer::getSlicePoint(int dim) double SliceViewer::getSlicePoint(const QString & dim) ------------------------------------------------------ Returns the slice point in the given dimension - + Args: dim :: name of the dimension - + Returns: slice point for that dimension. Value has no significance for the X or Y display dimensions. - + Raises: std::runtime_error if the name is not found in the workspace - + %End @@ -874,34 +885,34 @@ void SliceViewer::setXYLimits(double xleft, double xright, double ybottom, doubl The X and Y values are in the units of their respective dimensions. You can change the mapping from X/Y in the plot to specific dimensions in the displayed workspace using setXYDim(). - + You can flip the direction of the scale if you specify, e.g., xleft > xright. - + Args: xleft :: x-value on the left side of the graph xright :: x-value on the right side of the graph ybottom :: y-value on the bottom of the graph ytop :: y-value on the top of the graph - + %End QwtDoubleInterval getXLimits() const; %Docstring QwtDoubleInterval SliceViewer::getXLimits() ------------------------------------------- - + Returns: - Returns the [left, right] limits of the view in the X axis. + Returns the [left, right] limits of the view in the X axis. %End QwtDoubleInterval getYLimits() const; %Docstring QwtDoubleInterval SliceViewer::getYLimits() ------------------------------------------- - + Returns: - Returns the [bottom, top] limits of the view in the Y axis. + Returns the [bottom, top] limits of the view in the Y axis. %End void zoomBy(double factor); @@ -909,11 +920,11 @@ QwtDoubleInterval SliceViewer::getYLimits() void SliceViewer::zoomBy(double factor) --------------------------------------- Zoom in or out, keeping the center of the plot in the same position. - + Args: factor :: double, if > 1 : zoom in by this factor. if < 1 : it will zoom out. - + %End void setXYCenter(double x, double y); @@ -924,11 +935,11 @@ void SliceViewer::setXYCenter(double x, double y) This keeps the plot the same size as previously. Use setXYLimits() to modify the size of the plot by setting the X/Y edges, or you can use zoomBy() to zoom in/out - + Args: x :: new position of the center in X y :: new position of the center in Y - + %End void resetZoom(); @@ -939,7 +950,7 @@ void SliceViewer::resetZoom() This will reset the XY limits to the full range of the workspace. Use zoomBy() or setXYLimits() to modify the view range. This corresponds to the "View Extents" button. - + %End @@ -949,10 +960,10 @@ void SliceViewer::resetZoom() void SliceViewer::loadColorMap(QString filename) ------------------------------------------------ Load a color map from a file - + Args: filename :: file to open; empty to ask via a dialog box. - + %End void setColorScale(double min, double max, bool log) throw (std::invalid_argument); @@ -960,16 +971,16 @@ void SliceViewer::loadColorMap(QString filename) void SliceViewer::setColorScale(double min, double max, bool log) ----------------------------------------------------------------- Set the color scale limits and log mode via a method call. - + Args: min :: minimum value corresponding to the lowest color on the map max :: maximum value corresponding to the highest color on the map log :: true for a log color scale, false for linear - + Raises: std::invalid_argument if max < min or if the values are inconsistent with a log color scale - + %End void setColorScaleMin(double min) throw (std::invalid_argument); @@ -977,14 +988,14 @@ void SliceViewer::setColorScale(double min, double max, bool log) void SliceViewer::setColorScaleMin(double min) ---------------------------------------------- Set the minimum value corresponding to the lowest color on the map - + Args: min :: minimum value corresponding to the lowest color on the map - + Raises: std::invalid_argument if max < min or if the values are inconsistent with a log color scale - + %End void setColorScaleMax(double max) throw (std::invalid_argument); @@ -992,14 +1003,14 @@ void SliceViewer::setColorScaleMin(double min) void SliceViewer::setColorScaleMax(double max) ---------------------------------------------- Set the maximum value corresponding to the lowest color on the map - + Args: max :: maximum value corresponding to the lowest color on the map - + Raises: std::invalid_argument if max < min or if the values are inconsistent with a log color scale - + %End void setColorScaleLog(bool log); @@ -1007,41 +1018,41 @@ void SliceViewer::setColorScaleMax(double max) void SliceViewer::setColorScaleLog(bool log) -------------------------------------------- Set whether the color scale is logarithmic - + Args: log :: true for a log color scale, false for linear - + Raises: std::invalid_argument if the min/max values are inconsistent with a log color scale - + %End double getColorScaleMin() const; %Docstring double SliceViewer::getColorScaleMin() -------------------------------------- - + Returns: - the value that corresponds to the lowest color on the color map + the value that corresponds to the lowest color on the color map %End double getColorScaleMax() const; %Docstring double SliceViewer::getColorScaleMax() -------------------------------------- - + Returns: - the value that corresponds to the highest color on the color map + the value that corresponds to the highest color on the color map %End bool getColorScaleLog() const; %Docstring bool SliceViewer::getColorScaleLog() ------------------------------------ - + Returns: - True if the color scale is in logarithmic mode + True if the color scale is in logarithmic mode %End void setColorScaleAutoFull(); @@ -1051,7 +1062,7 @@ void SliceViewer::setColorScaleAutoFull() Automatically sets the min/max of the color scale, using the limits in the entire data set of the workspace (every bin, even those not currently visible). - + %End void setColorScaleAutoSlice() ; @@ -1062,7 +1073,7 @@ void SliceViewer::setColorScaleAutoSlice() using the limits in the data that is currently visible in the plot (only the bins in this slice and within the view limits) - + %End void setColorMapBackground(int r, int g, int b); @@ -1070,18 +1081,18 @@ void SliceViewer::setColorScaleAutoSlice() void SliceViewer::setColorMapBackground(int r, int g, int b) ------------------------------------------------------------ Set the "background" color to use in the color map. Default is white. - + This is the color that is shown when: - + - The coordinate is out of bounds of the workspace. - When a signal is NAN (not-a-number). - When the signal is Zero, if that option is selected using setTransparentZeros() - + Args: r :: red component, from 0-255 g :: green component, from 0-255 b :: blue component, from 0-255 - + %End void setTransparentZeros(bool transparent); @@ -1089,10 +1100,10 @@ void SliceViewer::setColorMapBackground(int r, int g, int b) void SliceViewer::setTransparentZeros(bool transparent) ------------------------------------------------------- Set whether to display 0 signal as "transparent" color. - + Args: transparent :: true if you want zeros to be transparent. - + %End void setNormalization(Mantid::API::MDNormalization norm); @@ -1100,19 +1111,19 @@ void SliceViewer::setTransparentZeros(bool transparent) void SliceViewer::setNormalization(Mantid::API::MDNormalization norm) --------------------------------------------------------------------- Set the normalization mode for viewing the data - + Args: norm :: MDNormalization enum. 0=none; 1=volume; 2=# of events - + %End Mantid::API::MDNormalization getNormalization() const; %Docstring Mantid::API::MDNormalization SliceViewer::getNormalization() ------------------------------------------------------------ - + Returns: - the current normalization + the current normalization %End @@ -1122,14 +1133,14 @@ Mantid::API::MDNormalization SliceViewer::getNormalization() void SliceViewer::setRebinThickness(int dim, double thickness) -------------------------------------------------------------- Set the thickness (above and below the plane) for dynamic rebinning. - + Args: dim :: index of the dimension to adjust thickness :: thickness to set, in units of the dimension. - + Raises: runtime_error if the dimension index is invalid or the thickness is <= 0.0. - + %End void setRebinNumBins(int xBins, int yBins) throw (std::runtime_error); @@ -1137,14 +1148,14 @@ void SliceViewer::setRebinThickness(int dim, double thickness) void SliceViewer::setRebinNumBins(int xBins, int yBins) ------------------------------------------------------- Set the number of bins for dynamic rebinning. - + Args: xBins :: number of bins in the viewed X direction yBins :: number of bins in the viewed Y direction - + Raises: runtime_error if the number of bins is < 1 - + %End void setRebinMode(bool mode, bool locked) throw (std::runtime_error); @@ -1156,12 +1167,12 @@ void SliceViewer::setRebinMode(bool mode, bool locked) limits to rebin. See setRebinNumBins() to adjust the number of bins in the X/Y dimensions. See setRebinThickness() to adjust the thickness in other dimensions. - + Args: mode :: true for rebinning mode locked :: if true, then the rebinned area is only refreshed manually or when changing rebinning parameters. - + %End void refreshRebin() throw (std::runtime_error); @@ -1170,16 +1181,16 @@ void SliceViewer::refreshRebin() -------------------------------- When in dynamic rebinning mode, this refreshes the rebinned area to be the currently viewed area. See setXYLimits(), setRebinNumBins(), setRebinThickness() - + %End MantidQt::SliceViewer::ProxyCompositePeaksPresenter* setPeaksWorkspaces(const QStringList&); %Docstring void SliceViewer::setPeaksWorkspaces(const QStringList&) -------------------------------- - Enable overplotting of one or more peaks workspaces. + Enable overplotting of one or more peaks workspaces. See clearPeaksWorkspaces() for removal. - + %End void clearPeaksWorkspaces(); @@ -1188,7 +1199,7 @@ void SliceViewer::clearPeaksWorkspaces() -------------------------------- Clear overplotting of all overplotted peaks workspaces. See setPeaksWorkspaces() for addition. - + %End }; @@ -1241,7 +1252,7 @@ public: void WidgetFactory::closeAllSliceViewerWindows() ------------------------------------------------ Closes every previously-open instance of a SliceViewerWindow. - + %End @@ -1252,15 +1263,15 @@ MantidQt::SliceViewer::SliceViewer* WidgetFactory::createSliceViewer(const QStri Create an instance of a bare SliceViewer Widget. This is only capable of doing 2D views, and cannot do line plots since it does not have a LineViewer. - + Use WidgetFactory::createSliceViewerWindow to create a window combining both. - + Args: wsName :: name of the workspace to show. Optional, blank for no workspace. - + Returns: the created SliceViewer * - + %End @@ -1272,7 +1283,7 @@ WidgetFactory::WidgetFactory() Private constructor. This is not accessible, use the Instance() method to access the singleton instance instead. - + %End }; @@ -1301,7 +1312,7 @@ class RefIVConnections: QWidget RefIVConnections ================ - A RefIVConnections object is responsible for emitting signals about + A RefIVConnections object is responsible for emitting signals about changes in the state of the image view. %End @@ -1325,26 +1336,26 @@ RefMatrixWSImageView A RefMatrixWSImageView is the gateway to the image view display. To bring up an image display simply construct an object of this type, i.e. image_view = RefMatrixWSImageView("test_ws") - + See the methods for RefMatrixWSImageView, below. %End public: RefMatrixWSImageView(QString wsname, int peak_min, int peak_max, int back_min, int back_max, int tof_min, int tof_max); - + MantidQt::RefDetectorViewer::RefIVConnections * getConnections(); %Docstring MantidQt::RefDetectorViewer::RefIVConnections* RefMatrixWSImageView::getConnections() ------------------------------------------------------------------------------------- Get the connections widget inside the image view. This object is responsible for emitting signals about changes in the state of the image view. - + Returns: a pointer to the RefIVConnections object. - + %End - + };