Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow adding Processing tools to Favorites #57956

Merged
merged 7 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion python/PyQt6/gui/auto_additions/qgsprocessingtoolboxmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
QgsProcessingToolboxModelNode.NodeType.NodeRecent = QgsProcessingToolboxModelNode.NodeType.Recent
QgsProcessingToolboxModelNode.NodeRecent.is_monkey_patched = True
QgsProcessingToolboxModelNode.NodeRecent.__doc__ = "Recent algorithms node"
QgsProcessingToolboxModelNode.NodeType.__doc__ = "Enumeration of possible model node types\n\n" + '* ``NodeProvider``: ' + QgsProcessingToolboxModelNode.NodeType.Provider.__doc__ + '\n' + '* ``NodeGroup``: ' + QgsProcessingToolboxModelNode.NodeType.Group.__doc__ + '\n' + '* ``NodeAlgorithm``: ' + QgsProcessingToolboxModelNode.NodeType.Algorithm.__doc__ + '\n' + '* ``NodeRecent``: ' + QgsProcessingToolboxModelNode.NodeType.Recent.__doc__
QgsProcessingToolboxModelNode.NodeFavorite = QgsProcessingToolboxModelNode.NodeType.Favorite
QgsProcessingToolboxModelNode.NodeType.NodeFavorite = QgsProcessingToolboxModelNode.NodeType.Favorite
QgsProcessingToolboxModelNode.NodeFavorite.is_monkey_patched = True
QgsProcessingToolboxModelNode.NodeFavorite.__doc__ = "Favorites algorithms node, since QGIS 3.40"
QgsProcessingToolboxModelNode.NodeType.__doc__ = "Enumeration of possible model node types\n\n" + '* ``NodeProvider``: ' + QgsProcessingToolboxModelNode.NodeType.Provider.__doc__ + '\n' + '* ``NodeGroup``: ' + QgsProcessingToolboxModelNode.NodeType.Group.__doc__ + '\n' + '* ``NodeAlgorithm``: ' + QgsProcessingToolboxModelNode.NodeType.Algorithm.__doc__ + '\n' + '* ``NodeRecent``: ' + QgsProcessingToolboxModelNode.NodeType.Recent.__doc__ + '\n' + '* ``NodeFavorite``: ' + QgsProcessingToolboxModelNode.NodeType.Favorite.__doc__
# --
QgsProcessingToolboxModelNode.NodeType.baseClass = QgsProcessingToolboxModelNode
QgsProcessingToolboxModel.Roles = QgsProcessingToolboxModel.CustomRole
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/processing/qgsprocessingfavoritealgorithmlog.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/





class QgsProcessingFavoriteAlgorithmLog : QObject
{
%Docstring(signature="appended")
A log for tracking favorite Processing algorithms.

:py:class:`QgsProcessingFavoriteAlgorithmLog` is not usually directly created, instead
use the instance accessible through :py:func:`QgsGui.processingFavoriteAlgorithmLog()`.

The log contents are saved and restored via :py:class:`QgsSettings`.

.. note::

Not stable API

.. versionadded:: 3.40
%End

%TypeHeaderCode
#include "qgsprocessingfavoritealgorithmlog.h"
%End
public:

QgsProcessingFavoriteAlgorithmLog( QObject *parent = 0 );
%Docstring
Constructor for QgsProcessingFavoriteAlgorithmLog, with the specified
``parent`` object.
%End

QStringList favoriteAlgorithmIds() const;
%Docstring
Returns a list of the IDs of favorite Processing algorithms.
%End

void add( const QString &id );
%Docstring
Adds the algorithm with matching ``id`` to the favorite algorithms list.

If this changes the list of favorite algorithm IDs then the :py:func:`~QgsProcessingFavoriteAlgorithmLog.changed` signal
will be emitted.
%End

void remove( const QString &id );
%Docstring
Removes the algorithm with matching ``id`` from the favorite algorithms list.

If this changes the list of favorite algorithm IDs then the :py:func:`~QgsProcessingFavoriteAlgorithmLog.changed` signal
will be emitted.
%End

void clear();
%Docstring
Clears list of favorite Processing algorithms
%End

bool isFavorite( const QString &id );
%Docstring
Returns ``True`` if the algorithm with matching ``id`` is in a favorite list.
%End


signals:

void changed();
%Docstring
Emitted when the list of favorite algorithms is changed, e.g. when
a new algorithm ID is added to the list or an existing algorithm ID
is removed from the list.
%End

};


