From 798c318288a963b36e3b355dc78914dbf27d0b45 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 17 Apr 2017 10:49:29 +1000 Subject: [PATCH] [sipify] Fix loss of class docstring if newline present between class doxygen and class definition --- python/core/annotations/qgshtmlannotation.sip | 4 +++ python/core/qgsactionmanager.sip | 6 ++++ python/core/qgsattributeeditorelement.sip | 9 ++++++ python/core/qgsattributetableconfig.sip | 5 +++ python/core/qgsclipper.sip | 12 +++++++ python/core/qgspropertytransformer.sip | 32 +++++++++++++++++++ python/gui/qgscheckablecombobox.sip | 5 +++ python/gui/qgsmessagelogviewer.sip | 3 ++ scripts/sipify.pl | 8 ++++- src/core/qgsclipper.h | 6 ++-- tests/scripts/sipifyheader.expected.sip | 3 ++ tests/scripts/sipifyheader.h | 3 ++ 12 files changed, 93 insertions(+), 3 deletions(-) diff --git a/python/core/annotations/qgshtmlannotation.sip b/python/core/annotations/qgshtmlannotation.sip index 32ac92567d7..e932d15cdd8 100644 --- a/python/core/annotations/qgshtmlannotation.sip +++ b/python/core/annotations/qgshtmlannotation.sip @@ -14,6 +14,10 @@ class QgsHtmlAnnotation: QgsAnnotation { +%Docstring + An annotation item that embeds HTML content. +.. versionadded:: 3.0 +%End %TypeHeaderCode #include "qgshtmlannotation.h" diff --git a/python/core/qgsactionmanager.sip b/python/core/qgsactionmanager.sip index 457da958d9d..c9b9b78a448 100644 --- a/python/core/qgsactionmanager.sip +++ b/python/core/qgsactionmanager.sip @@ -14,6 +14,12 @@ class QgsActionManager { +%Docstring + Storage and management of actions associated with a layer. + + Actions can trigger custom code or applications to be executed + based on attributes of a given feature. +%End %TypeHeaderCode #include "qgsactionmanager.h" diff --git a/python/core/qgsattributeeditorelement.sip b/python/core/qgsattributeeditorelement.sip index 6347389a3cd..501fa537c21 100644 --- a/python/core/qgsattributeeditorelement.sip +++ b/python/core/qgsattributeeditorelement.sip @@ -11,6 +11,15 @@ class QgsAttributeEditorElement /Abstract/ { +%Docstring + This is an abstract base class for any elements of a drag and drop form. + + This can either be a container which will be represented on the screen + as a tab widget or ca collapsible group box. Or it can be a field which will + then be represented based on the QgsEditorWidget type and configuration. + Or it can be a relation and embed the form of several children of another + layer. +%End %TypeHeaderCode #include "qgsattributeeditorelement.h" diff --git a/python/core/qgsattributetableconfig.sip b/python/core/qgsattributetableconfig.sip index 46248f515aa..9a30fcab817 100644 --- a/python/core/qgsattributetableconfig.sip +++ b/python/core/qgsattributetableconfig.sip @@ -12,6 +12,11 @@ class QgsAttributeTableConfig { +%Docstring + This is a container for configuration of the attribute table. + The configuration is specific for one vector layer. +.. versionadded:: 2.16 +%End %TypeHeaderCode #include "qgsattributetableconfig.h" diff --git a/python/core/qgsclipper.sip b/python/core/qgsclipper.sip index 979bf597e69..be1c564b485 100644 --- a/python/core/qgsclipper.sip +++ b/python/core/qgsclipper.sip @@ -34,9 +34,21 @@ class QgsClipper static const double MAX_X; +%Docstring +Maximum X-coordinate of the rectangular box used for clipping. +%End static const double MIN_X; +%Docstring +Minimum X-coordinate of the rectangular box used for clipping. +%End static const double MAX_Y; +%Docstring +Maximum Y-coordinate of the rectangular box used for clipping. +%End static const double MIN_Y; +%Docstring +Minimum Y-coordinate of the rectangular box used for clipping. +%End enum Boundary diff --git a/python/core/qgspropertytransformer.sip b/python/core/qgspropertytransformer.sip index 96b401792ae..52b40e50ef2 100644 --- a/python/core/qgspropertytransformer.sip +++ b/python/core/qgspropertytransformer.sip @@ -12,6 +12,24 @@ class QgsCurveTransform { +%Docstring + Handles scaling of input values to output values by using a curve created + from smoothly joining a number of set control points. + + QgsCurveTransform assists in creation of curve type transforms, typically seen in + raster image editing software (eg the curves dialog in GIMP or Photoshop). + Transforms are created by passing a number of set control points through which + the transform curve must pass. The curve is guaranteed to exactly pass through + these control points. Between control points the curve is smoothly interpolated + so that no disjoint sections or "corners" are present. + + If the first or last control point are not located at x = 0 and x = 1 respectively, + then values outside this range will be mapped to the y value of either the first + or last control point. In other words, the curve will have a flat segment + for values outside of the control point range. + +.. versionadded:: 3.0 +%End %TypeHeaderCode #include "qgspropertytransformer.h" @@ -297,6 +315,10 @@ class QgsPropertyTransformer class QgsGenericNumericTransformer : QgsPropertyTransformer { +%Docstring + QgsPropertyTransformer subclass for scaling an input numeric value into an output numeric value. +.. versionadded:: 3.0 +%End %TypeHeaderCode #include "qgspropertytransformer.h" @@ -437,6 +459,11 @@ class QgsGenericNumericTransformer : QgsPropertyTransformer class QgsSizeScaleTransformer : QgsPropertyTransformer { +%Docstring + QgsPropertyTransformer subclass for scaling a value into a size according to various + scaling methods. +.. versionadded:: 3.0 +%End %TypeHeaderCode #include "qgspropertytransformer.h" @@ -604,6 +631,11 @@ class QgsSizeScaleTransformer : QgsPropertyTransformer class QgsColorRampTransformer : QgsPropertyTransformer { +%Docstring + QgsPropertyTransformer subclass for transforming a numeric value into a color from a + color ramp. +.. versionadded:: 3.0 +%End %TypeHeaderCode #include "qgspropertytransformer.h" diff --git a/python/gui/qgscheckablecombobox.sip b/python/gui/qgscheckablecombobox.sip index 99777c32cc8..3656a26c6c5 100644 --- a/python/gui/qgscheckablecombobox.sip +++ b/python/gui/qgscheckablecombobox.sip @@ -15,6 +15,11 @@ class QgsCheckableComboBox : QComboBox { +%Docstring + QComboBox subclass which allows selecting multiple items. +.. versionadded:: 3.0 +* +%End %TypeHeaderCode #include "qgscheckablecombobox.h" diff --git a/python/gui/qgsmessagelogviewer.sip b/python/gui/qgsmessagelogviewer.sip index 723d826f651..6907cb3a6e0 100644 --- a/python/gui/qgsmessagelogviewer.sip +++ b/python/gui/qgsmessagelogviewer.sip @@ -28,6 +28,9 @@ class QgsMessageLogViewer: QDialog %End public slots: +%Docstring +TODO QGIS 3.0: remove statusBar (it's unused) +%End void logMessage( QString message, QString tag, QgsMessageLog::MessageLevel level ); protected: diff --git a/scripts/sipify.pl b/scripts/sipify.pl index 184f1eb2713..70a6af07e52 100755 --- a/scripts/sipify.pl +++ b/scripts/sipify.pl @@ -180,6 +180,7 @@ while(!eof $header){ # SIP_SKIP if ( $line =~ m/SIP_SKIP/ ){ + $comment = ''; next; } @@ -292,6 +293,7 @@ while(!eof $header){ } print $line; # enums don't have Docstring apparently + $comment = ''; next; } @@ -424,7 +426,11 @@ while(!eof $header){ } # write comment - if ( $line =~ m/^\s*$/ || $line =~ m/\/\// || $line =~ m/\s*typedef / || $line =~ m/\s*struct / ){ + if ( $line =~ m/^\s*$/ ) + { + next; + } + elsif ( $line =~ m/\/\// || $line =~ m/\s*typedef / || $line =~ m/\s*struct / ){ $comment = ''; } elsif ( $comment !~ m/^\s*$/ || $return_type ne ''){ diff --git a/src/core/qgsclipper.h b/src/core/qgsclipper.h index 8c3cdf433e0..159f18f147f 100644 --- a/src/core/qgsclipper.h +++ b/src/core/qgsclipper.h @@ -45,8 +45,6 @@ class CORE_EXPORT QgsClipper { public: - // Coordinates of the rectangular box that we trim to. - // // These are the limits for X11 screen coordinates. The actual // values are +/-32767, but we allow a little bit of space for // rounding errors. @@ -64,9 +62,13 @@ class CORE_EXPORT QgsClipper // The limit is set to 30,000 instead of 32768 because that things // still go wrong. + //! Maximum X-coordinate of the rectangular box used for clipping. static const double MAX_X; + //! Minimum X-coordinate of the rectangular box used for clipping. static const double MIN_X; + //! Maximum Y-coordinate of the rectangular box used for clipping. static const double MAX_Y; + //! Minimum Y-coordinate of the rectangular box used for clipping. static const double MIN_Y; diff --git a/tests/scripts/sipifyheader.expected.sip b/tests/scripts/sipifyheader.expected.sip index b01d9381bdb..467c0db5738 100644 --- a/tests/scripts/sipifyheader.expected.sip +++ b/tests/scripts/sipifyheader.expected.sip @@ -116,6 +116,8 @@ A multiline method signature %End + void nonAnnotatedMethodFollowingSkip(); + virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) /Factory/; %Docstring Factory annotation @@ -264,6 +266,7 @@ A constructor with definition in header on several lines }; + class AbstractClass /Abstract/ { %Docstring diff --git a/tests/scripts/sipifyheader.h b/tests/scripts/sipifyheader.h index 7f778052842..14f94a5be0b 100644 --- a/tests/scripts/sipifyheader.h +++ b/tests/scripts/sipifyheader.h @@ -154,6 +154,8 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass, private Ui::QgsBas // Adding SIP_SKIP at the end of a line will discard this MethodCode bool thisShouldBeSkipped() const SIP_SKIP; + void nonAnnotatedMethodFollowingSkip(); + //! Factory annotation virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) override SIP_FACTORY; @@ -286,6 +288,7 @@ class CORE_EXPORT ClassWithPrivateInheritanceOnly : private QgsBaseClass * \ingroup core * Documentation goes here */ + class CORE_EXPORT AbstractClass SIP_ABSTRACT { public: