def import_hotbox(): filenames = QtWidgets.QFileDialog.getOpenFileName( None, caption='Import hotbox', directory=os.path.expanduser("~"), filter='*.json') if not filenames: return with open(filenames[0], 'r') as f: return ensure_old_data_compatible(json.load(f))
def load_hotboxes(application): hotboxes_datas = load_hotboxes_datas(application.local_file) file_ = application.shared_file hotboxes_datas += [ ensure_old_data_compatible(load_json(f)) for f in load_json(file_)] for hotboxes_data in hotboxes_datas: name = hotboxes_data['general']['name'] reader = HotboxReader(hotboxes_data, parent=None) reader.hideSubmenusRequested.connect(hide_submenus) hotboxes[name] = reader