diff --git a/README.md b/README.md index e48b04e..0d317ad 100644 --- a/README.md +++ b/README.md @@ -225,6 +225,7 @@ Version History * Update the Settings Dialog when a new VDU becomes available. * Light-metering: show both a lux-auto indicator (an orange "LED") AND the current preset (if any) in the app icon. * Fix first time use crash (issue #60). + * Allow % in config files by turning off ConfigParser interpolation (issue #60). * 1.11.0 * Made vdu_controls ddcutil-2.0-ready. * Added support for ddcutil versions earlier than 1.3 (issue #43, #53). diff --git a/vdu_controls.changes b/vdu_controls.changes index d0aa970..0ed50ad 100644 --- a/vdu_controls.changes +++ b/vdu_controls.changes @@ -7,6 +7,7 @@ Tue 12 Sep 2023 20:59:00 UTC - Michael Hamilton * Update the Settings Dialog when a new VDU becomes available. * Light-metering: show both a lux-auto indicator (an orange "LED") AND the current preset (if any) in the app icon. * Fix first time use crash (issue #60). + * Allow % in config files by turning off ConfigParser interpolation (issue #60). ------------------------------------------------------------------- Sun 24 Jun 2023 21:50:00 UTC - Michael Hamilton diff --git a/vdu_controls.py b/vdu_controls.py index 8eccc85..76af31e 100755 --- a/vdu_controls.py +++ b/vdu_controls.py @@ -1361,7 +1361,7 @@ def query_capabilities(self, vdu_number: str) -> str: """Return a vpc capabilities string.""" result = self.__run__(*['capabilities'] + self.id_key_args(vdu_number), log_id=vdu_number) capability_text = result.stdout.decode('utf-8', errors='surrogateescape') - return capability_text.replace('%', '') + return capability_text def get_type(self, vcp_code) -> str | None: return self.vcp_type_map[vcp_code] if vcp_code in self.vcp_type_map else None @@ -1651,7 +1651,7 @@ class ConfigIni(configparser.ConfigParser): METADATA_TIMESTAMP_OPTION = "timestamp" def __init__(self) -> None: - super().__init__() + super().__init__(interpolation=None) if not self.has_section(ConfigIni.METADATA_SECTION): self.add_section(ConfigIni.METADATA_SECTION) @@ -1789,7 +1789,7 @@ def get_capabilities_alt_text(self) -> str: return self.ini_content['ddcutil-capabilities']['capabilities-override'] def set_capabilities_alt_text(self, alt_text: str) -> None: - self.ini_content['ddcutil-capabilities']['capabilities-override'] = alt_text.replace("%", "%%") + self.ini_content['ddcutil-capabilities']['capabilities-override'] = alt_text def enable_supported_vcp_code(self, vcp_code: str) -> None: self.ini_content['vdu-controls-widgets'][SUPPORTED_VCP_BY_CODE[vcp_code].property_name()] = 'yes' @@ -1845,7 +1845,7 @@ def parse_file(self, config_path: Path) -> None: alt_text = preserve_indents_match.group(1) if preserve_indents_match is not None else '' # Remove excess indentation while preserving the minimum existing indentation. alt_text = inspect.cleandoc(alt_text) - self.ini_content['ddcutil-capabilities']['capabilities-override'] = alt_text.replace('%', '') + self.ini_content['ddcutil-capabilities']['capabilities-override'] = alt_text def reload(self) -> None: log_info(f"Reloading config: {self.file_path}") @@ -2512,7 +2512,7 @@ def __init__(self, section_editor: SettingsEditorTab, option: str, section: str, text_editor = QPlainTextEdit(section_editor.ini_editable[section][option]) def text_changed() -> None: - section_editor.ini_editable[section][option] = text_editor.toPlainText().replace("%", "%%") + section_editor.ini_editable[section][option] = text_editor.toPlainText() text_editor.textChanged.connect(text_changed) layout.addWidget(text_editor)