pythonguis / pyqtconfig

A PyQt config manager. Keep Qt widgets in sync with an config dictionary and/or QSettings object.
Other
133 stars 33 forks source link

Implement __getitem__ and __setitem__ methods #42

Open ziggycross opened 7 months ago

ziggycross commented 7 months ago

It seems the current approach for managing config is with .get and .set methods. I believe it would make sense to also implement __getitem__ and __setitem__ dunder methods in addition to this.

For example, the code example

config.set('number', 42)
config.get('number')

could also be written as

config["number"] = 42
config["number"]

Looking at the source, this should be a relatively small update to implement. If you think this would be acceptable, I am happy to add it myself and submit a PR.