diff --git a/comicapi/metadata/comet.py b/comicapi/metadata/comet.py index 154b29e..4e2106a 100644 --- a/comicapi/metadata/comet.py +++ b/comicapi/metadata/comet.py @@ -47,29 +47,31 @@ class CoMet(Metadata): self.comet_filename = "CoMet.xml" self.file = "CoMet.xml" self.supported_attributes = { - "characters", + "series", + "issue", + "title", + "volume", + "genres", "description", + "publisher", + "language", + "format", + "maturity_rating", + "month", + "year", + "page_count", + "characters", "credits", "credits.person", "credits.primary", "credits.role", - "format", - "genres", - "identifier", - "is_version_of", - "issue", - "language", - "last_mark", - "maturity_rating", - "month", - "page_count", "price", - "publisher", + "is_version_of", "rights", - "series", - "title", - "volume", - "year", + "identifier", + "last_mark", + "pages.type", # This is required for setting the cover image none of the other types will be saved + "pages", } def supports_credit_role(self, role: str) -> bool: diff --git a/comicapi/metadata/comicbookinfo.py b/comicapi/metadata/comicbookinfo.py index c1e91f4..96f3183 100644 --- a/comicapi/metadata/comicbookinfo.py +++ b/comicapi/metadata/comicbookinfo.py @@ -83,25 +83,25 @@ class ComicBookInfo(Metadata): super().__init__(version) self.supported_attributes = { + "series", + "issue", + "issue_count", + "title", + "volume", + "volume_count", + "genres", "description", + "publisher", + "month", + "year", + "language", "country", + "critical_rating", + "tags", "credits", "credits.person", "credits.primary", "credits.role", - "critical_rating", - "genres", - "issue", - "issue_count", - "language", - "month", - "publisher", - "series", - "tags", - "title", - "volume", - "volume_count", - "year", } def supports_credit_role(self, role: str) -> bool: diff --git a/comicapi/metadata/comicrack.py b/comicapi/metadata/comicrack.py index d397ac6..01a79f6 100644 --- a/comicapi/metadata/comicrack.py +++ b/comicapi/metadata/comicrack.py @@ -45,29 +45,32 @@ class ComicRack(Metadata): self.file = "ComicInfo.xml" self.supported_attributes = { - "alternate_count", - "alternate_number", - "alternate_series", - "black_and_white", - "characters", - "description", - "credits", - "credits.person", - "credits.role", - "critical_rating", - "day", - "format", - "genres", - "imprint", + "series", "issue", "issue_count", - "language", - "locations", - "manga", - "maturity_rating", - "month", + "title", + "volume", + "genres", + "description", "notes", - "page_count", + "alternate_series", + "alternate_number", + "alternate_count", + "story_arcs", + "series_groups", + "publisher", + "imprint", + "day", + "month", + "year", + "language", + "web_link", + "format", + "manga", + "black_and_white", + "maturity_rating", + "critical_rating", + "scan_info", "pages", "pages.bookmark", "pages.double_page", @@ -76,16 +79,13 @@ class ComicRack(Metadata): "pages.size", "pages.type", "pages.width", - "publisher", - "scan_info", - "series", - "series_groups", - "story_arcs", + "page_count", + "characters", "teams", - "title", - "volume", - "web_link", - "year", + "locations", + "credits", + "credits.person", + "credits.role", } def supports_credit_role(self, role: str) -> bool: diff --git a/comicapi/metadata/metadata.py b/comicapi/metadata/metadata.py index 39efc41..bc256ea 100644 --- a/comicapi/metadata/metadata.py +++ b/comicapi/metadata/metadata.py @@ -13,42 +13,37 @@ class Metadata: self.supported_attributes = { "tag_origin", "issue_id", + "series_id", "series", + "series_aliases", "issue", - "title", - "publisher", - "month", - "year", - "day", "issue_count", + "title", + "title_aliases", "volume", - "genre", - "language", - "comments", "volume_count", - "critical_rating", - "country", + "genres", + "description", + "notes", "alternate_series", "alternate_number", "alternate_count", + "story_arcs", + "series_groups", + "publisher", "imprint", - "notes", + "day", + "month", + "year", + "language", + "country", "web_link", "format", "manga", "black_and_white", - "page_count", "maturity_rating", - "story_arc", - "series_group", + "critical_rating", "scan_info", - "characters", - "teams", - "locations", - "credits", - "credits.person", - "credits.role", - "credits.primary", "tags", "pages", "pages.type", @@ -58,12 +53,19 @@ class Metadata: "pages.size", "pages.height", "pages.width", + "page_count", + "characters", + "teams", + "locations", + "credits", + "credits.person", + "credits.role", + "credits.primary", "price", "is_version_of", "rights", "identifier", "last_mark", - "cover_image", } def supports_credit_role(self, role: str) -> bool: diff --git a/comictaggerlib/pagelisteditor.py b/comictaggerlib/pagelisteditor.py index e64279e..b457a19 100644 --- a/comictaggerlib/pagelisteditor.py +++ b/comictaggerlib/pagelisteditor.py @@ -73,12 +73,11 @@ class PageListEditor(QtWidgets.QWidget): uic.loadUi(uifile, self) self.md_attributes = { - "page.image_index": [self.btnDown, self.btnUp, self.listWidget], - "page.type": self.cbPageType, - "page.double_page": self.chkDoublePage, - "page.bookmark": self.leBookmark, - # Python dicts are order preserving this must be placed last - "pages": [self.btnDown, self.btnUp, self.listWidget, self.cbPageType, self.chkDoublePage, self.leBookmark], + "pages.image_index": [self.btnDown, self.btnUp], + "pages.type": self.cbPageType, + "pages.double_page": self.chkDoublePage, + "pages.bookmark": self.leBookmark, + "pages": self, } self.pageWidget = CoverImageWidget(self.pageContainer, CoverImageWidget.ArchiveMode, None, None) @@ -119,9 +118,10 @@ class PageListEditor(QtWidgets.QWidget): def reset_page(self) -> None: self.pageWidget.clear() - self.cbPageType.setDisabled(True) - self.chkDoublePage.setDisabled(True) - self.leBookmark.setDisabled(True) + self.cbPageType.setEnabled(False) + self.chkDoublePage.setEnabled(False) + self.leBookmark.setEnabled(False) + self.listWidget.clear() self.comic_archive = None self.pages_list = [] diff --git a/comictaggerlib/taggerwindow.py b/comictaggerlib/taggerwindow.py index 828c69d..9bcf76e 100644 --- a/comictaggerlib/taggerwindow.py +++ b/comictaggerlib/taggerwindow.py @@ -1205,11 +1205,13 @@ class TaggerWindow(QtWidgets.QMainWindow): credit_attributes = [x for x in self.md_attributes.items() if "credits." in x[0]] for r in range(self.twCredits.rowCount()): + w = self.twCredits.item(r, 1) + supports_role = style.supports_credit_role(str(w.text())) for credit in credit_attributes: widget_enabled = credit[0] in enabled widget = self.twCredits.item(r, credit[1]) if credit[0] == "credits.role": - widget_enabled = widget_enabled and style.supports_credit_role(str(widget.text())) + widget_enabled = widget_enabled and supports_role enable_widget(widget, widget_enabled) def update_metadata_style_tweaks(self) -> None: @@ -1217,7 +1219,7 @@ class TaggerWindow(QtWidgets.QMainWindow): enabled_widgets = metadata_styles[self.save_data_style].supported_attributes for metadata, widget in self.md_attributes.items(): - if isinstance(widget, QtWidgets.QWidget): + if widget is not None and not isinstance(widget, (int)): enable_widget(widget, metadata in enabled_widgets) self.update_metadata_credit_colors() diff --git a/comictaggerlib/ui/qtutils.py b/comictaggerlib/ui/qtutils.py index ea335a6..c85f18c 100644 --- a/comictaggerlib/ui/qtutils.py +++ b/comictaggerlib/ui/qtutils.py @@ -164,7 +164,7 @@ if qt_available: def _enable_widget(widget: QtWidgets.QWidget, enable: bool) -> None: global active_palette - if not (widget and active_palette and widget): + if not (widget is not None and active_palette is not None): return active_color = active_palette.color(QtGui.QPalette.ColorRole.Base) @@ -184,6 +184,9 @@ if qt_available: inactive_palette3.setColor(widget.foregroundRole(), inactive_color) return inactive_palette1, inactive_palette2, inactive_palette3 + if hasattr(widget, "setEnabled"): + widget.setEnabled(enable) + if enable: if isinstance(widget, QtWidgets.QTableWidgetItem): widget.setBackground(active_brush)