Mantid
Loading...
Searching...
No Matches
Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
MantidQt::API::UserSubWindow Class Referenceabstract

This is the base class all customised user interfaces that do not wish to be tied to a specific Mantid algorithm but rather customised for user's requirements. More...

#include <UserSubWindow.h>

Inheritance diagram for MantidQt::API::UserSubWindow:

Signals

void runAsPythonScript (const QString &code, bool)
 Emitted to start a (generally small) script running. More...
 
void setFitPropertyBrowser (MantidQt::MantidWidgets::FitPropertyBrowser *browser)
 Thrown when used fit property browser should be changed to given one. More...
 

Public Member Functions

void initializeLayout ()
 Create the layout of the widget. Can only be called once. More...
 
void initializeLocalPython ()
 Run local Python init code. More...
 
bool isInitialized () const
 Is this dialog initialized. More...
 
bool isPyInitialized () const
 Has the Python initialization function been run. More...
 
 UserSubWindow (QWidget *parent=nullptr)
 DefaultConstructor. More...
 

Static Public Member Functions

static std::set< std::string > aliases ()
 A list of aliases. More...
 
static std::string name ()
 Name of the interface. More...
 

Protected Member Functions

virtual void initLayout ()=0
 To be overridden to set the appropriate layout. More...
 
virtual void initLocalPython ()
 Run local Python setup code. More...
 
QLabel * newValidator (QWidget *parent)
 Returns a pointer to a new validator QLabel. More...
 
QString openFileDialog (const bool save, const QStringList &exts)
 Open a file selection box. More...
 
virtual void otherUserSubWindowCreated (QList< QPointer< UserSubWindow > > &windows)
 To be overridden in order to connect a signal between two interfaces. More...
 
virtual void otherUserSubWindowCreated (QPointer< UserSubWindow > window)
 To be overridden in order to connect a signal between two interfaces. More...
 
QString runPythonCode (const QString &code, bool no_output=false)
 Run a piece of python code and return any output that was written to stdout. More...
 
void showInformationBox (const QString &message) const
 Raise a dialog box giving some information. More...
 

Private Member Functions

void setInterfaceName (const QString &iface_name)
 Set the interface name, made public so possible from Python. More...
 

Private Attributes

bool m_bIsInitialized
 Has this already been initialized. More...
 
QString m_ifacename
 Store the name of the interface. More...
 
bool m_isPyInitialized
 Has the python initialization been run. More...
 
PythonRunner m_pythonRunner
 Python executor. More...
 

Friends

class InterfaceManager
 

Detailed Description

This is the base class all customised user interfaces that do not wish to be tied to a specific Mantid algorithm but rather customised for user's requirements.

Author
Martyn Gigg, Tessella Support Services plc
Date
18/03/2009

Definition at line 70 of file UserSubWindow.h.

Constructor & Destructor Documentation

◆ UserSubWindow()

UserSubWindow::UserSubWindow ( QWidget *  parent = nullptr)

DefaultConstructor.

Default Constructor.

Definition at line 29 of file UserSubWindow.cpp.

References m_pythonRunner, and runAsPythonScript().

Member Function Documentation

◆ aliases()

static std::set< std::string > MantidQt::API::UserSubWindow::aliases ( )
inlinestatic

A list of aliases.

Definition at line 77 of file UserSubWindow.h.

◆ initializeLayout()

void UserSubWindow::initializeLayout ( )

Create the layout of the widget. Can only be called once.

Create the layout for this dialog.

Definition at line 42 of file UserSubWindow.cpp.

References initLayout(), Mantid::Kernel::SingletonHolder< T >::Instance(), Mantid::Kernel::Interface, isInitialized(), m_bIsInitialized, and m_ifacename.

Referenced by MantidQt::API::InterfaceManager::createSubWindow().

◆ initializeLocalPython()

void UserSubWindow::initializeLocalPython ( )

Run local Python init code.

Initialize local Python environment.

Calls overridable function in specialized interface

This is called once when the interface is created and is meant to be used to run one off code, i.e. importing modules.

Definition at line 78 of file UserSubWindow.cpp.

References initLocalPython(), isPyInitialized(), and m_isPyInitialized.

◆ initLayout()

virtual void MantidQt::API::UserSubWindow::initLayout ( )
protectedpure virtual

To be overridden to set the appropriate layout.

Referenced by initializeLayout().

◆ initLocalPython()

virtual void MantidQt::API::UserSubWindow::initLocalPython ( )
inlineprotectedvirtual

Run local Python setup code.

Definition at line 103 of file UserSubWindow.h.

Referenced by initializeLocalPython().

◆ isInitialized()

bool UserSubWindow::isInitialized ( ) const

Is this dialog initialized.

Has this window been initialized yet.

Returns
Whether initialzedLayout has been called yet

Definition at line 65 of file UserSubWindow.cpp.

References m_bIsInitialized.

Referenced by initializeLayout().

