def _on_customize_button(self): editor = PresetEditor(self._current_preset_data) self._logic_settings_window = LogicSettingsWindow( self._window_manager, editor) self._logic_settings_window.on_preset_changed( editor.create_custom_preset_with()) editor.on_changed = lambda: self._logic_settings_window.on_preset_changed( editor.create_custom_preset_with()) result = self._logic_settings_window.exec_() self._logic_settings_window = None if result == QDialog.Accepted: self._add_new_preset(editor.create_custom_preset_with())
async def _on_customize_button(self): if self._logic_settings_window is not None: self._logic_settings_window.raise_() return editor = PresetEditor(self._current_preset_data.get_preset()) self._logic_settings_window = LogicSettingsWindow(self._window_manager, editor) self._logic_settings_window.on_preset_changed(editor.create_custom_preset_with()) editor.on_changed = lambda: self._logic_settings_window.on_preset_changed(editor.create_custom_preset_with()) result = await async_dialog.execute_dialog(self._logic_settings_window) self._logic_settings_window = None if result == QDialog.Accepted: self._add_new_preset(VersionedPreset.with_preset(editor.create_custom_preset_with()))
async def _on_customize_preset(self): if self._logic_settings_window is not None: self._logic_settings_window.raise_() return old_preset = self._current_preset_data.get_preset() if old_preset.base_preset_uuid is None: old_preset = old_preset.fork() editor = PresetEditor(old_preset) self._logic_settings_window = CustomizePresetDialog(self._window_manager, editor) self._logic_settings_window.on_preset_changed(editor.create_custom_preset_with()) editor.on_changed = lambda: self._logic_settings_window.on_preset_changed(editor.create_custom_preset_with()) result = await async_dialog.execute_dialog(self._logic_settings_window) self._logic_settings_window = None if result == QtWidgets.QDialog.Accepted: self._add_new_preset(VersionedPreset.with_preset(editor.create_custom_preset_with()))