def __init__(self, lang=None): if lang in [None, '']: lang = i18n.language.info().get('language', 'en') print_error('language', lang) filename = filenames.get(lang[0:2], 'english.txt') if getattr( sys, 'frozen' , None): path = os.path.join(sys._MEIPASS + "/data/wordlist", filename) else: path = os.path.join(util.data_dir(), 'wordlist', filename) s = open(path,'r').read().strip() s = unicodedata.normalize('NFKD', s.decode('utf8')) lines = s.split('\n') self.wordlist = [] for line in lines: line = line.split('#')[0] line = line.strip(' \r') assert ' ' not in line if line: self.wordlist.append(line) print_error("wordlist has %d words"%len(self.wordlist))
def load_theme_paths(): theme_paths = {} theme_paths.update(theme_dirs_from_prefix(util.data_dir())) return theme_paths
def load_theme_paths(): theme_paths = {} theme_dir = os.path.join(util.data_dir(), 'themes') theme_paths.update(theme_dirs_from_prefix(theme_dir)) return theme_paths