Skip to content

Commit

Permalink
Add some missing SIP bindings, comment some classes as not available
Browse files Browse the repository at this point in the history
in Python
  • Loading branch information
nyalldawson committed Nov 10, 2015
1 parent b1b20af commit 719ff40
Show file tree
Hide file tree
Showing 97 changed files with 617 additions and 40 deletions.
8 changes: 8 additions & 0 deletions python/analysis/raster/qgsalignraster.sip
Expand Up @@ -160,5 +160,13 @@ class QgsAlignRaster
//! Return index of the layer which has smallest cell size (returns -1 on error)
int suggestedReferenceLayer() const;

protected:

//! Internal function for processing of one raster (1. create output, 2. do the alignment)
bool createAndWarp( const Item& raster );

//! Determine suggested output of raster warp to a different CRS. Returns true on success
static bool suggestedWarpOutput( const RasterInfo& info, const QString& destWkt, QSizeF* cellSize = 0, QPointF* gridOffset = 0, QgsRectangle* rect = 0 );

};

1 change: 1 addition & 0 deletions python/core/composer/qgscomposerattributetablev2.sip
Expand Up @@ -271,4 +271,5 @@ class QgsComposerAttributeTableV2 : QgsComposerTableV2
*/
bool getTableContents( QgsComposerTableContents &contents );

virtual QgsExpressionContext* createExpressionContext() const /Factory/;
};
6 changes: 6 additions & 0 deletions python/core/composer/qgscomposerobject.sip
Expand Up @@ -135,6 +135,12 @@ class QgsComposerObject : QObject
*/
QStringList customProperties() const;

/** Creates an expression context relating to the objects' current state. The context includes
* scopes for global, project and composition properties.
* @note added in QGIS 2.12
*/
virtual QgsExpressionContext* createExpressionContext() const /Factory/;

public slots:

/** Triggers a redraw for the item*/
Expand Down
21 changes: 21 additions & 0 deletions python/core/geometry/qgsabstractgeometryv2.sip
Expand Up @@ -139,6 +139,10 @@ class QgsAbstractGeometryV2
/** Returns the centroid of the geometry*/
virtual QgsPointV2 centroid() const;

/** Returns true if the geometry is empty
*/
bool isEmpty() const;

virtual bool hasCurvedSegments() const;
/** Returns a geometry without curves. Caller takes ownership*/
virtual QgsAbstractGeometryV2* segmentize() const /Factory/;
Expand Down Expand Up @@ -166,4 +170,21 @@ class QgsAbstractGeometryV2
* @see addZValue
*/
virtual bool addMValue( double mValue = 0 ) = 0;

protected:

/** Updates the geometry type based on whether sub geometries contain z or m values.
*/
void setZMTypeFromSubGeometry( const QgsAbstractGeometryV2* subggeom, QgsWKBTypes::Type baseGeomType );

/** Reads a WKB header and tests its validity.
* @param wkbPtr
* @param wkbType destination for WKB type from header
* @param endianSwap will be set to true if endian from WKB must be swapped to match QGIS platform endianness
* @param expectedType expected WKB type
* @returns true if header is valid and matches expected type
* @note not available in Python bindings
*/
//static bool readWkbHeader( QgsConstWkbPtr& wkbPtr, QgsWKBTypes::Type& wkbType, bool& endianSwap, QgsWKBTypes::Type expectedType );

};
8 changes: 8 additions & 0 deletions python/core/qgsapplication.sip
Expand Up @@ -63,6 +63,11 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)


public:

static const char* QGIS_ORGANIZATION_NAME;
static const char* QGIS_ORGANIZATION_DOMAIN;
static const char* QGIS_APPLICATION_NAME;

//QgsApplication(int argc, char ** argv, bool GUIenabled);
QgsApplication(SIP_PYLIST argv, bool GUIenabled, QString customConfigPath = QString() ) /PostHook=__pyQtQAppHook__/ [(int &argc, char **argv, bool GUIenabled, const QString& customConfigPath = QString() )];
%MethodCode
Expand All @@ -88,6 +93,9 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)

virtual ~QgsApplication();

//! Set the FileOpen event receiver
static void setFileOpenEventReceiver( QObject * receiver );

/** Set the active theme to the specified theme.
* The theme name should be a single word e.g. 'default','classic'.
* The theme search path usually will be pkgDataPath + "/themes/" + themName + "/"
Expand Down
4 changes: 4 additions & 0 deletions python/core/qgsbrowsermodel.sip
Expand Up @@ -78,6 +78,10 @@ class QgsBrowserModel : QAbstractItemModel
bool canFetchMore( const QModelIndex & parent ) const;
void fetchMore( const QModelIndex & parent );

signals:
/** Emitted when item children fetch was finished */
void stateChanged( const QModelIndex & index, QgsDataItem::State oldState );

