Skip to content
Permalink
Browse files

- changes to sipify script

- updated gsdataitem header:
  - added qgis.h include
  - skip sDataItemPtr
  - remove , between SIP annotations
- run sipify for qgsvector and qgsdataitem
  • Loading branch information
doublebyte1 committed May 1, 2017
1 parent 18a3f32 commit bb1bded2499df92e5618dade4989e95554d29c80
Showing with 48 additions and 71 deletions.
  1. +25 −50 python/core/qgsdataitem.sip
  2. +2 −2 python/core/qgsvector.sip
  3. +2 −1 scripts/sipify.pl
  4. +19 −18 src/core/qgsdataitem.h
@@ -24,22 +24,22 @@ class QgsDataItem : QObject
%End

%ConvertToSubClassCode
if (qobject_cast<QgsLayerItem*>(sipCpp))
sipType = sipType_QgsLayerItem;
else if (qobject_cast<QgsErrorItem*>(sipCpp))
sipType = sipType_QgsErrorItem;
else if (qobject_cast<QgsDirectoryItem*>(sipCpp))
sipType = sipType_QgsDirectoryItem;
else if (qobject_cast<QgsFavoritesItem*>(sipCpp))
sipType = sipType_QgsFavoritesItem;
else if (qobject_cast<QgsZipItem*>(sipCpp))
sipType = sipType_QgsZipItem;
else if (qobject_cast<QgsDataCollectionItem*>(sipCpp))
sipType = sipType_QgsDataCollectionItem;
else if (qobject_cast<QgsProjectItem*>(sipCpp))
sipType = sipType_QgsProjectItem;
else
sipType = 0;
if ( qobject_cast<QgsLayerItem *>( sipCpp ) )
sipType = sipType_QgsLayerItem;
else if ( qobject_cast<QgsErrorItem *>( sipCpp ) )
sipType = sipType_QgsErrorItem;
else if ( qobject_cast<QgsDirectoryItem *>( sipCpp ) )
sipType = sipType_QgsDirectoryItem;
else if ( qobject_cast<QgsFavoritesItem *>( sipCpp ) )
sipType = sipType_QgsFavoritesItem;
else if ( qobject_cast<QgsZipItem *>( sipCpp ) )
sipType = sipType_QgsZipItem;
else if ( qobject_cast<QgsDataCollectionItem *>( sipCpp ) )
sipType = sipType_QgsDataCollectionItem;
else if ( qobject_cast<QgsProjectItem *>( sipCpp ) )
sipType = sipType_QgsProjectItem;
else
sipType = 0;
%End
public:
enum Type
@@ -100,14 +100,14 @@ Create new data item.
Inserts a new child item. The child will be inserted at a position using an alphabetical order based on mName.
\param child child item to insert. Ownership is transferred, and item parent will be set and relevant connections made.
\param refresh - set to true to refresh populated item, emitting relevant signals to the model
\see deleteChildItem()
.. seealso:: deleteChildItem()
%End

virtual void deleteChildItem( QgsDataItem *child );
%Docstring
Removes and deletes a child item, emitting relevant signals to the model.
\param child child to remove. Item must exist as a current child.
\see addChildItem()
.. seealso:: addChildItem()
%End

virtual QgsDataItem *removeChildItem( QgsDataItem *child ) /TransferBack/;
@@ -140,15 +140,15 @@ Create new data item.
%Docstring
Returns whether the item accepts drag and dropped layers - e.g. for importing a dataset to a provider.
Subclasses should override this and handleDrop() to accept dropped layers.
\see handleDrop()
.. seealso:: handleDrop()
:rtype: bool
%End

virtual bool handleDrop( const QMimeData * /*data*/, Qt::DropAction /*action*/ );
%Docstring
Attempts to process the mime data dropped on this item. Subclasses must override this and acceptDrop() if they
accept dropped layers.
\see acceptDrop()
.. seealso:: acceptDrop()
:rtype: bool
%End

