GUI overlay settings moved to internal namespace and CLI args added

This commit is contained in:
Mizaki 2024-04-21 01:04:58 +01:00
parent 94b94b76dc
commit e9a592df50
5 changed files with 6 additions and 22 deletions

View File

@ -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()

View File

@ -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)

View File

@ -172,19 +172,6 @@ def md_options(parser: settngs.Manager) -> None:
parser.add_setting("--cbl-apply-transform-on-import", default=False, action=argparse.BooleanOptionalAction)
parser.add_setting("--cbl-apply-transform-on-bulk-operation", default=False, action=argparse.BooleanOptionalAction)
parser.add_setting(
"--read-style-overlay",
default=OverlayMode.overlay,
type=OverlayMode,
help="How to overlay new metadata on the current for enabled read styles (CR, CBL, etc.)",
)
parser.add_setting(
"--source-overlay",
default=OverlayMode.overlay,
type=OverlayMode,
help="How to overlay the new metadata from a source (CV, Metron, GCD, etc.) on to the current",
)
parser.add_setting("use_short_metadata_names", default=False, action=argparse.BooleanOptionalAction, cmdline=False)
parser.add_setting(
"--disable-cr",

View File

@ -88,8 +88,6 @@ class SettngsNS(settngs.TypedNS):
Metadata_Options__cbl_copy_weblink_to_comments: bool
Metadata_Options__cbl_apply_transform_on_import: bool
Metadata_Options__cbl_apply_transform_on_bulk_operation: bool
Metadata_Options__read_style_overlay: OverlayMode
Metadata_Options__source_overlay: OverlayMode
Metadata_Options__use_short_metadata_names: bool
Metadata_Options__disable_cr: bool
@ -206,7 +204,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

View File

@ -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():