public slots:
// Reload the whole model
void reload();
Expand Down
42 changes: 42 additions & 0 deletions python/core/qgsdataitem.sip
@@ -1,3 +1,33 @@
/** Animated icon is keeping an animation running if there are listeners connected to frameChanged */
class QgsAnimatedIcon : QObject
{
%TypeHeaderCode
#include <qgsdataitem.h>
%End
public:

/** Constructor
* @param iconPath path to a movie, e.g. animated GIF */
QgsAnimatedIcon( const QString & iconPath = QString::null );

QString iconPath() const;
void setIconPath( const QString & iconPath );
QIcon icon() const;

/** Connect listener to frameChanged() signal */
void connectFrameChanged( const QObject * receiver, const char * method );
/** Disconnect listener from frameChanged() signal */
void disconnectFrameChanged( const QObject * receiver, const char * method );

public slots:
void onFrameChanged();

signals:
/** Emitted when icon changed */
void frameChanged();

};

class QgsDataItem : QObject
{
%TypeHeaderCode
Expand Down Expand Up @@ -143,6 +173,16 @@ class QgsDataItem : QObject
/** Move object and all its descendants to thread */
void moveToThread( QThread * targetThread );

protected:
virtual void populate( const QVector<QgsDataItem*>& children );
virtual void refresh( QVector<QgsDataItem*> children );
/** The item is scheduled to be deleted. E.g. if deleteLater() is called when
* item is in Populating state (createChildren() running in another thread),
* the deferredDelete() returns true and item will be deleted once Populating finished.
* Items with slow reateChildren() (for example network or database based) may
* check during createChildren() if deferredDelete() returns true and return from
* createChildren() immediately because result will be useless. */
bool deferredDelete();

public slots:

Expand All @@ -168,6 +208,8 @@ class QgsDataItem : QObject
void endInsertItems();
void beginRemoveItems( QgsDataItem* parent, int first, int last );
void endRemoveItems();
void dataChanged( QgsDataItem * item );
void stateChanged( QgsDataItem * item, QgsDataItem::State oldState );
};

QFlags<QgsDataItem::Capability> operator|(QgsDataItem::Capability f1, QFlags<QgsDataItem::Capability> f2);
Expand Down
3 changes: 3 additions & 0 deletions python/core/symbology-ng/qgsfillsymbollayerv2.sip
Expand Up @@ -886,4 +886,7 @@ class QgsCentroidFillSymbolLayerV2 : QgsFillSymbolLayerV2
QgsMapUnitScale mapUnitScale() const;

virtual QSet<QString> usedAttributes() const;

void setPointOnSurface( bool pointOnSurface );
bool pointOnSurface() const;
};
2 changes: 2 additions & 0 deletions python/core/symbology-ng/qgssymbolv2.sip
Expand Up @@ -27,6 +27,8 @@ class QgsSymbolV2
Pixel
};

typedef QList<QgsSymbolV2::OutputUnit> OutputUnitList;

