18#include <QTemporaryFile>
30 : QMainWindow(parent), m_bIsInitialized(false), m_isPyInitialized(false), m_ifacename(
""), m_pythonRunner() {
31 setAttribute(Qt::WA_DeleteOnClose,
false);
53 setWindowIcon(QIcon(
":/mantidplot.png"));
96 if (!message.isEmpty()) {
97 QMessageBox::information(
const_cast<UserSubWindow *
>(
this), this->windowTitle(), message);
125 for (
int i = 0; i < exts.size(); i++) {
126 filter.append(
"*." + exts[i] +
" ");
128 filter = filter.trimmed();
130 filter.append(
";;All Files (*)");
141 if (!filename.isEmpty()) {
151 auto *validLbl =
new QLabel(
"*", parent);
152 QPalette pal = validLbl->palette();
153 pal.setColor(QPalette::WindowText, Qt::darkRed);
154 validLbl->setPalette(pal);
QString runPythonCode(const QString &code, bool no_output=false)
Run python code.
This is the base class all customised user interfaces that do not wish to be tied to a specific Manti...
QString runPythonCode(const QString &code, bool no_output=false)
Run a piece of python code and return any output that was written to stdout.
void showInformationBox(const QString &message) const
Raise a dialog box giving some information.
QLabel * newValidator(QWidget *parent)
Returns a pointer to a new validator QLabel.
QString openFileDialog(const bool save, const QStringList &exts)
Open a file selection box.
void runAsPythonScript(const QString &code, bool)
Emitted to start a (generally small) script running.
void setInterfaceName(const QString &iface_name)
Set the interface name, made public so possible from Python.
QString m_ifacename
Store the name of the interface.
bool m_bIsInitialized
Has this already been initialized.
UserSubWindow(QWidget *parent=nullptr)
DefaultConstructor.
virtual void initLocalPython()
Run local Python setup code.
virtual void initLayout()=0
To be overridden to set the appropriate layout.
bool isPyInitialized() const
Has the Python initialization function been run.
void initializeLocalPython()
Run local Python init code.
void initializeLayout()
Create the layout of the widget. Can only be called once.
PythonRunner m_pythonRunner
Python executor.
bool isInitialized() const
Is this dialog initialized.
bool m_isPyInitialized
Has the python initialization been run.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...