Пример #1
0
class FittingLibrary:
    def __init__(self):
        self.fitting_data = DataRetrieval("fittings.dat")

        self.fitting_list = self.fitting_data.data

    def get_fitting(self, fitting_name):
        """ Returns a the specified fitting instance. """
        return self.fitting_list[fitting_name]

    def get_fitting_list(self):
        """ Returns a list of the names of all fitting names as a tuple. """
        return tuple(self.fitting_list.keys())

    def save_fitting(self, fitting):
        """ """
        self.fitting_data.save_data(fitting)

    def delete_fitting(self, fitting):
        self.fitting_data.delete_data(fitting)
Пример #2
0
class CharacterLibrary:
    def __init__(self):
        self.character_data = DataRetrieval('characters.dat')

        self.character_list = self.character_data.data
        #self._load_characters('characters.dat')

    def get_character(self, char_name):
        """ Returns a the specified character instance. """
        return self.character_list[char_name]

    def get_character_list(self):
        """ Returns a list of the names of all characters as a tuple. """
        return tuple(self.character_list.keys())

    def save_character(self, character):
        """ """
        self.character_data.save_data(character)

    def delete_character(self, character):
        self.character_data.delete_data(character)