Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Slots | Protected Member Functions | List of all members
pqPythonMacroSupervisor Class Reference

#include <pqPythonMacroSupervisor.h>

Inherits QObject.

Public Slots

void addMacro (const QString &macroName, const QString &tip, const QString &fileName)
 Add an action with the given name and fileName. More...
 
void addMacro (const QString &macroName, const QString &fileName)
 
void addMacro (const QString &fileName)
 
void removeMacro (const QString &fileName)
 Remove an action from the UI, with the given fileName (absolute path of macro file). More...
 
void updateMacroList ()
 Update Macro list widgets and actions... More...
 

Signals

void executeScriptRequested (const QString &fileName)
 Emitted when a macro has been triggered. More...
 
void onAddedMacro ()
 Emitted when a macro has been added. More...
 
void onEditMacro (const QString &fileName)
 Emitted when a macro has to be edited. More...
 

Public Member Functions

 pqPythonMacroSupervisor (QObject *p=nullptr)
 
 ~pqPythonMacroSupervisor () override
 
void addWidgetForRunMacros (QWidget *widget)
 Add a widget to be given macro actions. More...
 
void addWidgetForEditMacros (QWidget *widget)
 Add a widget to be given macro actions. More...
 
void addWidgetForDeleteMacros (QWidget *widget)
 Add a widget to be given macro actions. More...
 
QAction * getMacro (const QString &fileName)
 Lookup and return a macro action by fileName (absolute path of macro file). More...
 

Static Public Member Functions

static QMap< QString, QString > getStoredMacros ()
 Get macros from known macro directories (see getMacrosFilePaths) In the returned map, the keys are fileNames and values are macro names. More...
 
static void hideFile (const QString &fileName)
 Hide file by prepending a `. More...
 
static QString macroNameFromFileName (const QString &fileName)
 Get a macro name from the fileName (absolute path of macro file). More...
 
static void setNameForMacro (const QString &macroPath, const QString &name)
 
static QString macroToolTipFromFileName (const QString &fileName)
 Get a macro tooltip from the fileName (absolute path of macro file). More...
 
static void setTooltipForMacro (const QString &macroPath, const QString &name)
 
static QString iconPathFromFileName (const QString &fileName)
 Get an icon path from the fileName (absolute path of macro file). More...
 
static void setIconForMacro (const QString &macroPath, const QString &iconPath)
 
static QStringList getMacrosFilePaths ()
 Get a list a "*.py" files from macro directories. More...
 

Protected Slots

void onMacroTriggered ()
 If the sender is a QAction managed by this class, the fileName will be looked up and the signal requestExecuteScript will be emitted. More...
 
void onDeleteMacroTriggered ()
 If the sender is a QAction managed by this class, the fileName will be moved (deleted), and the macro will be removed. More...
 
void onEditMacroTriggered ()
 If the sender is a QAction managed by this class, the macro file will be open in a python edit. More...
 

Protected Member Functions

void addWidgetForMacros (QWidget *widget, int actionType)
 Add a widget to be given macro actions. More...
 
void resetActions ()
 Removes all actions and re-adds actions for each macro stored. More...
 

Detailed Description

Definition at line 17 of file pqPythonMacroSupervisor.h.

Constructor & Destructor Documentation

◆ pqPythonMacroSupervisor()

pqPythonMacroSupervisor::pqPythonMacroSupervisor ( QObject *  p = nullptr)

◆ ~pqPythonMacroSupervisor()

pqPythonMacroSupervisor::~pqPythonMacroSupervisor ( )
override

Member Function Documentation

◆ addWidgetForRunMacros()

void pqPythonMacroSupervisor::addWidgetForRunMacros ( QWidget *  widget)

Add a widget to be given macro actions.

QActions representing script macros will be added to the widget. This could be a QToolBar, QMenu, or other type of widget.

◆ addWidgetForEditMacros()

void pqPythonMacroSupervisor::addWidgetForEditMacros ( QWidget *  widget)

Add a widget to be given macro actions.

QActions representing script macros will be added to the widget. This could be a QToolBar, QMenu, or other type of widget.

◆ addWidgetForDeleteMacros()

void pqPythonMacroSupervisor::addWidgetForDeleteMacros ( QWidget *  widget)

Add a widget to be given macro actions.

QActions representing script macros will be added to the widget. This could be a QToolBar, QMenu, or other type of widget.

◆ getMacro()

QAction* pqPythonMacroSupervisor::getMacro ( const QString &  fileName)

Lookup and return a macro action by fileName (absolute path of macro file).

If it does not exist, return null.

◆ getStoredMacros()

static QMap<QString, QString> pqPythonMacroSupervisor::getStoredMacros ( )
static

Get macros from known macro directories (see getMacrosFilePaths) In the returned map, the keys are fileNames and values are macro names.

◆ hideFile()

static void pqPythonMacroSupervisor::hideFile ( const QString &  fileName)
static

Hide file by prepending a `.

