Add a new Config class that sets project level configurations to the qgs file#156
Merged
Conversation
9021632 to
9f5067d
Compare
…e qgs file
Previously one was required to use `ProjectProperties` and to explicitly define
a getter and setter for a given property. This was tiresome, repetitive
and error prone.
Defining settings now is much more simplistic:
```
class Config:
def __init__(self, project: QgsProject) -> None:
self.project = project
create_base_map = pfield(bool, "/createBaseMap", False)
```
Where `pfield` is a function that takes:
1) data type of the project property
2) path of the property after the prefix (prefix is `QFieldSync`)
3) default value of the property if any
The rest of the "magic" is within the `Field` type.
This is very similar to what `settings_manager` does and it will eventually
replace it.
9f5067d to
64cda35
Compare
nirvn
approved these changes
May 11, 2026
Member
nirvn
left a comment
There was a problem hiding this comment.
Definitely makes the whole project properties side of things easier to maintain / expand
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously one was required to use
ProjectPropertiesand to explicitly define a getter and setter for a given property. This was tiresome, repetitiveand error prone.
Defining settings now is much more simplistic:
Where
pfieldis a function that takes:QFieldSync) 3) default value of the property if anyThe rest of the "magic" is within the
Fieldtype.This is very similar to what
settings_managerdoes and it will eventually replace it.