Exemple #1
0
 def set_file(self, filename):
     load = self.ini is None
     self.ini = ini = FastINI(filename)
     if load:
         section = self.player.gameData.name
         for i in xrange(self.scoreCount):
             name = ini.get_key(section, 'N%s' % i)
             score = ini.get_key(section, 'S%s' % i)
             if score == '':
                 return
             score = int(score)
             self.scores[i] = (name, score)
Exemple #2
0
class DefaultObject(HiddenObject):
    filename = None
    group = None
    item = None
    config = None

    def created(self, data):
        filename = data.readString()
        self.load(filename)

    def load(self, filename):
        path = convert_path(filename)
        self.config = FastINI(path)

    def set_value(self, value, group=None, item=None):
        group = group or self.group
        item = item or self.item
        if group is None or item is None:
            return
        self.config.set_key(group, item, str(value))

    def get_value(self, group=None, item=None):
        group = group or self.group
        item = item or self.item
        if group is None or item is None:
            return ''
        return self.config.get_key(group, item)

    def remove_item(self, group=None, item=None):
        group = group or self.group
        item = item or self.item
        if group is None or item is None:
            return
        self.config.delete_key(group, item)

    def remove_group(self, group=None):
        group = group or self.group
        if group is None:
            return
        self.config.delete_section(group)
Exemple #3
0
class DefaultObject(HiddenObject):
    filename = None
    group = None
    item = None
    config = None
    def created(self, data):
        filename = data.readString()
        self.load(filename)
    
    def load(self, filename):
        path = convert_path(filename)
        self.config = FastINI(path)
    
    def set_value(self, value, group = None, item = None):
        group = group or self.group
        item = item or self.item
        if group is None or item is None:
            return
        self.config.set_key(group, item, str(value))
        
    def get_value(self, group = None, item = None):
        group = group or self.group
        item = item or self.item
        if group is None or item is None:
            return ''
        return self.config.get_key(group, item)
    
    def remove_item(self, group = None, item = None):
        group = group or self.group
        item = item or self.item
        if group is None or item is None:
            return
        self.config.delete_key(group, item)

    def remove_group(self, group = None):
        group = group or self.group
        if group is None:
            return
        self.config.delete_section(group)
Exemple #4
0
 def load(self, filename):
     path = convert_path(filename)
     self.config = FastINI(path)
Exemple #5
0
 def load(self, filename):
     path = convert_path(filename)
     self.config = FastINI(path)