Renamewindow

This commit is contained in:
Mizaki 2024-04-11 00:25:58 +01:00
parent 29dc7ad830
commit 003b68b3d3
3 changed files with 9 additions and 7 deletions

View File

@ -231,7 +231,7 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
ca = ComicArchive(self.current_match_set.original_path)
# TODO should this follow the same as CLI: filename (-f), read styles (-t), command line (-m)
# TODO Same is used for taggerwindow.py:~1734 Make a method?
# TODO Same is used for taggerwindow.py:~1734/renamewindow Make a method?
md = GenericMetadata()
try:
for style in self.load_data_styles.keys():

View File

@ -39,7 +39,7 @@ class RenameWindow(QtWidgets.QDialog):
self,
parent: QtWidgets.QWidget,
comic_archive_list: list[ComicArchive],
data_style: str,
data_styles: dict[str, int],
config: settngs.Config[ct_ns],
talkers: dict[str, ComicTalker],
) -> None:
@ -48,7 +48,9 @@ class RenameWindow(QtWidgets.QDialog):
with (ui_path / "renamewindow.ui").open(encoding="utf-8") as uifile:
uic.loadUi(uifile, self)
self.label.setText(f"Preview (based on {metadata_styles[data_style].name()} tags):")
self.label.setText(
f"Preview (based on {', '.join([f'{metadata_styles[style].name()}' for style in data_styles.keys()])} tags):"
)
self.setWindowFlags(
QtCore.Qt.WindowType(
@ -61,7 +63,7 @@ class RenameWindow(QtWidgets.QDialog):
self.config = config
self.talkers = talkers
self.comic_archive_list = comic_archive_list
self.data_style = data_style
self.data_styles = data_styles
self.rename_list: list[str] = []
self.btnSettings.clicked.connect(self.modify_settings)
@ -82,7 +84,7 @@ class RenameWindow(QtWidgets.QDialog):
new_ext = ca.extension()
if md is None or md.is_empty:
md = ca.read_metadata(self.data_style)
md, success = self.parent().overlay_ca_read_style(self.load_data_styles, ca)
if md.is_empty:
md = ca.metadata_from_filename(
self.config[0].Filename_Parsing__filename_parser,

View File

@ -1744,6 +1744,7 @@ class TaggerWindow(QtWidgets.QMainWindow):
# read in metadata, and parse file name if not there
# TODO should this follow the same as CLI: filename (-f), read styles (-t), command line (-m)
# Duplicated in autotagmatchwindow and renamewindow
md = GenericMetadata()
try:
for style in self.load_data_styles.keys():
@ -2151,8 +2152,7 @@ class TaggerWindow(QtWidgets.QMainWindow):
if self.dirty_flag_verification(
"File Rename", "If you rename files now, unsaved data in the form will be lost. Are you sure?"
):
# dlg = RenameWindow(self, ca_list, self.load_data_styles, self.config, self.talkers)
dlg = RenameWindow(self, ca_list, "cr", self.config, self.talkers)
dlg = RenameWindow(self, ca_list, self.load_data_styles, self.config, self.talkers)
dlg.setModal(True)
if dlg.exec() and self.comic_archive is not None:
self.fileSelectionList.update_selected_rows()