def icon(self, appid: str) -> Optional[QIcon]: fn = QStandardPaths.locate(QStandardPaths.AppConfigLocation, "app_icons/" + appid + ".png") if fn == "": return None return QIcon(QPixmap(fn))
def main(): app = QApplication([]) QApplication.setApplicationName("OneHandTextEdit") QApplication.setOrganizationName("PMA") file_name = 'regex_map.json' dict_src: str = QStandardPaths.locate(QStandardPaths.AppDataLocation, file_name) if not dict_src: dict_src = file_name # TODO Change to app's packaged resource for deploy. with open(dict_src) as f: regex_map: dict = json.load(f) app.aboutToQuit.connect(functools.partial(save_dictionary, file_name, dict_src, regex_map)) main_win = MainWindow(regex_map, dict_src=dict_src) main_win.show() sys.exit(app.exec_())