xxyzz / WordDumb

A calibre plugin that generates Kindle Word Wise and X-Ray files for KFX, AZW3, MOBI and EPUB eBook.
https://xxyzz.github.io/WordDumb/
GNU General Public License v3.0
376 stars 19 forks source link

Error when selecting Lemma/Gloss in "Customize Kindle Word Wise" #136

Closed mizake-mizan closed 1 year ago

mizake-mizan commented 1 year ago

Checkboxes

Describe the bug

ERROR: Unhandled exception: AttributeError:'QDialog' object has no attribute 'device_manager' when selecting "Lemma: English/Gloss: Chinese" (does not occur with other combinations)

System Information

Windows 11 Calibre 6.22

Error message

calibre, version 6.22.0
ERROR: Unhandled exception: <b>AttributeError</b>:'QDialog' object has no attribute 'device_manager'

calibre 6.22  embedded-python: True
Windows-10-10.0.23493-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.23493')
Python 3.10.1
Windows: ('10', '10.0.23493', 'SP0', 'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (2, 1, 0) && DeDRM (10, 0, 5) && Package KFX (from KFX Input) (2, 1, 0) && Count Pages (1, 13, 0) && Ebook Translator (2, 0, 3) && EpubMerge (2, 15, 0) && EpubSplit (3, 6, 0) && Extract ISBN (1, 6, 0) && KFX metadata reader (from KFX Input) (2, 1, 0) && KFX Input (2, 1, 0) && Set KFX metadata (from KFX Output) (2, 0, 0) && KFX Output (2, 0, 0) && Kindle hi-res covers (0, 5, 0) && Modify ePub (1, 8, 1) && Obok DeDRM (10, 0, 3) && Quality Check (1, 13, 4) && WordDumb (3, 29, 3)
Traceback (most recent call last):
  File "calibre_plugins.worddumb.config", line 261, in open_choose_lemma_lang_dialog
  File "calibre_plugins.worddumb.custom_lemmas", line 67, in __init__
  File "calibre_plugins.worddumb.custom_lemmas", line 83, in init_sql_table
  File "calibre_plugins.worddumb.custom_lemmas", line 213, in check_empty_kindle_gloss
  File "calibre_plugins.worddumb.send_file", line 192, in device_connected
AttributeError: 'QDialog' object has no attribute 'device_manager'

Reproduce steps

  1. Select "Preferences"
  2. Select "Customize Kindle Word Wise"
  3. Choose Lemma: English / Gloss: Chinese
  4. Hit "OK"

Screenshots or videos

No response

mizake-mizan commented 1 year ago

Note: A Kindle device is attached while running this operation.

xxyzz commented 1 year ago

There is nothing special about this language combination and I can't reproduce this error. Sorry, I genuinely don't know why this error happens.

mizake-mizan commented 1 year ago

Thanks for checking, I'll fiddle around further, it's probably my setup. Incidentally, what is the actual difference between selecting "Chinese" or "Simplified Chinese" as the gloss language -- I assume one is using the Kindle default definitions file and the other is pulling from Wiktionary? Or is there something more?

mizake-mizan commented 1 year ago

Second question:

Set Word Wise language to Chinese on Kindle to view Wiktionary definition. WordDumb replaces the original Chinese Kindle Word Wise database file when the “Use Wiktionary defination” option is enabled for English books or creating Word Wise for non-English books.

Is the original database file overwritten, or still available? In other words, if I switch back and forth between a few languages, do I need to consider restoring the original Chinese file? Does the approach you have taken even support using two different Word Wise language pairs/dictionaries at the same time?

xxyzz commented 1 year ago

"Chinese" are "Simplified Chinese" are the same if you don't enable "use Wiktionary definition", but if you enable this option, the gloss will be in different Chinese characters.

The Word Wise database file on Kindle will be overwritten. If you enable "use Wiktionary definition", new database file will be copied to Kindle if the previous database is in a different language. The Kindle's default db have to be restored manually.

mizake-mizan commented 1 year ago

That'll help me figure out what is happening -- can close this ticket.