Expose setAllowCommit to Python (and other functions)#62951
Expose setAllowCommit to Python (and other functions)#62951sewe2000 wants to merge 30 commits intoqgis:masterfrom
Conversation
|
The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check
|
|
I'm -1 to the current approach used in this PR -- I think it's too complex and fragile to be suitable. I'd propose an alternative:
|
|
The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check
|
6833f4a to
19d4630
Compare
5271b22 to
be00190
Compare
🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. 🍎 MacOS Qt6 buildsDownload MacOS Qt6 builds of this PR for testing. |
|
The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check
|
|
@nyalldawson I think it's ready to be reviewed |
|
The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check
|
|
The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check
|
|
What is the status of this PR? is it going to be merged soon, or there is something more needed? (or are they any meta issues like dev team is too busy at the moment)? I am interested in this feature, but I would like to know about estimated schedule for this change (is it worth to wait for this a bit longer?). |
I didn't review your PR but I noticed that a couple of tests are failing: this is a blocker for merging in any situation. |
| return True | ||
|
|
||
| my_blocker = MyPluginCommitBlocker() | ||
| iface.registerApplicationExitBlocker(my_blocker) |
There was a problem hiding this comment.
| iface.registerApplicationExitBlocker(my_blocker) | |
| iface.registerLayerChangesCommitBlocker(my_blocker) |
There was a problem hiding this comment.
Please don't mark things resolved which aren't -- this makes reviewing VERY hard, and is part of the reason this PR is taking so long to get merged 😭
src/app/gps/qgsappgpsdigitizing.cpp
Outdated
| if ( QgsProject::instance()->gpsSettings()->automaticallyCommitFeatures() ) | ||
| { | ||
| if (!QgisApp::instance()->tryCommitChanges(vlayer)) { | ||
| vlayer->startEditing(); |
There was a problem hiding this comment.
| vlayer->startEditing(); |
src/app/qgisapp.cpp
Outdated
| if (!QgisApp::instance()->tryCommitChanges(vlayer)) { | ||
| mSaveRollbackInProgress = false; | ||
| return; | ||
| } |
There was a problem hiding this comment.
Let's move this up a couple of lines, so that it's included in this check:
if ( !vlayer || !vlayer->isEditable() || !vlayer->isModified() || !tryCommitChanges( vlayer ) )
That'd avoid the extra complication with the mSaveRollbackInProgress handling
src/app/qgisapp.cpp
Outdated
| messageBar()->pushWarning( tr("Committing changes to the layer is blocked"), | ||
| tr("The ability to commit changes to the '%1' layer has been blocked by a plugin or script").arg( layer->name() )); |
There was a problem hiding this comment.
The docs for QgsLayerChangesCommitBlockerInterface state "It is safe to use GUI widgets in implementations of this function, including message boxes or custom dialogs with event loops.". I'd leave responsibility for advising users of the situation entirely up to the QgsLayerChangesCommitBlockerInterface implementation -- that way the plugin/script can decide the best way to notify users, and avoid a potentially redundant generic warning showing here.
src/app/qgisapp.h
Outdated
| /** | ||
| * Displays a warning about layer `layer` being blocked from the process of | ||
| * committing changes using the messagebar. | ||
| * | ||
| **/ | ||
|
|
src/app/qgsguivectorlayertools.cpp
Outdated
| case QMessageBox::Save: | ||
| if (!QgisApp::instance()->tryCommitChanges(layer)) { | ||
| res = false; | ||
| layer->triggerRepaint(); |
There was a problem hiding this comment.
| layer->triggerRepaint(); |
Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com>
…e.sip.in Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com>
Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com>
…dings' into bug_18101-python-validation-bindings # Conflicts: # src/app/gps/qgsappgpsdigitizing.cpp
# Conflicts: # python/gui/auto_additions/qgisinterface.py # python/gui/auto_generated/qgisinterface.sip.in # python/gui/gui_auto.sip
…ings Update branch and fix pre-commit errors
Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com>
remove this nasty space from code-review suggestion at the end of line
previously there were some IDE "improvements"
there was a some error when commiting suggestion from github
|
The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check
|
Description
Hi.
I wanted to start a broader discussion about Python validation bindings. I would like to carry on with the idea represented in the PR #41455.
This PR is my solution to the problem. Please feel free to correct me. Any piece of advice is very valuable to me since I'm relatively new to the QGIS codebase.
Solves #53813