/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/processing/qgsprocessingfavoritealgorithmlog.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ Abstract base class for nodes contained within a :py:class:`QgsProcessingToolbox
sipType = sipType_QgsProcessingToolboxModelAlgorithmNode;
else if ( node->nodeType() == QgsProcessingToolboxModelNode::NodeType::Recent )
sipType = sipType_QgsProcessingToolboxModelRecentNode;
else if ( node->nodeType() == QgsProcessingToolboxModelNode::NodeType::Favorite )
sipType = sipType_QgsProcessingToolboxModelFavoriteNode;
}
else
sipType = 0;
Expand All @@ -51,6 +53,7 @@ Abstract base class for nodes contained within a :py:class:`QgsProcessingToolbox
Group,
Algorithm,
Recent,
Favorite,
};

~QgsProcessingToolboxModelNode();
Expand Down Expand Up @@ -123,6 +126,32 @@ Constructor for QgsProcessingToolboxModelRecentNode.

};

class QgsProcessingToolboxModelFavoriteNode : QgsProcessingToolboxModelNode
{
%Docstring(signature="appended")
Processing toolbox model node corresponding to the favorite algorithms group

.. warning::

Not part of stable API and may change in future QGIS releases.

.. versionadded:: 3.40
%End

%TypeHeaderCode
#include "qgsprocessingtoolboxmodel.h"
%End
public:

QgsProcessingToolboxModelFavoriteNode();
%Docstring
Constructor for :py:class:`QgsProcessingToolboxModelRecentNode`.
%End

virtual NodeType nodeType() const;

};

class QgsProcessingToolboxModelProviderNode : QgsProcessingToolboxModelNode
{
%Docstring(signature="appended")
Expand Down Expand Up @@ -262,7 +291,8 @@ of this model.
};

QgsProcessingToolboxModel( QObject *parent /TransferThis/ = 0, QgsProcessingRegistry *registry = 0,
QgsProcessingRecentAlgorithmLog *recentLog = 0 );
QgsProcessingRecentAlgorithmLog *recentLog = 0,
QgsProcessingFavoriteAlgorithmLog *favoriteLog = 0 );
%Docstring
Constructor for QgsProcessingToolboxModel, with the given ``parent`` object.

Expand All @@ -273,6 +303,9 @@ by the model.

If ``recentLog`` is specified then it will be used to create a "Recently used" top
level group containing recently used algorithms.

If ``favoriteLog`` is specified then it will be used to create a "Favorites" top
level group containing favorite algorithms. Since QGIS 3.40
%End

virtual Qt::ItemFlags flags( const QModelIndex &index ) const;
Expand Down Expand Up @@ -358,6 +391,11 @@ Returns the index corresponding to the parent of a given node.
void recentAlgorithmAdded();
%Docstring
Emitted whenever recent algorithms are added to the model.
%End

void favoriteAlgorithmAdded();
%Docstring
Emitted whenever favorite algorithms are added to the model.
%End

};
Expand Down Expand Up @@ -391,7 +429,8 @@ the results.

explicit QgsProcessingToolboxProxyModel( QObject *parent /TransferThis/ = 0,
QgsProcessingRegistry *registry = 0,
QgsProcessingRecentAlgorithmLog *recentLog = 0 );
QgsProcessingRecentAlgorithmLog *recentLog = 0,
QgsProcessingFavoriteAlgorithmLog *favoriteLog = 0 );
%Docstring
Constructor for QgsProcessingToolboxProxyModel, with the given ``parent`` object.

