def createLanguageMenu(self): langPath = get_app_path() + Setup.LANG_PATH + os.sep langDirectory = QDir(langPath) for language_file in langDirectory.entryList(['*.qm']): language_code = language_file.split('.')[0] language = QLocale.languageToString(QLocale(language_code).language()) language_icon = QIcon(langPath + language_code + '.png') action = QAction(language_icon, language, self) action.setCheckable(True) action.setData(language_code) self.menuLanguage.addAction(action) self.langGroup.addAction(action)
def clean_up_images(): temp_dir = QDir("{}/{}".format(QDir().tempPath(), APPLICATION)) temp_dir.setNameFilters(["*.cover"]) for file in temp_dir.entryList(): temp_dir.remove(file)