@@ -157,7 +157,7 @@ Create new data item.
Returns true if the item may be dragged.
Default implementation returns false.
A draggable item has to implement mimeUri() that will be used to pass data.
\see mimeUri()
.. seealso:: mimeUri()
.. versionadded:: 3.0
:rtype: bool
%End
@@ -166,7 +166,7 @@ Create new data item.
%Docstring
Return mime URI for the data item.
Items that return valid URI will be returned in mime data when dragging a selection from browser model.
\see hasDragEnabled()
.. seealso:: hasDragEnabled()
.. versionadded:: 3.0
:rtype: QgsMimeDataUtils.Uri
%End
@@ -190,7 +190,6 @@ Create new data item.

virtual Capabilities capabilities2() const;
%Docstring
### QGIS 3 - rename to capabilities()
:rtype: Capabilities
%End

@@ -202,14 +201,12 @@ Create new data item.

static int findItem( QVector<QgsDataItem *> items, QgsDataItem *item );
%Docstring
Find child index in vector of items using '==' operator
:rtype: int
%End


Type type() const;
%Docstring
members
:rtype: Type
%End

@@ -250,9 +247,6 @@ Create path component replacing path separators
%End

void setIcon( const QIcon &icon );
%Docstring
or implement icon().
%End
void setIconName( const QString &iconName );

void setToolTip( const QString &msg );
@@ -262,9 +256,6 @@ or implement icon().
%End

static void deleteLater( QVector<QgsDataItem *> &items );
%Docstring
deleteLater() items anc clear the vector
%End

void moveToThread( QThread *targetThread );
%Docstring
@@ -304,9 +295,6 @@ Move object and all its descendants to thread
%End

virtual void populate( bool foreground = false );
%Docstring
\param foreground run createChildren in foreground
%End

virtual void depopulate();
%Docstring
@@ -367,10 +355,6 @@ class QgsLayerItem : QgsDataItem


virtual bool equal( const QgsDataItem *other );
%Docstring
--- reimplemented from QgsDataItem ---
:rtype: bool
%End

virtual bool hasDragEnabled() const;

@@ -471,9 +455,6 @@ class QgsDataCollectionItem : QgsDataItem
static QIcon iconDir(); // shared icon: open/closed directory
static QIcon iconDataCollection(); // default icon for data collection
};
%Docstring
:rtype: QIcon
%End