` to its name. Hidden file in macro directory are not loaded.

◆ macroNameFromFileName()

static QString pqPythonMacroSupervisor::macroNameFromFileName ( const QString &  fileName)
static

Get a macro name from the fileName (absolute path of macro file).

◆ setNameForMacro()

static void pqPythonMacroSupervisor::setNameForMacro ( const QString &  macroPath,
const QString &  name 
)
static

◆ macroToolTipFromFileName()

static QString pqPythonMacroSupervisor::macroToolTipFromFileName ( const QString &  fileName)
static

Get a macro tooltip from the fileName (absolute path of macro file).

◆ setTooltipForMacro()

static void pqPythonMacroSupervisor::setTooltipForMacro ( const QString &  macroPath,
const QString &  name 
)
static

◆ iconPathFromFileName()

static QString pqPythonMacroSupervisor::iconPathFromFileName ( const QString &  fileName)
static

Get an icon path from the fileName (absolute path of macro file).

If no corresponding icon, return an empty string.

◆ setIconForMacro()

static void pqPythonMacroSupervisor::setIconForMacro ( const QString &  macroPath,
const QString &  iconPath 
)
static

◆ getMacrosFilePaths()

static QStringList pqPythonMacroSupervisor::getMacrosFilePaths ( )
static

Get a list a "*.py" files from macro directories.

◆ executeScriptRequested

void pqPythonMacroSupervisor::executeScriptRequested ( const QString &  fileName)
signal

Emitted when a macro has been triggered.

◆ onAddedMacro

void pqPythonMacroSupervisor::onAddedMacro ( )
signal

Emitted when a macro has been added.

◆ onEditMacro

void pqPythonMacroSupervisor::onEditMacro ( const QString &  fileName)
signal

Emitted when a macro has to be edited.

◆ addMacro [1/3]

void pqPythonMacroSupervisor::addMacro ( const QString &  macroName,
const QString &  tip,
const QString &  fileName 
)
slot

Add an action with the given name and fileName.

If there is already a macro with the given fileName it's macroname will be updated to the one given. Macro names do not have to be unique.

◆ addMacro [2/3]

void pqPythonMacroSupervisor::addMacro ( const QString &  macroName,
const QString &  fileName 
)
slot

◆ addMacro [3/3]

void pqPythonMacroSupervisor::addMacro ( const QString &  fileName)
slot

◆ removeMacro

void pqPythonMacroSupervisor::removeMacro ( const QString &  fileName)
slot

Remove an action from the UI, with the given fileName (absolute path of macro file).

Note, this does not remove the macro from a future load, you must call hideFile yourself (or manually remove the file from the settings dir).

◆ updateMacroList

void pqPythonMacroSupervisor::updateMacroList ( )
slot

Update Macro list widgets and actions...

◆ onMacroTriggered

void pqPythonMacroSupervisor::onMacroTriggered ( )
protectedslot

If the sender is a QAction managed by this class, the fileName will be looked up and the signal requestExecuteScript will be emitted.

◆ onDeleteMacroTriggered

void pqPythonMacroSupervisor::onDeleteMacroTriggered ( )
protectedslot

If the sender is a QAction managed by this class, the fileName will be moved (deleted), and the macro will be removed.

◆ onEditMacroTriggered

void pqPythonMacroSupervisor::onEditMacroTriggered ( )
protectedslot

If the sender is a QAction managed by this class, the macro file will be open in a python edit.

◆ addWidgetForMacros()

void pqPythonMacroSupervisor::addWidgetForMacros ( QWidget *  widget,
int  actionType 
)
protected

Add a widget to be given macro actions.

QActions representing script macros will be added to the widget. This could be a QToolBar, QMenu, or other type of widget.

◆ resetActions()

void pqPythonMacroSupervisor::resetActions ( )
protected

Removes all actions and re-adds actions for each macro stored.


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