View Single Post
Old 09-06-2026, 11:52 AM   #161
Heinz Bundschuh
Junior Member
Heinz Bundschuh began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Sep 2025
Device: Sony
Settings on the “General” and “Content” tabs (Preferred Mode / Translation Position) may be lost without warning
Version tested: v2.4.2
First of all, I use the Ebook Translator for Calibre quite often; the plugin provides me with EPUBs translated into my preferred language, the software offers a wide range of customisation options, and books are processed very quickly.
However, I have also discovered a bug: whilst changes are saved in the settings dialogue, once ‘advanced’ mode is launched, the settings I’ve configured are no longer active. Books are still translated, but the translation engine and translation position – along with the changed colours – are not applied.
In batch mode, the settings are applied, but the colour settings under ‘translation text colour’ are applied incorrectly.

Bug

In setting.py, the "Preferred Mode" radio buttons (General tab) and the "Translation Position" radio buttons (Content tab) write directly into self.config on idClicked:

python
mode_btn_group.idClicked.connect(
lambda btn_id: self.config.update(preferred_mode=mode_map.get(btn _id)))
...
self.config.update(translation_position=position_m ap.get(btn_id))

Every other setting on these tabs is only collected in update_general_config() / update_content_config(), which run exclusively when that tab's own "Save" button is pressed, followed by self.config.commit().

Because these two radio groups bypass that flow, and because both have an immediate live preview (mode icon behavior isn't previewed, but position/color have a visible preview position_samples / color swatch), it's easy to assume the choice is already active. If the dialog is closed without pressing that tab's "Save" button, the change is discarded — self.config.update() only touches the in-memory Configuration object for that dialog instance; nothing is written to disk until .commit() runs.

Reported symptom: After changing "Original text position"/colors on the Content tab, Advanced Mode output kept using the old position/colors, even after clearing the cache. Root cause was the missing commit, not the translation logic.

Fix

Store the selection in an instance attribute instead of writing straight to self.config, and persist it inside update_general_config() / update_content_config() together with the rest of that tab, so it's only committed when "Save" is actually clicked (consistent with every other setting):

python
# General tab
self.preferred_mode = preferred_mode
mode_btn_group.idClicked.connect(
lambda btn_id: setattr(self, 'preferred_mode', mode_map.get(btn_id)))
...
def update_general_config(self):
self.config.update(preferred_mode=self.preferred_m ode)
...

# Content tab
self.translation_position = map_key
...
def choose_option(btn_id):
...
self.translation_position = position_map.get(btn_id)
...
def update_content_config(self):
self.config.update(translation_position=self.trans lation_position)
...
Heinz Bundschuh is offline   Reply With Quote