48 Commits

Author SHA1 Message Date
Nyall Dawson
a6f5c50b36 Move some style related enums out of global namespace 2024-08-31 06:20:02 +10:00
merydian
1b892d683f Add suggestions 2024-08-21 09:05:41 +10:00
merydian
21a276fff2 Implement QgsRasterLayer.as_numpy 2024-08-21 09:05:41 +10:00
Nyall Dawson
41f8db6503 Don't leak typing into qgis.core 2024-08-20 16:40:32 +02:00
Nyall Dawson
262ade625e Don't leak LinePlacementFlags 2024-08-19 11:16:01 +02:00
Nyall Dawson
98f3ca0650 Don't leak mapping functions into core 2024-08-19 11:16:01 +02:00
Nyall Dawson
1c119bde15 Avoid leaking processing repr into core 2024-08-19 11:16:01 +02:00
Nyall Dawson
fa518f6795 Don't leak fromFunction into core 2024-08-19 11:16:01 +02:00
Nyall Dawson
3dbbb16aa6 Don't leak range repr functions into qgis.core 2024-08-19 11:16:01 +02:00
Nyall Dawson
85df8609c5 Don't leak dummy DirectionSymbols class into core 2024-08-19 11:16:01 +02:00
Nyall Dawson
deeada9a54 Avoid leaking more helper functions into qgis.core 2024-08-16 07:28:46 +10:00
Nyall Dawson
0bca48ddca Add docs for exception classes 2024-08-16 07:28:29 +10:00
Nyall Dawson
faa4670f4c Add docs for as_numpy 2024-08-15 13:38:54 +10:00
Nyall Dawson
83c58995b3 Don't leak numpy import into qgis.core 2024-08-15 13:38:54 +10:00
Till Frankenbach
93770eca37
Add Method to Convert QgsRasterBlock to NumPy Array (#58232) 2024-08-14 10:16:40 +02:00
Nyall Dawson
3aae3a9ee4 Remove redundant duplicate enum 2024-06-06 13:57:48 +10:00
Nyall Dawson
587a80dcc2 Move label quadrant setting to QgsLabelPointSettings 2024-05-23 17:20:30 +10:00
Nyall Dawson
65ba3ddfef Cleanup QgsRasterTransparency API
- Make classes less like to be created with uninitialized members
- Use opacity instead of transparency, to match API from elsewhere in
  QGIS
2024-03-04 07:25:51 +10:00
Even Rouault
f36caa7274 [Qt6] Fix crash with Python on QgsLocatorResult::userData (fixes #56456) 2024-02-28 06:04:20 +10:00
Nyall Dawson
2357d80d25 Avoid sip property code for old api compatibility
This causes crashes on Qt6. Use Python monkey patching instead.
2024-02-17 05:38:14 +10:00
Nyall Dawson
e95ec5bae9 Fix compatibility 2024-02-04 05:54:31 +10:00
Nyall Dawson
6df159f2a2 Add missing compatibility code 2024-02-04 05:54:31 +10:00
Nyall Dawson
3e07b06d87 Fix broken old API compatibility code on Qt 6 builds
The old sip based approach to handling property -> getter/setter
conversion is broken on sip6, so move the patching into Python.

Also fix incorrect checks in tests, and add additional test
for compatiblity code.
2024-02-04 05:54:31 +10:00
Nyall Dawson
ef4f8efdcc Remove unused 2018 WKT variants, monkey patch for api compatibility 2024-01-17 10:16:32 +10:00
Julien Cabieces
3e27ac5985 [PyQt6] Build PyQt6 2024-01-16 12:18:11 +10:00
Nyall Dawson
a39b5df615 Rename mesh "3d" classes to "3D" and monkey patch compatibility 2023-07-20 15:31:00 +10:00
Nyall Dawson
5967344117 Rename QgsBox3d to QgsBox3D for consistency, monkey patch in old
name for PyQGIS compatibility
2023-07-20 15:31:00 +10:00
Nyall Dawson
888dc334f5 Remove duplicate enum 2023-05-15 16:38:52 +10:00
Nyall Dawson
1142e8ffac
Move QgsMapLayerType enum to Qgis.LayerType (#51874)
For consistency with other enums
2023-02-16 13:02:57 +01:00
Nyall Dawson
6453d5f35a Condense duplicate enums 2021-10-23 05:16:41 +10:00
Nyall Dawson
9752abe10b Fix python startup 2021-10-23 05:16:41 +10:00
Nyall Dawson
75c787a4e6 Fix API break 2021-08-04 09:54:32 +10:00
Nyall Dawson
2724315a99 Move enums from QgsVectorLayer to Qgis, promote to enum classes,
and fix redundant QgsVectorLayer.VertexMarkerType enum
2021-07-19 14:02:39 +10:00
Damiano
1def5e7b94 Python QgsSettingsEnum and Flag unified in QgsSettingsEnumFlag 2021-04-26 15:10:53 +02:00
Damiano
3c5f9b1e91 Python implementation for QgsSettingsEntryEnum/Flag and fixed docstrings 2021-04-07 14:02:08 +02:00
Nyall Dawson
4fe99d8d6c Add better __repr__ methods for QgsDateTimeRange, QgsDateRange 2021-03-25 08:01:51 +10:00
Nyall Dawson
a913a6aa5a Create RAII QgsScopedRuntimeProfile class and Python context manager
to ease logging of runtime profiles.

Now it's possible to do:

    with QgsRuntimeProfiler.profile('My operation'):
      # do something

to automatically handle everything required to log the operation runtime
2020-05-19 04:35:34 +10:00
nirvn
60ee76bc69 Followup 1f3b039: fix wrong monkey patched var name 2019-11-05 16:03:25 +07:00
Matthias Kuhn
f9804eb6ce Python fixes 2019-11-02 15:02:00 +01:00
Matthias Kuhn
abf9880182 Cleanup python code 2019-11-02 15:01:59 +01:00
Matthias Kuhn
a50287514b Q_GLOBAL_STATIC for QgsDataProvider 2019-11-02 15:01:59 +01:00
Martin Dobias
90910b0447 Patch QgsProviderMetadata in Python to avoid API break
In C++ we do not support QgsProviderMetadata(key, description, createFunc) anymore,
but for python code we can have a patched class that still supports createFunc.

Why not keep the variant with createFunc in C++ as well? Because... SIP!
With newly added virtual methods in QgsProviderMetadata, SIP started to generate
a sip-specific subclass to handle derived classes in Python, however due to the variant
with PyObject* and custom MethodCode it was getting confused about what constructors
are available in C++ and failing to compile.
2019-06-21 18:27:36 +02:00
Bas Couwenberg
2628c480c5 Don't include revision in sources.
Prevent changes to files that weren't changed between releases.
This eases review of the changes between releases significantly.
2019-05-17 16:47:47 +02:00
Nyall Dawson
48d2a37057 [FEATURE] New line symbol type: Hash line
This line symbol type is designed to replicate the ArcGIS Hash Line
symbol layer type. It allows for a repeating line segment to be
drawn over the length of a feature, with a line-sub symbol used
to render each individual segment.

To reduce code duplication, this is heavily based off the current
line marker symbol layer, since the functionality is almost
identical (draw some sub symbol at some interval along a line).
Accordingly, I've split off QgsMarkerLineSymbolLayer to move
as much of the common functionality as possible to a new abstract
base class, so that only the actual marker/line segment rendering
occurs in the marker line/hash line subclasses.

This also gives the hash line all the existing placement options
permissible for marker lines -- e.g. first/last vertex, mid points,
regular intervals, etc.

The hash line length and angle can have data defined overrides,
which are evaluated per-line segment, allowing for the hash line
to change size and angle over the length of a single rendered
feature.
2019-04-03 02:31:27 +10:00
Nyall Dawson
fdfe0cee23 [api][needs-docs] Allow registering PyQGIS using a nice decorator syntax
This allows nice and simple, elegant construction of checks for
Python.

To use, Python based checks should use the decorator syntax:

  from qgis.core import check

  @check.register(type=QgsAbstractValidityCheck.TypeLayoutCheck)
  def my_layout_check(context, feedback):
    results = ...
    return results

Or, a more complete example. This one throws a warning when attempting
to export a layout with a map item set to the Web Mercator projection:

  @check.register(type=QgsAbstractValidityCheck.TypeLayoutCheck)
  def layout_map_crs_choice_check(context, feedback):
    layout = context.layout
    results = []
    for i in layout.items():
      if isinstance(i, QgsLayoutItemMap) and i.crs().authid() == 'EPSG:3857':
        res = QgsValidityCheckResult()
        res.type = QgsValidityCheckResult.Warning
        res.title='Map projection is misleading'
        res.detailedDescription='The projection for the map item {} is set to <i>Web Mercator (EPSG:3857)</i> which misrepresents areas and shapes. Consider using an appropriate local projection instead.'.format(i.displayName())
        results.append(res)

    return results
2019-01-11 09:51:04 +10:00
Denis Rouzaud
7dfec1fde0 [pyqgis] add misssing QgsSettings.setEnumValue
also fix sections in enumValue and flagValue
2018-06-21 05:29:16 -08:00
Denis Rouzaud
164f662dc0 fix sipify and run 2018-06-03 11:07:09 -08:00
Denis Rouzaud
e5b02cd2a8 use dedicated files for auto additions 2018-06-03 11:07:09 -08:00