GUI overlay settings moved to internal namespace and CLI args added
This commit is contained in:
parent
b2f95faac4
commit
ffb4efbcd7
@ -262,7 +262,7 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
|
||||
return
|
||||
|
||||
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.CursorShape.WaitCursor))
|
||||
md.overlay(ct_md, self.config.Metadata_Options__source_overlay)
|
||||
md.overlay(ct_md, self.config.internal__source_data_overlay)
|
||||
for style in self._styles:
|
||||
success = ca.write_metadata(md, style)
|
||||
QtWidgets.QApplication.restoreOverrideCursor()
|
||||
|
@ -253,7 +253,7 @@ class CLI:
|
||||
if ca.has_metadata(style):
|
||||
try:
|
||||
t_md = ca.read_metadata(style)
|
||||
md.overlay(t_md, self.config.Metadata_Options__read_style_overlay)
|
||||
md.overlay(t_md, self.config.internal__load_data_overlay)
|
||||
break
|
||||
except Exception as e:
|
||||
logger.error("Failed to load metadata for %s: %s", ca.path, e)
|
||||
|
@ -27,7 +27,7 @@ import settngs
|
||||
|
||||
from comicapi import utils
|
||||
from comicapi.comicarchive import metadata_styles
|
||||
from comicapi.genericmetadata import GenericMetadata
|
||||
from comicapi.genericmetadata import GenericMetadata, OverlayMode
|
||||
from comictaggerlib import ctversion
|
||||
from comictaggerlib.ctsettings.settngs_namespace import SettngsNS as ct_ns
|
||||
from comictaggerlib.ctsettings.types import (
|
||||
@ -177,6 +177,18 @@ def register_runtime(parser: settngs.Manager) -> None:
|
||||
help="""Specify the type of tags to read.\nUse commas for multiple types.\nSee --list-plugins for the available types.\nThe tag use will be 'overlayed' in order:\ne.g. '-t cbl,cr' with no CBL tags, CR will be used if they exist and CR will overwrite any shared CBL tags.\n\n""",
|
||||
file=False,
|
||||
)
|
||||
parser.add_setting(
|
||||
"--read-style-overlay",
|
||||
type=OverlayMode,
|
||||
help="How to overlay new metadata on the current for enabled read styles (CR, CBL, etc.)",
|
||||
file=False,
|
||||
)
|
||||
parser.add_setting(
|
||||
"--source-overlay",
|
||||
type=OverlayMode,
|
||||
help="How to overlay new metadata from a data source (CV, Metron, GCD, etc.) on to the current",
|
||||
file=False,
|
||||
)
|
||||
parser.add_setting(
|
||||
"--overwrite",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
|
@ -27,6 +27,8 @@ def internal(parser: settngs.Manager) -> None:
|
||||
parser.add_setting("install_id", default=uuid.uuid4().hex, cmdline=False)
|
||||
parser.add_setting("save_data_style", default=["cbi"], cmdline=False)
|
||||
parser.add_setting("load_data_style", default=["cbi"], cmdline=False)
|
||||
parser.add_setting("load_data_overlay", default=OverlayMode.overlay, cmdline=False, type=OverlayMode)
|
||||
parser.add_setting("source_data_overlay", default=OverlayMode.overlay, cmdline=False, type=OverlayMode)
|
||||
parser.add_setting("last_opened_folder", default="", cmdline=False)
|
||||
parser.add_setting("window_width", default=0, cmdline=False)
|
||||
parser.add_setting("window_height", default=0, cmdline=False)
|
||||
|
@ -37,6 +37,8 @@ class SettngsNS(settngs.TypedNS):
|
||||
Runtime_Options__json: bool
|
||||
Runtime_Options__type_modify: list[str]
|
||||
Runtime_Options__type_read: list[str]
|
||||
Runtime_Options__read_style_overlay: OverlayMode
|
||||
Runtime_Options__source_overlay: OverlayMode
|
||||
Runtime_Options__overwrite: bool
|
||||
Runtime_Options__no_gui: bool
|
||||
Runtime_Options__files: list[str]
|
||||
@ -44,6 +46,8 @@ class SettngsNS(settngs.TypedNS):
|
||||
internal__install_id: str
|
||||
internal__save_data_style: list[str]
|
||||
internal__load_data_style: list[str]
|
||||
internal__load_data_overlay: OverlayMode
|
||||
internal__source_data_overlay: OverlayMode
|
||||
internal__last_opened_folder: str
|
||||
internal__window_width: int
|
||||
internal__window_height: int
|
||||
@ -202,7 +206,6 @@ class Metadata_Options(typing.TypedDict):
|
||||
cbl_copy_weblink_to_comments: bool
|
||||
cbl_apply_transform_on_import: bool
|
||||
cbl_apply_transform_on_bulk_operation: bool
|
||||
metadata_overlay: OverlayMode
|
||||
use_short_metadata_names: bool
|
||||
disable_cr: bool
|
||||
|
||||
|
@ -433,10 +433,10 @@ class SettingsWindow(QtWidgets.QDialog):
|
||||
self.config[0].Metadata_Options__cbl_apply_transform_on_bulk_operation
|
||||
)
|
||||
self.cbxOverlayReadStyle.setCurrentIndex(
|
||||
self.cbxOverlayReadStyle.findData(self.config[0].Metadata_Options__read_style_overlay.value)
|
||||
self.cbxOverlayReadStyle.findData(self.config[0].internal__load_data_overlay.value)
|
||||
)
|
||||
self.cbxOverlaySource.setCurrentIndex(
|
||||
self.cbxOverlaySource.findData(self.config[0].Metadata_Options__source_overlay.value)
|
||||
self.cbxOverlaySource.findData(self.config[0].internal__source_data_overlay.value)
|
||||
)
|
||||
self.cbxShortMetadataNames.setChecked(self.config[0].Metadata_Options__use_short_metadata_names)
|
||||
self.cbxDisableCR.setChecked(self.config[0].Metadata_Options__disable_cr)
|
||||
@ -570,8 +570,8 @@ class SettingsWindow(QtWidgets.QDialog):
|
||||
self.cbxApplyCBLTransformOnBatchOperation.isChecked()
|
||||
)
|
||||
|
||||
self.config[0].Metadata_Options__read_style_overlay = OverlayMode[self.cbxOverlayReadStyle.currentData()]
|
||||
self.config[0].Metadata_Options__source_overlay = OverlayMode[self.cbxOverlaySource.currentData()]
|
||||
self.config[0].internal__load_data_overlay = OverlayMode[self.cbxOverlayReadStyle.currentData()]
|
||||
self.config[0].internal__source_data_overlay = OverlayMode[self.cbxOverlaySource.currentData()]
|
||||
self.config[0].Metadata_Options__disable_cr = self.cbxDisableCR.isChecked()
|
||||
# Update metadata style names if required
|
||||
if self.config[0].Metadata_Options__use_short_metadata_names != self.cbxShortMetadataNames.isChecked():
|
||||
|
@ -217,6 +217,12 @@ class TaggerWindow(QtWidgets.QMainWindow):
|
||||
if config[0].Runtime_Options__type_read:
|
||||
config[0].internal__load_data_style = config[0].Runtime_Options__type_read
|
||||
|
||||
# Respect command line overlay settings
|
||||
if config[0].Runtime_Options__read_style_overlay:
|
||||
config[0].internal__load_data_overlay = config[0].Runtime_Options__read_style_overlay
|
||||
if config[0].Runtime_Options__source_overlay:
|
||||
config[0].internal__source_data_overlay = config[0].Runtime_Options__source_overlay
|
||||
|
||||
for style in config[0].internal__save_data_style:
|
||||
if style not in metadata_styles:
|
||||
config[0].internal__save_data_style.remove(style)
|
||||
|
Loading…
x
Reference in New Issue
Block a user