Expand All @@ -402,6 +441,9 @@ by the model.

If ``recentLog`` is specified then it will be used to create a "Recently used" top
level group containing recently used algorithms.

If ``favoriteLog`` is specified then it will be used to create a "Favorites" top
level group containing favorite algorithms. SInce QGIS 3.40
%End

QgsProcessingToolboxModel *toolboxModel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ Processing toolbox tree view, showing algorithms and providers in a tree structu

QgsProcessingToolboxTreeView( QWidget *parent /TransferThis/ = 0,
QgsProcessingRegistry *registry = 0,
QgsProcessingRecentAlgorithmLog *recentLog = 0 );
QgsProcessingRecentAlgorithmLog *recentLog = 0,
QgsProcessingFavoriteAlgorithmLog *favoriteLog = 0 );
%Docstring
Constructor for QgsProcessingToolboxTreeView, with the specified ``parent`` widget.

Expand All @@ -39,16 +40,23 @@ to associate a registry with the view.

If ``recentLog`` is specified then it will be used to create a "Recently used" top
level group containing recently used algorithms.

If ``favoriteLog`` is specified then it will be used to create a "Favorites" top
level group containing favorite algorithms. Since QGIS 3.40
%End

void setRegistry(
QgsProcessingRegistry *registry,
QgsProcessingRecentAlgorithmLog *recentLog = 0 );
QgsProcessingRecentAlgorithmLog *recentLog = 0,
QgsProcessingFavoriteAlgorithmLog *favoriteLog = 0 );
%Docstring
Sets the processing ``registry`` associated with the view.

If ``recentLog`` is specified then it will be used to create a "Recently used" top
level group containing recently used algorithms.

If ``favoriteLog`` is specified then it will be used to create a "Favorites" top
level group containing favorite algorithms. Since QGIS 3.40
%End

void setToolboxProxyModel( QgsProcessingToolboxProxyModel *model /Transfer/ );
Expand Down
7 changes: 7 additions & 0 deletions python/PyQt6/gui/auto_generated/qgsgui.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ Returns the global code editor color scheme registry, used for registering the c
Returns the global processing recent algorithm log, used for tracking recently used processing algorithms.

.. versionadded:: 3.4
%End

static QgsProcessingFavoriteAlgorithmLog *processingFavoriteAlgorithmLog();
%Docstring
Returns the global Processing favorite algorithm log, used for tracking favorite Processing algorithms.

.. versionadded:: 3.40
%End

