Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Alex-Kent
Copy link
Contributor

This code replaces the code that I wrote to manually extract a layer's path from its URI with code that uses the QGIS API to do the path extraction and decoding. I think using only the QGIS API with no fallback is fine since that is what QGIS and the providers use themselves.

The code has some extra logging statements that are only intended for testing, these are prefixed with TBR: ("To Be Removed"). If the code looks good to you then I'll push an update that does not have these logging statements.

The code has been actively and passively tested on Linux and Windows (including behavior with unsupported layer types, e.g. ArcGIS REST layers) and no issues were observed.

Fixes #7 and #8

@evetion
Copy link
Owner

evetion commented Feb 18, 2025

LGTM! Thanks for the quick fix. Feel free to remove the extra log statements as you mentioned. My only nitpick is that you could make a small utility to merge the messagebar and logmessages if the message is the same.

@Alex-Kent
Copy link
Contributor Author

Question: I presume test.py can be deleted since the code it tests is no longer present; does anything else test-related need to be changed/removed?

make a small utility to merge the messagebar and logmessages if the message is the same

I'll include this in my push.

@evetion
Copy link
Owner

evetion commented Feb 18, 2025

Good point, test.py can indeed be deleted.

…ugs evetion#7 and evetion#8)

• Added warn_and_log(…) method to both notify user and log a message
• All valid selected layers will be watched even if selection includes unwatchable ones
• Removed no-longer-needed test.py file
• Removed log messages intended only for testing (the "TBR:" ones)
@Alex-Kent
Copy link
Contributor Author

Alex-Kent commented Feb 19, 2025

Just pushed the changes we've been discussing (414ec89). Code was tested and one [unrelated] issue was seen and addressed, see below. This code should be ready to merge.

The issue that I encountered was that if one requested watching of a mix of watchable and unwatchable layers then no watchable selected layers after the first unwatchable one would be added. This was fixed by changing return to continue in the relevant tests (i.e. on encountering an unwatchable layer the code won't continue the current iteration of the loop but will continue with the next layer in loop).

@evetion evetion merged commit e9ec148 into evetion:main Feb 19, 2025
@evetion
Copy link
Owner

evetion commented Feb 19, 2025

Nice find, merged. I'll make a new release. :)

@Alex-Kent
Copy link
Contributor Author

I'll make a new release.

Before you do I have a bunch of minor changes I'd like to push (mostly documentation changes IIRC). I'll push them shortly.

@Alex-Kent
Copy link
Contributor Author

Pull request #10 includes the suggested changes I mentioned in my previous post.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

extract_path_from_uri does not work for file:// URIs on Windows

2 participants