On May 14, 2012, at 2:31 AM, Allan Brooke wrote:

> I have been searching in code for how dabo saves various settings I believe
> to a SQLite database eg screen coordinates in the ClassDesigner.
> 
> Could anyone please point me to the code used for this purpose?
> 
> I am basically interested in saving dict values to a table in SQLite and
> being able to update same when changed.

        You could simply piggy-back on the Dabo PreferenceManager built into 
all Dabo classes. The general pattern is:

(setting)
pm = self.PreferenceManager
pm.lunch.entrees = ["steak", "salmon", "tofu"]

(getting)
pm = self.PreferenceManager
for entree in pm.lunch.entrees:
        print "You may eat %s" % entree

        All the saving happens pretty automagically. Just use standard 
dotted-object notation to set attributes of the ProjectManager, nesting them as 
much as needed. Later you can retrieve those values by just referencing the 
same path. Every object can have its own BasePrefKey value, which is the root 
of the path, so that you can keep your saved values separate.


-- 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