On Jan 3, 2011, at 12:25 AM, José Romero wrote:

> Hello! in the application i use some settings the user can change (for
> example the amount of sales tax that applies to all transactions). I
> make use of those settings in my business logic layer, and have
> extended the PreferenceDialog class to include GUI elements to edit
> those settings (just like the tutorial in the wiki says). 
> 
> My question is: what is the correct way to declare default values for
> those settings? Should i test for their existence as soon as the app
> loads and set them to the defaults if they don't? Is there a class i
> can extend, or a data structure i can fill?

        There's no way to declare default values for preference values; 
instead, I use the approach you describe: read them in at startup, and if they 
don't exist, set them to defaults. Sample:

pm = self.PreferenceManager
val = pm.getValue("some_pref")
if not val:
        val = pm.some_pref = "My Default Value"



-- Ed Leafe



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to