Skip to content

Commit

Permalink
__repr__ for browser items
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 31, 2021
1 parent ca54e8f commit 63c4f4f
Show file tree
Hide file tree
Showing 20 changed files with 166 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/core/auto_generated/browser/qgsconnectionsitem.sip.in
Expand Up @@ -35,6 +35,12 @@ The optional ``providerKey`` string can be used to specify the key for the :py:c
%End

~QgsConnectionsRootItem();

SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsConnectionsRootItem: \"%1\" %2>" ).arg( sipCpp->name(), sipCpp->path() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End
};


Expand Down
Expand Up @@ -36,6 +36,12 @@ The optional ``providerKey`` string can be used to specify the key for the :py:c

~QgsDatabaseSchemaItem();

SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsDatabaseSchemaItem: \"%1\" %2>" ).arg( sipCpp->name(), sipCpp->path() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End

virtual QgsAbstractDatabaseProviderConnection *databaseConnection() const;


Expand Down
Expand Up @@ -34,6 +34,12 @@ The optional ``providerKey`` string can be used to specify the key for the :py:c

~QgsDataCollectionItem();

SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsDataCollectionItem: \"%1\" %2>" ).arg( sipCpp->name(), sipCpp->path() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End

void addChild( QgsDataItem *item /Transfer/ );

static QIcon iconDir( const QColor &fillColor = QColor(), const QColor &strokeColor = QColor() );
Expand Down
12 changes: 12 additions & 0 deletions python/core/auto_generated/browser/qgsdataitem.sip.in
Expand Up @@ -63,6 +63,12 @@ The optional ``providerKey`` string (added in QGIS 3.12) can be used to specify

~QgsDataItem();

SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsDataItem: \"%1\" %2>" ).arg( sipCpp->name(), sipCpp->path() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End

bool hasChildren();

virtual bool layerCollection() const;
Expand Down Expand Up @@ -509,6 +515,12 @@ Data item that can be used to report problems (e.g. network error)

QgsErrorItem( QgsDataItem *parent, const QString &error, const QString &path );

SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsErrorItem: \"%1\" %2>" ).arg( sipCpp->name(), sipCpp->path() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End

};


Expand Down
5 changes: 5 additions & 0 deletions python/core/auto_generated/browser/qgsdirectoryitem.sip.in
Expand Up @@ -52,6 +52,11 @@ items pointing to different ``dirPaths`` should always use a different item ``pa
The optional ``providerKey`` string can be used to specify the key for the :py:class:`QgsDataItemProvider` that created this item.
%End

SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsDirectoryItem: %1 - %2>" ).arg( sipCpp->dirPath(), sipCpp->path() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End
virtual void setState( Qgis::BrowserItemState state );


Expand Down
6 changes: 6 additions & 0 deletions python/core/auto_generated/browser/qgsfavoritesitem.sip.in
Expand Up @@ -28,6 +28,12 @@ Constructor for QgsFavoritesItem. Accepts a path argument specifying the file pa
the item.
%End

SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsFavoritesItem: \"%1\">" ).arg( sipCpp->name() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End

virtual QVector<QgsDataItem *> createChildren();


Expand Down
12 changes: 12 additions & 0 deletions python/core/auto_generated/browser/qgsfieldsitem.sip.in
Expand Up @@ -42,6 +42,12 @@ The ``schema`` and ``tableName`` are used to retrieve the layer and field inform

~QgsFieldsItem();

SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsFieldsItem: %1>" ).arg( sipCpp->path() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End

virtual QVector<QgsDataItem *> createChildren();


Expand Down Expand Up @@ -105,6 +111,12 @@ Constructor for QgsFieldItem, with the specified ``parent`` item and ``field``.

~QgsFieldItem();

SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsFieldItem: %1>" ).arg( sipCpp->name() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End

virtual QIcon icon();


Expand Down
6 changes: 6 additions & 0 deletions python/core/auto_generated/browser/qgslayeritem.sip.in
Expand Up @@ -24,6 +24,12 @@ Item that represents a layer that can be opened with one of the providers
Constructor for QgsLayerItem.
%End

SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsLayerItem: \"%1\" %2>" ).arg( sipCpp->name(), sipCpp->path() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End


virtual bool equal( const QgsDataItem *other );

Expand Down
6 changes: 6 additions & 0 deletions python/core/auto_generated/browser/qgsprojectitem.sip.in
Expand Up @@ -29,6 +29,12 @@ A data item holding a reference to a QGIS project file.
:param providerKey: key of the provider that created this item
%End

SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsProjectItem: \"%1\" %2>" ).arg( sipCpp->name(), sipCpp->path() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End

virtual bool hasDragEnabled() const;

virtual QgsMimeDataUtils::UriList mimeUris() const;
Expand Down
6 changes: 6 additions & 0 deletions python/core/auto_generated/browser/qgszipitem.sip.in
Expand Up @@ -30,6 +30,12 @@ Constructor
Constructor
%End

SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsZipItem: \"%1\" %2>" ).arg( sipCpp->name(), sipCpp->path() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End

virtual QVector<QgsDataItem *> createChildren();

QStringList getZipFileList();
Expand Down
8 changes: 8 additions & 0 deletions src/core/browser/qgsconnectionsitem.h
Expand Up @@ -45,6 +45,14 @@ class CORE_EXPORT QgsConnectionsRootItem : public QgsDataCollectionItem
QgsConnectionsRootItem( QgsDataItem *parent SIP_TRANSFERTHIS, const QString &name, const QString &path = QString(), const QString &providerKey = QString() );

~QgsConnectionsRootItem() override = default;

#ifdef SIP_RUN
SIP_PYOBJECT __repr__();
% MethodCode
QString str = QStringLiteral( "<QgsConnectionsRootItem: \"%1\" %2>" ).arg( sipCpp->name(), sipCpp->path() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
% End
#endif
};

#endif // QGSCONNECTIONSITEM_H
Expand Down
8 changes: 8 additions & 0 deletions src/core/browser/qgsdatabaseschemaitem.h
Expand Up @@ -46,6 +46,14 @@ class CORE_EXPORT QgsDatabaseSchemaItem : public QgsDataCollectionItem

~QgsDatabaseSchemaItem() override;

#ifdef SIP_RUN
SIP_PYOBJECT __repr__();
% MethodCode
QString str = QStringLiteral( "<QgsDatabaseSchemaItem: \"%1\" %2>" ).arg( sipCpp->name(), sipCpp->path() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
% End
#endif

QgsAbstractDatabaseProviderConnection *databaseConnection() const override;

/**
Expand Down
8 changes: 8 additions & 0 deletions src/core/browser/qgsdatacollectionitem.h
Expand Up @@ -45,6 +45,14 @@ class CORE_EXPORT QgsDataCollectionItem : public QgsDataItem

~QgsDataCollectionItem() override;

#ifdef SIP_RUN
SIP_PYOBJECT __repr__();
% MethodCode
QString str = QStringLiteral( "<QgsDataCollectionItem: \"%1\" %2>" ).arg( sipCpp->name(), sipCpp->path() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
% End
#endif

void addChild( QgsDataItem *item SIP_TRANSFER ) { mChildren.append( item ); }

/**
Expand Down
16 changes: 16 additions & 0 deletions src/core/browser/qgsdataitem.h
Expand Up @@ -93,6 +93,14 @@ class CORE_EXPORT QgsDataItem : public QObject

~QgsDataItem() override;

#ifdef SIP_RUN
SIP_PYOBJECT __repr__();
% MethodCode
QString str = QStringLiteral( "<QgsDataItem: \"%1\" %2>" ).arg( sipCpp->name(), sipCpp->path() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
% End
#endif

bool hasChildren();

/**
Expand Down Expand Up @@ -528,6 +536,14 @@ class CORE_EXPORT QgsErrorItem : public QgsDataItem

QgsErrorItem( QgsDataItem *parent, const QString &error, const QString &path );

#ifdef SIP_RUN
SIP_PYOBJECT __repr__();
% MethodCode
QString str = QStringLiteral( "<QgsErrorItem: \"%1\" %2>" ).arg( sipCpp->name(), sipCpp->path() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
% End
#endif

};

#endif // QGSDATAITEM_H
Expand Down
7 changes: 7 additions & 0 deletions src/core/browser/qgsdirectoryitem.h
Expand Up @@ -69,6 +69,13 @@ class CORE_EXPORT QgsDirectoryItem : public QgsDataCollectionItem
*/
QgsDirectoryItem( QgsDataItem *parent SIP_TRANSFERTHIS, const QString &name, const QString &dirPath, const QString &path, const QString &providerKey = QString() );

#ifdef SIP_RUN
SIP_PYOBJECT __repr__();
% MethodCode
QString str = QStringLiteral( "<QgsDirectoryItem: %1 - %2>" ).arg( sipCpp->dirPath(), sipCpp->path() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
% End
#endif
void setState( Qgis::BrowserItemState state ) override;

QVector<QgsDataItem *> createChildren() override;
Expand Down
8 changes: 8 additions & 0 deletions src/core/browser/qgsfavoritesitem.h
Expand Up @@ -40,6 +40,14 @@ class CORE_EXPORT QgsFavoritesItem : public QgsDataCollectionItem
*/
QgsFavoritesItem( QgsDataItem *parent, const QString &name, const QString &path = QString() );

#ifdef SIP_RUN
SIP_PYOBJECT __repr__();
% MethodCode
QString str = QStringLiteral( "<QgsFavoritesItem: \"%1\">" ).arg( sipCpp->name() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
% End
#endif

QVector<QgsDataItem *> createChildren() override;

/**
Expand Down
16 changes: 16 additions & 0 deletions src/core/browser/qgsfieldsitem.h
Expand Up @@ -55,6 +55,14 @@ class CORE_EXPORT QgsFieldsItem : public QgsDataItem

~QgsFieldsItem() override;

#ifdef SIP_RUN
SIP_PYOBJECT __repr__();
% MethodCode
QString str = QStringLiteral( "<QgsFieldsItem: %1>" ).arg( sipCpp->path() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
% End
#endif

QVector<QgsDataItem *> createChildren() override;

QIcon icon() override;
Expand Down Expand Up @@ -116,6 +124,14 @@ class CORE_EXPORT QgsFieldItem : public QgsDataItem

~QgsFieldItem() override;

#ifdef SIP_RUN
SIP_PYOBJECT __repr__();
% MethodCode
QString str = QStringLiteral( "<QgsFieldItem: %1>" ).arg( sipCpp->name() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
% End
#endif

QIcon icon() override;

//QgsField field() const;
Expand Down
8 changes: 8 additions & 0 deletions src/core/browser/qgslayeritem.h
Expand Up @@ -37,6 +37,14 @@ class CORE_EXPORT QgsLayerItem : public QgsDataItem
*/
QgsLayerItem( QgsDataItem *parent, const QString &name, const QString &path, const QString &uri, Qgis::BrowserLayerType layerType, const QString &providerKey );

#ifdef SIP_RUN
SIP_PYOBJECT __repr__();
% MethodCode
QString str = QStringLiteral( "<QgsLayerItem: \"%1\" %2>" ).arg( sipCpp->name(), sipCpp->path() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
% End
#endif

// --- reimplemented from QgsDataItem ---

bool equal( const QgsDataItem *other ) override;
Expand Down
8 changes: 8 additions & 0 deletions src/core/browser/qgsprojectitem.h
Expand Up @@ -39,6 +39,14 @@ class CORE_EXPORT QgsProjectItem : public QgsDataItem
*/
QgsProjectItem( QgsDataItem *parent, const QString &name, const QString &path, const QString &providerKey = QString() );

#ifdef SIP_RUN
SIP_PYOBJECT __repr__();
% MethodCode
QString str = QStringLiteral( "<QgsProjectItem: \"%1\" %2>" ).arg( sipCpp->name(), sipCpp->path() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
% End
#endif

bool hasDragEnabled() const override { return true; }

QgsMimeDataUtils::UriList mimeUris() const override;
Expand Down
8 changes: 8 additions & 0 deletions src/core/browser/qgszipitem.h
Expand Up @@ -42,6 +42,14 @@ class CORE_EXPORT QgsZipItem : public QgsDataCollectionItem
//! Constructor
QgsZipItem( QgsDataItem *parent, const QString &name, const QString &filePath, const QString &path, const QString &providerKey = QString() );

#ifdef SIP_RUN
SIP_PYOBJECT __repr__();
% MethodCode
QString str = QStringLiteral( "<QgsZipItem: \"%1\" %2>" ).arg( sipCpp->name(), sipCpp->path() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
% End
#endif

QVector<QgsDataItem *> createChildren() override;
QStringList getZipFileList();

Expand Down

0 comments on commit 63c4f4f

Please sign in to comment.