static QgsDataItemGuiProviderRegistry *dataItemGuiProviderRegistry() /KeepReference/;
Expand Down
1 change: 1 addition & 0 deletions python/PyQt6/gui/gui_auto.sip
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@
%Include auto_generated/processing/qgsprocessingalgorithmconfigurationwidget.sip
%Include auto_generated/processing/qgsprocessingalgorithmdialogbase.sip
%Include auto_generated/processing/qgsprocessingbatchalgorithmdialogbase.sip
%Include auto_generated/processing/qgsprocessingfavoritealgorithmlog.sip
%Include auto_generated/processing/qgsprocessinggui.sip
%Include auto_generated/processing/qgsprocessingguiregistry.sip
%Include auto_generated/processing/qgsprocessinghistoryprovider.sip
Expand Down
6 changes: 5 additions & 1 deletion python/gui/auto_additions/qgsprocessingtoolboxmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
QgsProcessingToolboxModelNode.NodeType.NodeRecent = QgsProcessingToolboxModelNode.NodeType.Recent
QgsProcessingToolboxModelNode.NodeRecent.is_monkey_patched = True
QgsProcessingToolboxModelNode.NodeRecent.__doc__ = "Recent algorithms node"
QgsProcessingToolboxModelNode.NodeType.__doc__ = "Enumeration of possible model node types\n\n" + '* ``NodeProvider``: ' + QgsProcessingToolboxModelNode.NodeType.Provider.__doc__ + '\n' + '* ``NodeGroup``: ' + QgsProcessingToolboxModelNode.NodeType.Group.__doc__ + '\n' + '* ``NodeAlgorithm``: ' + QgsProcessingToolboxModelNode.NodeType.Algorithm.__doc__ + '\n' + '* ``NodeRecent``: ' + QgsProcessingToolboxModelNode.NodeType.Recent.__doc__
QgsProcessingToolboxModelNode.NodeFavorite = QgsProcessingToolboxModelNode.NodeType.Favorite
QgsProcessingToolboxModelNode.NodeType.NodeFavorite = QgsProcessingToolboxModelNode.NodeType.Favorite
QgsProcessingToolboxModelNode.NodeFavorite.is_monkey_patched = True
QgsProcessingToolboxModelNode.NodeFavorite.__doc__ = "Favorites algorithms node, since QGIS 3.40"
QgsProcessingToolboxModelNode.NodeType.__doc__ = "Enumeration of possible model node types\n\n" + '* ``NodeProvider``: ' + QgsProcessingToolboxModelNode.NodeType.Provider.__doc__ + '\n' + '* ``NodeGroup``: ' + QgsProcessingToolboxModelNode.NodeType.Group.__doc__ + '\n' + '* ``NodeAlgorithm``: ' + QgsProcessingToolboxModelNode.NodeType.Algorithm.__doc__ + '\n' + '* ``NodeRecent``: ' + QgsProcessingToolboxModelNode.NodeType.Recent.__doc__ + '\n' + '* ``NodeFavorite``: ' + QgsProcessingToolboxModelNode.NodeType.Favorite.__doc__
# --
QgsProcessingToolboxModelNode.NodeType.baseClass = QgsProcessingToolboxModelNode
QgsProcessingToolboxModel.Roles = QgsProcessingToolboxModel.CustomRole
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/processing/qgsprocessingfavoritealgorithmlog.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/





class QgsProcessingFavoriteAlgorithmLog : QObject
{
%Docstring(signature="appended")
A log for tracking favorite Processing algorithms.

:py:class:`QgsProcessingFavoriteAlgorithmLog` is not usually directly created, instead
use the instance accessible through :py:func:`QgsGui.processingFavoriteAlgorithmLog()`.

The log contents are saved and restored via :py:class:`QgsSettings`.

.. note::

Not stable API

.. versionadded:: 3.40
%End

%TypeHeaderCode
#include "qgsprocessingfavoritealgorithmlog.h"
%End
public:

QgsProcessingFavoriteAlgorithmLog( QObject *parent = 0 );
%Docstring
Constructor for QgsProcessingFavoriteAlgorithmLog, with the specified
``parent`` object.
%End

QStringList favoriteAlgorithmIds() const;
%Docstring
Returns a list of the IDs of favorite Processing algorithms.
%End

void add( const QString &id );
%Docstring
Adds the algorithm with matching ``id`` to the favorite algorithms list.

If this changes the list of favorite algorithm IDs then the :py:func:`~QgsProcessingFavoriteAlgorithmLog.changed` signal
will be emitted.
%End

void remove( const QString &id );
%Docstring
Removes the algorithm with matching ``id`` from the favorite algorithms list.

If this changes the list of favorite algorithm IDs then the :py:func:`~QgsProcessingFavoriteAlgorithmLog.changed` signal
will be emitted.
%End

void clear();
%Docstring
Clears list of favorite Processing algorithms
%End

bool isFavorite( const QString &id );
%Docstring
Returns ``True`` if the algorithm with matching ``id`` is in a favorite list.
%End


signals:

void changed();
%Docstring
Emitted when the list of favorite algorithms is changed, e.g. when
a new algorithm ID is added to the list or an existing algorithm ID
is removed from the list.
%End

};


/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/processing/qgsprocessingfavoritealgorithmlog.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
Loading
Loading