Skip to content
Permalink
Browse files
__repr__ for browser items
  • Loading branch information
nyalldawson committed May 31, 2021
1 parent ca54e8f commit 63c4f4fe7f229441e569cb3d229a9566ed80dfc8
@@ -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
};


@@ -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;


@@ -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() );
@@ -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;
@@ -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

};


@@ -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 );


@@ -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();


@@ -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();


@@ -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();


@@ -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 );

@@ -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;
@@ -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();
@@ -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
@@ -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;

/**
@@ -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 ); }

/**
@@ -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();

/**
@@ -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
@@ -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;
@@ -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;

/**
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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();

0 comments on commit 63c4f4f

Please sign in to comment.