Skip to content

Commit 32d4bcc

Browse files
authoredOct 15, 2018
add Python __repr__ method to QgsGeometry.Error (#8198)
1 parent 440d8d8 commit 32d4bcc

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed
 

‎python/core/auto_generated/geometry/qgsgeometry.sip.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,6 +1497,12 @@ The coordinates at which the error is located and should be visualized.
14971497
True if the location available from :py:func:`where` is valid.
14981498
%End
14991499

1500+
SIP_PYOBJECT __repr__();
1501+
%MethodCode
1502+
QString str = QStringLiteral( "<QgsGeometry.Error: %1>" ).arg( sipCpp->what() );
1503+
sipRes = PyUnicode_FromString( str.toUtf8().data() );
1504+
%End
1505+
15001506
};
15011507

15021508
enum ValidationMethod

‎src/core/geometry/qgsgeometry.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,6 +1449,14 @@ class CORE_EXPORT QgsGeometry
14491449
*/
14501450
bool hasWhere() const;
14511451

1452+
#ifdef SIP_RUN
1453+
SIP_PYOBJECT __repr__();
1454+
% MethodCode
1455+
QString str = QStringLiteral( "<QgsGeometry.Error: %1>" ).arg( sipCpp->what() );
1456+
sipRes = PyUnicode_FromString( str.toUtf8().data() );
1457+
% End
1458+
#endif
1459+
14521460
private:
14531461
QString mMessage;
14541462
QgsPointXY mLocation;

0 commit comments

Comments
 (0)
Please sign in to comment.