enum SymbolType
{
Marker,
Expand Down
5 changes: 5 additions & 0 deletions python/gui/attributetable/qgsattributetablemodel.sip
Expand Up @@ -157,6 +157,11 @@ class QgsAttributeTableModel : QAbstractTableModel
*/
void setRequest( const QgsFeatureRequest& request );

/**
* Get the the feature request
*/
const QgsFeatureRequest &request() const;

/**
* Sets the context in which this table is shown.
* Will be forwarded to any editor widget created when editing data on this model.
Expand Down
15 changes: 15 additions & 0 deletions python/gui/effects/qgspainteffectwidget.sip
Expand Up @@ -106,4 +106,19 @@ class QgsTransformWidget : QgsPaintEffectWidget

};

class QgsColorEffectWidget : QgsPaintEffectWidget
{
%TypeHeaderCode
#include <qgspainteffectwidget.h>
%End

public:
QgsColorEffectWidget( QWidget* parent /TransferThis/ = NULL );

static QgsPaintEffectWidget* create() /Factory/;

virtual void setPaintEffect( QgsPaintEffect* effect );

};


6 changes: 6 additions & 0 deletions python/gui/gui.sip
Expand Up @@ -17,13 +17,16 @@
%Include qgsblendmodecombobox.sip

%Include qgisinterface.sip
%Include qgsactionmenu.sip
%Include qgsannotationitem.sip
%Include qgsadvanceddigitizingcanvasitem.sip
%Include qgsadvanceddigitizingdockwidget.sip
%Include qgsattributeeditor.sip
%Include qgsattributeeditorcontext.sip
%Include qgsattributedialog.sip
%Include qgsattributeform.sip
%Include qgsattributeforminterface.sip
%Include qgsbrowsertreeview.sip
%Include qgsbusyindicatordialog.sip
%Include qgscollapsiblegroupbox.sip
%If (HAVE_QSCI_SIP)
Expand All @@ -47,6 +50,7 @@
%Include qgsdetaileditemdata.sip
%Include qgsdetaileditemdelegate.sip
%Include qgsdetaileditemwidget.sip
%Include qgsdial.sip
%Include qgsdialog.sip
%Include qgsencodingfiledialog.sip
%Include qgserrordialog.sip
Expand Down Expand Up @@ -122,9 +126,11 @@
%Include qgsscalevisibilitydialog.sip
%Include qgsscalewidget.sip
%Include qgssearchquerybuilder.sip
%Include qgsslider.sip
%Include qgssublayersdialog.sip
%Include qgssvgannotationitem.sip
%Include qgstextannotationitem.sip
%Include qgsunitselectionwidget.sip
%Include qgsuserinputdockwidget.sip
%Include qgsvariableeditorwidget.sip
%Include qgsvectorlayertools.sip
Expand Down
68 changes: 68 additions & 0 deletions python/gui/qgsactionmenu.sip
@@ -0,0 +1,68 @@
/**
* This class is a menu that is populated automatically with the actions defined for a given layer.
*/

class QgsActionMenu : QMenu
{
%TypeHeaderCode
#include <qgsactionmenu.h>
%End

public:
enum ActionType
{
Invalid, //!< Invalid
MapLayerAction, //!< Standard actions (defined by core or plugins)
AttributeAction //!< Custom actions (manually defined in layer properties)
};

struct ActionData
{
ActionData();

ActionData( int actionId, QgsFeatureId featureId, QgsMapLayer* mapLayer );

ActionData( QgsMapLayerAction* action, QgsFeatureId featureId, QgsMapLayer* mapLayer );

QgsActionMenu::ActionType actionType;

QgsFeatureId featureId;
QgsMapLayer* mapLayer;
};

/**
* Constructs a new QgsActionMenu
*
* @param layer The layer that this action will be run upon.
* @param feature The feature that this action will be run upon. Make sure that this feature is available
* for the lifetime of this object.
* @param parent The usual QWidget parent.
*/
explicit QgsActionMenu( QgsVectorLayer* layer, const QgsFeature* feature, QWidget* parent /TransferThis/ = 0 );

/**
* Constructs a new QgsActionMenu
*
* @param layer The layer that this action will be run upon.
* @param fid The feature id of the feature for which this action will be run.
* @param parent The usual QWidget parent.
*/
explicit QgsActionMenu( QgsVectorLayer* layer, const QgsFeatureId fid, QWidget* parent /TransferThis/ = 0 );

/**
* Destructor
*/
~QgsActionMenu();

/**
* Change the feature on which actions are performed
*
* @param feature A feature. Will not take ownership. It's the callers responsibility to keep the feature
* as long as the menu is displayed and the action is running.
*/
void setFeature( QgsFeature* feature );

signals:
void reinit();

};
16 changes: 16 additions & 0 deletions python/gui/qgsadvanceddigitizingcanvasitem.sip
@@ -0,0 +1,16 @@
/**
* @brief The QgsAdvancedDigitizingCanvasItem class draws the graphical elements of the CAD tools (@see QgsAdvancedDigitizingDock) on the map canvas.
*/

class QgsAdvancedDigitizingCanvasItem : QgsMapCanvasItem
{
%TypeHeaderCode
#include <qgsadvanceddigitizingcanvasitem.h>
%End
public:

explicit QgsAdvancedDigitizingCanvasItem( QgsMapCanvas* canvas, QgsAdvancedDigitizingDockWidget* cadDockWidget );
~QgsAdvancedDigitizingCanvasItem();

void paint( QPainter *painter );
};
5 changes: 5 additions & 0 deletions python/gui/qgsattributeform.sip
Expand Up @@ -152,4 +152,9 @@ class QgsAttributeForm : QWidget
* Sets all values to the values of the current feature
*/
void resetValues();

/**
* reload current feature
*/
void refreshFeature();
};
29 changes: 29 additions & 0 deletions python/gui/qgsbrowsertreeview.sip
@@ -0,0 +1,29 @@
/**
* The QgsBrowserTreeView class extends QTreeView with save/restore tree state functionality.
*
* @see QgsBrowserModel
* @note added in 2.8
*/
class QgsBrowserTreeView: QTreeView
{
%TypeHeaderCode
#include <qgsbrowsertreeview.h>
%End

public:
QgsBrowserTreeView( QWidget *parent /TransferThis/ = 0 );
~QgsBrowserTreeView();

virtual void setModel( QAbstractItemModel* model );
virtual void showEvent( QShowEvent * e );
virtual void hideEvent( QHideEvent * e );

// returns true if at least one descendat is expanded, used in refresh
bool hasExpandedDescendant( const QModelIndex& index ) const;

// Set section where to store settings (because we have 2 browser dock widgets)
void setSettingsSection( const QString & section );

protected slots:
virtual void rowsInserted( const QModelIndex & parentIndex, int start, int end );
};
4 changes: 4 additions & 0 deletions python/gui/qgscomposerruler.sip
Expand Up @@ -28,4 +28,8 @@ class QgsComposerRuler : QWidget
void mouseMoveEvent( QMouseEvent* event );
void mouseReleaseEvent( QMouseEvent* event );
void mousePressEvent( QMouseEvent* event );

signals:
/** Is emitted when mouse cursor coordinates change*/
void cursorPosChanged( QPointF );
};

0 comments on commit 719ff40

Please sign in to comment.