Exemple #1
0
    def get_defaults_entry(self):

        filename_default = self.get_vendor() + "-" + self.get_model()
        filename_default = filename_default.replace(' ', '_')
        filename_default += '.defaults'

        if isinstance(self.de, DefaultsEntry.DefaultsEntry):
            return self.de

        if os.path.exists(os.path.join(utils.get_defaults_path(), filename_default)):
            self.de = DefaultsEntry.DefaultsEntry(filename_default)
            return self.de

        if not os.path.exists(utils.get_defaults_path()):
            os.makedirs(utils.get_defaults_path(), 0775)

        fp = open(os.path.join(utils.get_defaults_path(), filename_default), 'w')
        fp.write('[Defaults Entry]')
        fp.close()
        self.de = DefaultsEntry.DefaultsEntry(filename_default)
        return self.de
Exemple #2
0
 def new(self, filename):
     self.content = dict()
     self.addGroup(self.defaultGroup)
     self.filename = os.path.join(utils.get_defaults_path(), filename)
Exemple #3
0
 def __init__(self, filename=None):
     self.content = dict()
     self.parse(os.path.join(utils.get_defaults_path(), filename))