robofab.tools.rfPrefs
index
/code/projects/robofab/Lib/robofab/tools/rfPrefs.py

A simple module for dealing with preferences that are used by scripts. Based almost entirely on MacPrefs.
 
To save some preferences:
myPrefs = RFPrefs(drive/directory/directory/myPrefs.plist)
myPrefs.myString = 'xyz'
myPrefs.myInteger = 1234
myPrefs.myList = ['a', 'b', 'c']
myPrefs.myDict = {'a':1, 'b':2}
myPrefs.save()
 
To retrieve some preferences:
myPrefs = RFPrefs(drive/directory/directory/myPrefs.plist)
myString = myPrefs.myString
myInteger = myPrefs.myInteger
myList = myPrefs.myList
myDict = myPrefs.myDict
 
When using this module within FontLab, it is not necessary to
provide the RFPrefs class with a path. If a path is not given,
it will look for a file in FontLab/RoboFab Data/RFPrefs.plist.
If that file does not exist, it will make it.

 
Modules
       
os

 
Classes
       
_PrefObject
RFPrefs

 
class RFPrefs(_PrefObject)
    The main preferences object to call
 
  Methods defined here:
__getattr__(self, attr)
__init__(self, path=None)
save(self)
save the plist file

Methods inherited from _PrefObject:
__delattr__(self, attr)
__len__(self)
__setattr__(self, attr, value)
asDict(self)

 
Functions
       
StringIO(...)
StringIO([s]) -- Return a StringIO-like stream for reading or writing