25#include <Poco/Environment.h>
38std::once_flag DLLS_LOADED;
41bool offlineHelpMsgDisplayed =
false;
45 return existingInterfaces;
73 const QString &optionalMsg,
const QStringList &enabled,
74 const QStringList &disabled) {
77 g_log.
debug() <<
"Creating a specialised dialog for " << alg->name() <<
'\n';
81 g_log.
debug() <<
"No specialised dialog exists for the " << alg->name()
82 <<
" algorithm: a generic one has been created\n";
86 dlg->setParent(parent);
87 dlg->setAttribute(Qt::WA_DeleteOnClose,
true);
90 Qt::WindowFlags flags = Qt::WindowFlags();
96 flags |= Qt::CustomizeWindowHint;
97 flags |= Qt::WindowMinimizeButtonHint;
98 flags |= Qt::WindowCloseButtonHint;
101 flags |= Qt::WindowCloseButtonHint;
103 dlg->setWindowFlags(flags);
134 QWidget *parent,
bool forScript,
136 const QString &optionalMsg,
const QStringList &enabled,
137 const QStringList &disabled) {
142 return createDialog(alg, parent, forScript, presetValues, optionalMsg, enabled, disabled);
153 std::string iname = interface_name.toStdString();
160 g_log.
debug() <<
"Created a specialised interface for " << iname <<
'\n';
165 user_win->setParent(parent, user_win->windowFlags());
167 user_win->setParent(parent);
176 g_log.
error() <<
"Error creating interface " << iname <<
"\n";
190 auto &existingWindows = existingInterfaces();
191 existingWindows.erase(std::remove_if(existingWindows.begin(), existingWindows.end(),
192 [](QPointer<UserSubWindow> &window) { return window.isNull(); }),
193 existingWindows.end());
195 for (
auto &window : existingWindows)
196 window->otherUserSubWindowCreated(newWindow);
200 existingWindows.append(newWindow);
228 if (!offlineHelpMsgDisplayed) {
229 g_log.
information(
"Offline help is not available in this version of Workbench.");
230 offlineHelpMsgDisplayed =
true;
236 g_log.
error(
"Error creating help window");
244 window->showPage(url);
249 window->showWikiPage(page);
254 window->showAlgorithm(name, version);
259 window->showConcept(name);
264 window->showFitFunction(name);
269 window->showCustomInterface(name, area, section);
275 if (MantidHelpWindow::helpWindowExists()) {
This class should be the basis for all customised algorithm dialogs.
void addEnabledAndDisableLists(const QStringList &enabled, const QStringList &disabled)
Set comma-separated-list of enabled parameter names.
void setAlgorithm(const Mantid::API::IAlgorithm_sptr &)
The following methods were made public for testing in GenericDialogDemo.cpp.
bool isForScript() const
Get the usage boolean value.
void setOptionalMessage(const QString &message)
Set an optional message to be displayed at the top of the dialog.
void executeOnAccept(bool on)
If true then execute the algorithm on acceptance.
void initializeLayout()
Create the layout of the widget. Can only be called once.
void setPresetValues(const QHash< QString, QString > &presetValues)
Set a list of suggested values.
This class gives a basic dialog that is not tailored to a particular algorithm.
AlgorithmDialog * createDialog(const std::shared_ptr< Mantid::API::IAlgorithm > &alg, QWidget *parent=nullptr, bool forScript=false, const QHash< QString, QString > &presetValues=(QHash< QString, QString >()), const QString &optional_msg=QString(), const QStringList &enabled=QStringList(), const QStringList &disabled=QStringList())
Create a new instance of the correct type of AlgorithmDialog.
void showFitFunctionHelp(const QString &name=QString())
AlgorithmDialog * createDialogFromName(const QString &algorithmName, const int version=-1, QWidget *parent=nullptr, bool forScript=false, const QHash< QString, QString > &presetValues=(QHash< QString, QString >()), const QString &optionalMsg=QString(), const QStringList &enabled=QStringList(), const QStringList &disabled=QStringList())
Create an algorithm dialog for a given name and version.
UserSubWindow * createSubWindow(const QString &interface_name, QWidget *parent=nullptr, bool isWindow=true)
Create a new instance of the correct type of UserSubWindow.
InterfaceManager()
Constructor.
void showCustomInterfaceHelp(const QString &name, const QString &area=QString(), const QString §ion=QString())
void showConceptHelp(const QString &name)
static Mantid::Kernel::AbstractInstantiator< MantidHelpInterface > * m_helpViewer
Handle to the help window factory.
QStringList getUserSubWindowKeys() const
The keys associated with UserSubWindow classes.
void showWebPage(const QString &url)
void showAlgorithmHelp(const QString &name, const int version=-1)
MantidHelpInterface * createHelpWindow() const
Function that instantiates the help window.
void showWikiPage(const QString &page=QString())
static void registerHelpWindowFactory(Mantid::Kernel::AbstractInstantiator< MantidHelpInterface > *factory)
Registration function for the help window factory.
void showHelpPage(const QString &url=QString())
virtual ~InterfaceManager()
Destructor.
void notifyExistingInterfaces(UserSubWindow *newWindow)
Notifies the existing interfaces that a new interface has been created, and then notifies the new int...
static bool openUrl(const QUrl &url)
Opens a url in the appropriate web browser.
This is the base class all customised user interfaces that do not wish to be tied to a specific Manti...
void setInterfaceName(const QString &iface_name)
Set the interface name, made public so possible from Python.
virtual void otherUserSubWindowCreated(QPointer< UserSubWindow > window)
To be overridden in order to connect a signal between two interfaces.
void initializeLayout()
Create the layout of the widget. Can only be called once.
The base class for instantiators.
Exception for when an item is not found in a collection.
The Logger class is in charge of the publishing messages from the framework through various channels.
void debug(const std::string &msg)
Logs at debug level.
void error(const std::string &msg)
Logs at error level.
void information(const std::string &msg)
Logs at information level.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
EXPORT_OPT_MANTIDQT_COMMON int loadPluginsFromCfgPath(const std::string &key)
Load plugins from a path given by the key in the config service.
Kernel::Logger g_log("ExperimentInfo")
static logger object