Mantid
|
ScriptRepositoryView : Provide the User Interface to the ScriptRepository. More...
#include <ScriptRepositoryView.h>
Classes | |
class | CheckBoxDelegate |
Delegate to show the checkbox for configuring the auto update. More... | |
class | RemoveEntryDelegate |
Delegate to show the icon to remove the entry from the local and central repository. More... | |
class | RepoDelegate |
Delegate to show the icons Download and Upload. More... | |
Signals | |
void | loadScript (const QString) |
Signals inherited from MantidQt::API::MantidDialog | |
void | runAsPythonScript (const QString &code, bool) |
Public Member Functions | |
ScriptRepositoryView (QWidget *parent=nullptr) | |
Creates the widget for the ScriptRepositoryView. More... | |
~ScriptRepositoryView () override | |
Destructor. More... | |
Public Member Functions inherited from MantidQt::API::MantidDialog | |
MantidDialog (QWidget *parent=nullptr, const Qt::WindowFlags &flags=Qt::WindowCloseButtonHint|Qt::WindowType::WindowTitleHint) | |
DefaultConstructor. More... | |
~MantidDialog () override | |
Destructor. More... | |
Protected Slots | |
void | cell_activated (const QModelIndex &) |
Allows the user to open a file to investigate it. More... | |
void | currentChanged (const QModelIndex ¤t) |
This method will be executed every time the user change the selection. More... | |
void | helpClicked () |
Open the ScriptRepository Page on Web Browser. More... | |
void | openFolderLink (const QString &) |
Attempt to open the given folder link using an appropriate application. More... | |
void | updateModel () |
This method refreshes the ScriptRepository and allows it to check list the files again. More... | |
Private Attributes | |
RepoModel * | model |
Ui::ScriptRepositoryView * | ui |
Additional Inherited Members | |
Static Public Member Functions inherited from MantidQt::API::MantidDialog | |
static bool | handle (QObject *receiver, const std::exception &e) |
Handles the exception caught in an event handler. More... | |
Protected Member Functions inherited from MantidQt::API::MantidDialog | |
virtual void | handleException (const std::exception &e) |
Override this method to handle an exception in a derived class. More... | |
QString | runPythonCode (const QString &code, bool no_output=false) |
Run python code that is passed to it and, optionally, return anything it wrote to standard output as a string. More... | |
ScriptRepositoryView : Provide the User Interface to the ScriptRepository.
It does so through the Mantid Model View Framework. It is composed by a specialized QTreeView (RepoTreeView) and a TextBrowser. The TreeView is populated with the RepoModel, wich wrappers the ScriptRepository. Inside this class, there are two nested classes that will implement delegates to the columns of Status and AutoUpdate in order to improve the User Experience.
Definition at line 25 of file ScriptRepositoryView.h.
MantidQt::API::ScriptRepositoryView::ScriptRepositoryView | ( | QWidget * | parent = nullptr | ) |
Creates the widget for the ScriptRepositoryView.
Before constructing the widget, it must ensure that the ScriptRepository was installed before.
If it has not been installed, them, it will first try to install it. If it fails to install, them, it will not be able to create the widget, and it will fail gracelly.
In normal condition, it will create the widget (Ui::ScriptRepositoryView) and populate it with the RepoModel, and define the delegates ScriptRepositoryView::RepoDelegate and ScriptRepositoryView::CheckBoxDelegate and ScriptRepositoryView::RemoveEntryDelegate.
Definition at line 91 of file ScriptRepositoryView.cpp.
References cell_activated(), count, currentChanged(), MantidQt::API::dir_not_empty_label, Mantid::Kernel::Logger::error(), helpClicked(), Mantid::Kernel::Logger::information(), MantidQt::API::install_mantid_label, model, openFolderLink(), ui, updateModel(), and Mantid::Kernel::Logger::warning().
|
override |
|
protectedslot |
Allows the user to open a file to investigate it.
If the user selects and activate one Row, double-clicking on the first column, it will try to retrieve the file path (if it is local) and emit the signal loadScript. MantidPlot will get this signal to load the file and show its contents to the user.
Definition at line 233 of file ScriptRepositoryView.cpp.
References MantidQt::API::RepoModel::filePath(), loadScript(), and ui.
Referenced by ScriptRepositoryView().
|
protectedslot |
This method will be executed every time the user change the selection.
It allows to update all the entries that are related to the current selection. Currently, the description field will be updated.
Definition at line 252 of file ScriptRepositoryView.cpp.
References MantidQt::API::RepoModel::author(), MantidQt::API::RepoModel::fileDescription(), and ui.
Referenced by ScriptRepositoryView().
|
protectedslot |
Open the ScriptRepository Page on Web Browser.
Definition at line 269 of file ScriptRepositoryView.cpp.
References MantidQt::API::MantidDesktopServices::openUrl().
Referenced by ScriptRepositoryView().
|
signal |
Referenced by cell_activated().
|
protectedslot |
Attempt to open the given folder link using an appropriate application.
link | :: the folder link to open. |
Definition at line 582 of file ScriptRepositoryView.cpp.
References Mantid::Kernel::Logger::error(), and MantidQt::API::MantidDesktopServices::openUrl().
Referenced by ScriptRepositoryView().
|
protectedslot |
This method refreshes the ScriptRepository and allows it to check list the files again.
It will also check for new files and folders. It is easier to just recreate RepoModel than figuring out the entries that were inserted or deleted from the ScriptRepository. This method could be rewritten in order to be more efficient.
Definition at line 214 of file ScriptRepositoryView.cpp.
Referenced by ScriptRepositoryView().
|
private |
Definition at line 78 of file ScriptRepositoryView.h.
Referenced by MantidQt::API::ScriptRepositoryView::RepoDelegate::editorEvent(), MantidQt::API::ScriptRepositoryView::CheckBoxDelegate::editorEvent(), MantidQt::API::ScriptRepositoryView::RemoveEntryDelegate::editorEvent(), ScriptRepositoryView(), and updateModel().
|
private |
Definition at line 77 of file ScriptRepositoryView.h.
Referenced by cell_activated(), currentChanged(), ScriptRepositoryView(), updateModel(), and ~ScriptRepositoryView().