class QgsDirectoryItem : QgsDataCollectionItem
{
@@ -616,13 +597,13 @@ class QgsFavoritesItem : QgsDataCollectionItem
void addDirectory( const QString &directory );
%Docstring
Adds a new directory to the favorites group.
\see removeDirectory()
.. seealso:: removeDirectory()
%End

void removeDirectory( QgsDirectoryItem *item );
%Docstring
Removes an existing directory from the favorites group.
\see addDirectory()
.. seealso:: addDirectory()
%End

static QIcon iconFavorites();
@@ -655,12 +636,6 @@ class QgsZipItem : QgsDataCollectionItem
:rtype: list of str
%End

static QVector<dataItem_t *> sDataItemPtr;
%Docstring
.. note::

not available via Python bindings
%End
static QStringList sProviderNames;

static QString vsiPrefix( const QString &uri );
@@ -674,7 +649,7 @@ class QgsZipItem : QgsDataCollectionItem
:rtype: QgsDataItem
%End

static QgsDataItem *itemFromPath( QgsDataItem *parent, const QString &filePath, const QString &name, const QString &path ) /Factory/, /PyName=itemFromFilePath/;
static QgsDataItem *itemFromPath( QgsDataItem *parent, const QString &filePath, const QString &name, const QString &path ) /Factory,PyName=itemFromFilePath/;
%Docstring
Creates a new data item from the specified path.
.. note::
@@ -97,14 +97,14 @@ Swaps the sign of the x and y components of the vector.
double x() const;
%Docstring
Returns the vector's x-component.
\see y()
.. seealso:: y()
:rtype: float
%End

double y() const;
%Docstring
Returns the vector's y-component.
\see x()
.. seealso:: x()
:rtype: float
%End

@@ -326,8 +326,9 @@ sub remove_constructor_or_body {
# top level should stasy public
dbg_info
$ACCESS[$#ACCESS] = PUBLIC;
$comment = '';
}
$comment = '';
$return_type = '';
$private_section_line = '';
}
dbg_info("new bracket balance: @global_bracket_nesting_index");
@@ -17,6 +17,7 @@
#ifndef QGSDATAITEM_H
#define QGSDATAITEM_H

#include "qgis.h"
#include "qgis_core.h"
#include <QFileSystemWatcher>
#include <QFutureWatcher>
@@ -48,22 +49,22 @@ class CORE_EXPORT QgsDataItem : public QObject

#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if (qobject_cast<QgsLayerItem*>(sipCpp))
sipType = sipType_QgsLayerItem;
else if (qobject_cast<QgsErrorItem*>(sipCpp))
sipType = sipType_QgsErrorItem;
else if (qobject_cast<QgsDirectoryItem*>(sipCpp))
sipType = sipType_QgsDirectoryItem;
else if (qobject_cast<QgsFavoritesItem*>(sipCpp))
sipType = sipType_QgsFavoritesItem;
else if (qobject_cast<QgsZipItem*>(sipCpp))
sipType = sipType_QgsZipItem;
else if (qobject_cast<QgsDataCollectionItem*>(sipCpp))
sipType = sipType_QgsDataCollectionItem;
else if (qobject_cast<QgsProjectItem*>(sipCpp))
sipType = sipType_QgsProjectItem;
else
sipType = 0;
if ( qobject_cast<QgsLayerItem *>( sipCpp ) )
sipType = sipType_QgsLayerItem;
else if ( qobject_cast<QgsErrorItem *>( sipCpp ) )
sipType = sipType_QgsErrorItem;
else if ( qobject_cast<QgsDirectoryItem *>( sipCpp ) )
sipType = sipType_QgsDirectoryItem;
else if ( qobject_cast<QgsFavoritesItem *>( sipCpp ) )
sipType = sipType_QgsFavoritesItem;
else if ( qobject_cast<QgsZipItem *>( sipCpp ) )
sipType = sipType_QgsZipItem;
else if ( qobject_cast<QgsDataCollectionItem *>( sipCpp ) )
sipType = sipType_QgsDataCollectionItem;
else if ( qobject_cast<QgsProjectItem *>( sipCpp ) )
sipType = sipType_QgsProjectItem;
else
sipType = 0;
SIP_END
#endif

@@ -571,7 +572,7 @@ class CORE_EXPORT QgsZipItem : public QgsDataCollectionItem
QStringList getZipFileList();

//! \note not available via Python bindings
static QVector<dataItem_t *> sDataItemPtr;
static QVector<dataItem_t *> sDataItemPtr SIP_SKIP;
static QStringList sProviderNames;

static QString vsiPrefix( const QString &uri ) { return qgsVsiPrefix( uri ); }
@@ -585,7 +586,7 @@ class CORE_EXPORT QgsZipItem : public QgsDataCollectionItem
* Creates a new data item from the specified path.
* \note available in Python as itemFromFilePath
*/
static QgsDataItem *itemFromPath( QgsDataItem *parent, const QString &filePath, const QString &name, const QString &path ) SIP_FACTORY, SIP_PYNAME(itemFromFilePath);
static QgsDataItem *itemFromPath( QgsDataItem *parent, const QString &filePath, const QString &name, const QString &path ) SIP_FACTORY SIP_PYNAME( itemFromFilePath );

static QIcon iconZip();

0 comments on commit bb1bded

Please sign in to comment.