QGIS/python/core/auto_additions/qgstextrenderer.py
Nyall Dawson 1f27fc627a [pyqgis] Wrap unambiguously static methods in staticmethod
sip doesn't use the standard Python staticmethod type for defining
static methods, which means that standard means of testing
for a static method (like `isinstance(..., staticmethod)`) fail
with any PyQGIS static methods.

This causes issues with lint tools, which incorrectly flag
calls to QGIS static methods as missing self arguments. It also
breaks detection of static methods in the sphinx PyQGIS docs,
so all static methods are shown as non-static.

Work around this in sipify, by wrapping unambiguously static
methods in staticmethod wrappers.
2024-08-14 22:08:41 +10:00

20 lines
1.8 KiB
Python

# The following has been generated automatically from src/core/textrenderer/qgstextrenderer.h
try:
QgsTextRenderer.__attribute_docs__ = {'FONT_WORKAROUND_SCALE': 'Scale factor for upscaling font sizes and downscaling destination painter devices.\n\nUsing this scale factor and manually adjusting any font metric based calculations results in more stable\nfont metrics and sizes for small font sizes.\n\n.. warning::\n\n Deprecated, use :py:func:`~QgsTextRenderer.calculateScaleFactorForFormat` instead.\n\n.. versionadded:: 3.16', 'SUPERSCRIPT_SUBSCRIPT_FONT_SIZE_SCALING_FACTOR': "Scale factor to use for super or subscript text which doesn't have an explicit font size set.\n\n.. versionadded:: 3.32"}
except NameError:
pass
QgsTextRenderer.convertQtHAlignment = staticmethod(QgsTextRenderer.convertQtHAlignment)
QgsTextRenderer.convertQtVAlignment = staticmethod(QgsTextRenderer.convertQtVAlignment)
QgsTextRenderer.sizeToPixel = staticmethod(QgsTextRenderer.sizeToPixel)
QgsTextRenderer.drawText = staticmethod(QgsTextRenderer.drawText)
QgsTextRenderer.drawDocument = staticmethod(QgsTextRenderer.drawDocument)
QgsTextRenderer.drawTextOnLine = staticmethod(QgsTextRenderer.drawTextOnLine)
QgsTextRenderer.drawDocumentOnLine = staticmethod(QgsTextRenderer.drawDocumentOnLine)
QgsTextRenderer.drawPart = staticmethod(QgsTextRenderer.drawPart)
QgsTextRenderer.fontMetrics = staticmethod(QgsTextRenderer.fontMetrics)
QgsTextRenderer.textWidth = staticmethod(QgsTextRenderer.textWidth)
QgsTextRenderer.textHeight = staticmethod(QgsTextRenderer.textHeight)
QgsTextRenderer.textRequiresWrapping = staticmethod(QgsTextRenderer.textRequiresWrapping)
QgsTextRenderer.wrappedText = staticmethod(QgsTextRenderer.wrappedText)
QgsTextRenderer.calculateScaleFactorForFormat = staticmethod(QgsTextRenderer.calculateScaleFactorForFormat)