示例#1
0
    def _on_import_preset(self):
        path = common_qt_lib.prompt_user_for_preset_file(self._window_manager,
                                                         new_file=False)
        if path is None:
            return

        try:
            preset = read_preset_file(path)
        except (ValueError, KeyError):
            QMessageBox.critical(
                self._window_manager, "Error loading preset",
                "The file at '{}' contains an invalid preset.".format(path))
            return

        if self._window_manager.preset_manager.preset_for_name(
                preset.name) is not None:
            user_response = QMessageBox.warning(
                self._window_manager, "Preset name conflict",
                "A preset named '{}' already exists. Do you want to overwrite it?"
                .format(preset.name), QMessageBox.Yes | QMessageBox.No,
                QMessageBox.No)
            if user_response == QMessageBox.No:
                return

        self._add_new_preset(preset)
示例#2
0
 def _on_export_preset(self):
     path = common_qt_lib.prompt_user_for_preset_file(self._window_manager,
                                                      new_file=True)
     if path is not None:
         save_preset_file(self._current_preset_data, path)
 def _on_export_preset(self):
     default_name = "{}.rdvpreset".format(self._current_preset_data.slug_name)
     path = common_qt_lib.prompt_user_for_preset_file(self._window_manager, new_file=True, name=default_name)
     if path is not None:
         self._current_preset_data.save_to_file(path)
 def _on_import_preset(self):
     path = common_qt_lib.prompt_user_for_preset_file(self._window_manager, new_file=False)
     if path is not None:
         self.import_preset_file(path)
 def _export_preset(self):
     preset = self.layout_description.get_preset(self.current_player_index)
     output_path = common_qt_lib.prompt_user_for_preset_file(self, new_file=True)
     if output_path is not None:
         VersionedPreset.with_preset(preset).save_to_file(output_path)