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

Feature Request: Default values in `add_handler()` function #9

Closed stlehmann closed 9 years ago

stlehmann commented 9 years ago

It seems a bit clumsy to me to define the default values separately in a set_default function. Implementing a default parameter in the add_handler() function would be more convenient.

mfitzp commented 9 years ago

My normal approach is to define the defaults in one go when creating the ConfigManager (either on the init call with defaults={'setting1':1, 'setting2':2} or afterwards with ConfigManager.set_defaults({'setting1':1, 'setting2':2}) ). This way you can set them all in one go, rather than when attaching the widgets.

Do you think it would still be useful to set them individually when attaching the handlers? I'm open to it (PR?) just not sure of the use case.

stlehmann commented 9 years ago

I prefer setting them at one go when defining my objects, their properties and their mapping. So I can see the object, it' s properties that I set and the mapping with default value one after each other. Though somebody else might see it different. Anyway I don' t see much harm in adding default as an optional parameter. So everybody can choose which way to go. As you suggested I made a small PR for this.

mfitzp commented 9 years ago

Merged PR #11