Exemple #1
0
 def save(self):
     """save the plist file"""
     f = StringIO()
     pl = Plist()
     for i in self._prefs.keys():
         pl[i] = self._prefs[i]
     pl.write(f)
     data = f.getvalue()
     f = open(self.__path, 'wb')
     f.write(data)
     f.close()
Exemple #2
0
 def save(self):
     """save the plist file"""
     f = StringIO()
     pl = Plist()
     for i in self._prefs.keys():
         pl[i] = self._prefs[i]
     pl.write(f)
     data = f.getvalue()
     f = open(self.__path, "wb")
     f.write(data)
     f.close()
Exemple #3
0
    def __init__(self, path=None):
        from robofab.world import world

        self.__path = path
        self._prefs = {}
        if world.inFontLab:
            # we don't have a path, but we know where we can put it
            if not path:
                from robofab.tools.toolsFL import makeDataFolder

                settingsPath = makeDataFolder()
                path = os.path.join(settingsPath, "RFPrefs.plist")
                self.__path = path
                self._makePrefsFile()
                # we do have a path, make sure it exists and load it
            else:
                self._makePrefsFile()
        else:
            # no path, raise error
            if not path:
                raise RoboFabError, "no preferences path defined"
                # we do have a path, make sure it exists and load it
            else:
                self._makePrefsFile()
        self._prefs = Plist.fromFile(path)
Exemple #4
0
 def __init__(self, path=None):
     from robofab.world import world
     self.__path = path
     self._prefs = {}
     if world.inFontLab:
         #we don't have a path, but we know where we can put it
         if not path:
             from robofab.tools.toolsFL import makeDataFolder
             settingsPath = makeDataFolder()
             path = os.path.join(settingsPath, 'RFPrefs.plist')
             self.__path = path
             self._makePrefsFile()
         #we do have a path, make sure it exists and load it
         else:
             self._makePrefsFile()
     else:
         #no path, raise error
         if not path:
             raise RoboFabError, "no preferences path defined"
         #we do have a path, make sure it exists and load it
         else:
             self._makePrefsFile()
     self._prefs = Plist.fromFile(path)