Mantid
Loading...
Searching...
No Matches
Classes | Signals | Public Member Functions | Protected Slots | Private Attributes | List of all members
MantidQt::API::ScriptRepositoryView Class Reference

ScriptRepositoryView : Provide the User Interface to the ScriptRepository. More...

#include <ScriptRepositoryView.h>

Inheritance diagram for MantidQt::API::ScriptRepositoryView:
MantidQt::API::MantidDialog

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 &current)
 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

RepoModelmodel
 
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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ScriptRepositoryView()

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().

◆ ~ScriptRepositoryView()

MantidQt::API::ScriptRepositoryView::~ScriptRepositoryView ( )
override

Destructor.

Definition at line 225 of file ScriptRepositoryView.cpp.

References ui.

Member Function Documentation

◆ cell_activated

void MantidQt::API::ScriptRepositoryView::cell_activated ( const QModelIndex &  in)
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().

◆ currentChanged

void MantidQt::API::ScriptRepositoryView::currentChanged ( const QModelIndex &  in)
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().

◆ helpClicked

void MantidQt::API::ScriptRepositoryView::helpClicked ( )
protectedslot

Open the ScriptRepository Page on Web Browser.

Definition at line 269 of file ScriptRepositoryView.cpp.

References MantidQt::API::MantidDesktopServices::openUrl().

Referenced by ScriptRepositoryView().

◆ loadScript

void MantidQt::API::ScriptRepositoryView::loadScript ( const  QString)
signal

Referenced by cell_activated().

◆ openFolderLink

void MantidQt::API::ScriptRepositoryView::openFolderLink ( const QString &  link)
protectedslot

Attempt to open the given folder link using an appropriate application.

Parameters
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().

◆ updateModel

void MantidQt::API::ScriptRepositoryView::updateModel ( )
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.

References model, and ui.

Referenced by ScriptRepositoryView().

Member Data Documentation

◆ model

RepoModel* MantidQt::API::ScriptRepositoryView::model
private

◆ ui

Ui::ScriptRepositoryView* MantidQt::API::ScriptRepositoryView::ui
private

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