Exemple #1
0
 def reset_default_all_positions(self, characters=None):
     """ Delete all characters files (if characters is None) or only the
         positions of the characters (in array characters) to reset the
         positions """
     for char in self.__all_characters:
         if (characters is None) or (char in characters):
             Character(char).reset_default_positions()
             for c in self.valid_characters:
                 if (c.val == char):
                     c.load_positions()
Exemple #2
0
 def __init__(self, type):
     self.__positions = []
     self.__letters = list(Letter(None).valid_letters())
     self.__symbols = list(Symbol(None).valid_symbols())
     self.__punctuations = list(Punctuation(None).valid_punctuations())
     self.__extendeds = list(Extended(None).valid_extendeds())
     self.__accents = list(Accent(None).valid_accents())
     self.__all_characters = self.__letters + self.__symbols + \
         self.__punctuations + self.__extendeds + self.__accents
     self.valid_characters = []
     self.change_type(type)
     # If data/current/ directory is empty, put the default files in it
     if len(os.listdir('engine/data/current/')) < len(
             self.__all_characters):
         missing_characters = []
         for char in self.__all_characters:
             c = Character(char)
             c.load_positions()
             if c.positions is None:
                 missing_characters.append(char)
         self.reset_default_all_positions(missing_characters)