diff --git a/comictaggerlib/ctsettings/file.py b/comictaggerlib/ctsettings/file.py index a61c58b..a6901f7 100644 --- a/comictaggerlib/ctsettings/file.py +++ b/comictaggerlib/ctsettings/file.py @@ -19,6 +19,12 @@ def general(parser: settngs.Manager) -> None: help="Disable the ComicRack metadata type", ) parser.add_setting("use_short_metadata_names", default=False, action=argparse.BooleanOptionalAction, cmdline=False) + parser.add_setting( + "--prompt-on-save", + default=True, + action=argparse.BooleanOptionalAction, + help="Prompts the user to confirm saving tags when using the GUI.", + ) def internal(parser: settngs.Manager) -> None: diff --git a/comictaggerlib/ctsettings/settngs_namespace.py b/comictaggerlib/ctsettings/settngs_namespace.py index 3a3accf..faafdea 100644 --- a/comictaggerlib/ctsettings/settngs_namespace.py +++ b/comictaggerlib/ctsettings/settngs_namespace.py @@ -100,6 +100,7 @@ class SettngsNS(settngs.TypedNS): General__check_for_new_version: bool General__disable_cr: bool General__use_short_metadata_names: bool + General__prompt_on_save: bool Dialog_Flags__show_disclaimer: bool Dialog_Flags__dont_notify_about_this_version: str @@ -220,6 +221,7 @@ class General(typing.TypedDict): check_for_new_version: bool disable_cr: bool use_short_metadata_names: bool + prompt_on_save: bool class Dialog_Flags(typing.TypedDict): diff --git a/comictaggerlib/taggerwindow.py b/comictaggerlib/taggerwindow.py index c7c3c0d..8f22e76 100644 --- a/comictaggerlib/taggerwindow.py +++ b/comictaggerlib/taggerwindow.py @@ -1147,40 +1147,44 @@ class TaggerWindow(QtWidgets.QMainWindow): def commit_metadata(self) -> None: if self.metadata is not None and self.comic_archive is not None: - reply = QtWidgets.QMessageBox.question( - self, - "Save Tags", - f"Are you sure you wish to save {', '.join([metadata_styles[style].name() for style in self.save_data_styles])} tags to this archive?", - QtWidgets.QMessageBox.StandardButton.Yes, - QtWidgets.QMessageBox.StandardButton.No, - ) + if self.config[0].General__prompt_on_save: + reply = QtWidgets.QMessageBox.question( + self, + "Save Tags", + f"Are you sure you wish to save {', '.join([metadata_styles[style].name() for style in self.save_data_styles])} tags to this archive?", + QtWidgets.QMessageBox.StandardButton.Yes, + QtWidgets.QMessageBox.StandardButton.No, + ) + else: + reply = QtWidgets.QMessageBox.StandardButton.Yes - if reply == QtWidgets.QMessageBox.StandardButton.Yes: - QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.CursorShape.WaitCursor)) - self.form_to_metadata() + if reply != QtWidgets.QMessageBox.StandardButton.Yes: + return + QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.CursorShape.WaitCursor)) + self.form_to_metadata() - failed_style: str = "" - # Save each style - for style in self.save_data_styles: - success = self.comic_archive.write_metadata(self.metadata, style) - if not success: - failed_style = metadata_styles[style].name() - break + failed_style: str = "" + # Save each style + for style in self.save_data_styles: + success = self.comic_archive.write_metadata(self.metadata, style) + if not success: + failed_style = metadata_styles[style].name() + break - self.comic_archive.load_cache(list(metadata_styles)) - QtWidgets.QApplication.restoreOverrideCursor() + self.comic_archive.load_cache(list(metadata_styles)) + QtWidgets.QApplication.restoreOverrideCursor() - if failed_style: - QtWidgets.QMessageBox.warning( - self, - "Save failed", - f"The tag save operation seemed to fail for: {failed_style}", - ) - else: - self.clear_dirty_flag() - self.update_info_box() - self.update_menus() - self.fileSelectionList.update_current_row() + if failed_style: + QtWidgets.QMessageBox.warning( + self, + "Save failed", + f"The tag save operation seemed to fail for: {failed_style}", + ) + else: + self.clear_dirty_flag() + self.update_info_box() + self.update_menus() + self.fileSelectionList.update_current_row() self.metadata = self.comic_archive.read_metadata(self.load_data_style) self.update_ui_for_archive() diff --git a/comictaggerlib/ui/settingswindow.ui b/comictaggerlib/ui/settingswindow.ui index c98fb24..fa8e864 100644 --- a/comictaggerlib/ui/settingswindow.ui +++ b/comictaggerlib/ui/settingswindow.ui @@ -41,7 +41,24 @@ - + + + + Check for new version on startup + + + + + + + Use the short name for the metadata styles (CBI, CR, etc.) + + + Use "short" names for metadata styles + + + + @@ -54,7 +71,7 @@ - + @@ -68,22 +85,6 @@ - - - - 0 - 0 - - - - If you need to free up the disk space, or the responses seems out of date, clear the online cache. - - - true - - - - @@ -99,20 +100,26 @@ - - + + + + + 0 + 0 + + - Check for new version on startup + If you need to free up the disk space, or the responses seems out of date, clear the online cache. + + + true - - - - Use the short name for the metadata styles (CBI, CR, etc.) - + + - Use "short" names for metadata styles + Prompts the user to confirm saving tags