◆ isPyInitialized()

bool UserSubWindow::isPyInitialized ( ) const

Has the Python initialization function been run.

Has the Python initialization function been called yet?

Returns
Whether initializeLocalPython has been called yet

Definition at line 71 of file UserSubWindow.cpp.

References m_isPyInitialized.

Referenced by initializeLocalPython().

◆ name()

static std::string MantidQt::API::UserSubWindow::name ( )
inlinestatic

Name of the interface.

Definition at line 75 of file UserSubWindow.h.

◆ newValidator()

QLabel * UserSubWindow::newValidator ( QWidget *  parent)
protected

Returns a pointer to a new validator QLabel.

The code is copied from AlgorithmDialog.cpp and wont know if the validator label changes there

Parameters
parent:: a pointer to an object that will look after it deleting it

Definition at line 150 of file UserSubWindow.cpp.

◆ openFileDialog()

QString UserSubWindow::openFileDialog ( const bool  save,
const QStringList &  exts 
)
protected

Open a file selection box.

Parameters
save:: if true a save dialog box used (prompts for replace if file exists) otherwise a load file (file must then exist)
exts:: the dialog boxes will only show files that have extensions that match one of the QStrings in the list

Definition at line 121 of file UserSubWindow.cpp.

References Mantid::Kernel::SingletonHolder< T >::Instance().

◆ otherUserSubWindowCreated() [1/2]

virtual void MantidQt::API::UserSubWindow::otherUserSubWindowCreated ( QList< QPointer< UserSubWindow > > &  windows)
inlineprotectedvirtual

To be overridden in order to connect a signal between two interfaces.

Definition at line 109 of file UserSubWindow.h.

References UNUSED_ARG.

◆ otherUserSubWindowCreated() [2/2]

virtual void MantidQt::API::UserSubWindow::otherUserSubWindowCreated ( QPointer< UserSubWindow window)
inlineprotectedvirtual

To be overridden in order to connect a signal between two interfaces.

Definition at line 106 of file UserSubWindow.h.

References UNUSED_ARG.

Referenced by MantidQt::API::InterfaceManager::notifyExistingInterfaces().

◆ runAsPythonScript

void MantidQt::API::UserSubWindow::runAsPythonScript ( const QString &  code,
bool   
)
signal

Emitted to start a (generally small) script running.

Referenced by UserSubWindow().

◆ runPythonCode()

QString UserSubWindow::runPythonCode ( const QString &  code,
bool  no_output = false 
)
protected

Run a piece of python code and return any output that was written to stdout.

Execute a piece of Python code and the output that was written to stdout, i.e.

the output from print statements

Parameters
code:: The code to execute
no_output:: An optional flag to specify that no output is needed. If running only small commands enable this as it should be faster. The default value is false

Definition at line 110 of file UserSubWindow.cpp.

References m_pythonRunner, and MantidQt::API::PythonRunner::runPythonCode().

◆ setFitPropertyBrowser

void MantidQt::API::UserSubWindow::setFitPropertyBrowser ( MantidQt::MantidWidgets::FitPropertyBrowser browser)
signal

Thrown when used fit property browser should be changed to given one.

◆ setInterfaceName()

void UserSubWindow::setInterfaceName ( const QString &  iface_name)
private

Set the interface name, made public so possible from Python.

Set the interface name.

Parameters
iface_name:: The name of the interface

Definition at line 165 of file UserSubWindow.cpp.

References m_ifacename.

Referenced by MantidQt::API::InterfaceManager::createSubWindow().

◆ showInformationBox()

void UserSubWindow::showInformationBox ( const QString &  message) const
protected

Raise a dialog box giving some information.

Raise a dialog box with some information for the user.

Parameters
message:: The message to show

Definition at line 95 of file UserSubWindow.cpp.

Friends And Related Function Documentation

◆ InterfaceManager

friend class InterfaceManager
friend

Definition at line 124 of file UserSubWindow.h.

Member Data Documentation

◆ m_bIsInitialized

bool MantidQt::API::UserSubWindow::m_bIsInitialized
private

Has this already been initialized.

Definition at line 130 of file UserSubWindow.h.

Referenced by initializeLayout(), and isInitialized().

◆ m_ifacename

QString MantidQt::API::UserSubWindow::m_ifacename
private

Store the name of the interface.

Definition at line 134 of file UserSubWindow.h.

Referenced by initializeLayout(), and setInterfaceName().

◆ m_isPyInitialized

bool MantidQt::API::UserSubWindow::m_isPyInitialized
private

Has the python initialization been run.

Definition at line 132 of file UserSubWindow.h.

Referenced by initializeLocalPython(), and isPyInitialized().

◆ m_pythonRunner

PythonRunner MantidQt::API::UserSubWindow::m_pythonRunner
private

Python executor.

Definition at line 137 of file UserSubWindow.h.

Referenced by runPythonCode(), and UserSubWindow().


The documentation for this class was generated from the following files: