11-26-2022, 07:32 AM | #16 | |
want to learn what I want
Posts: 1,050
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
Quote:
Just did a quick test and confirmed that I had two identical books (Ratio 0): Then I found both are sourced from Gutenberg (one is a StandardEbooks edition). Dark theme on-screen output is fine now, and it's great to have a one-click TextDiff tool within Calibre, thank you again. |
|
11-26-2022, 11:22 AM | #17 |
Connoisseur
Posts: 55
Karma: 666
Join Date: May 2020
Location: Germany
Device: android smartphone + tablet
|
The ratio is described in https://docs.python.org/3/library/difflib.html: »Note that this is 1.0 if the sequences are identical, and 0.0 if they have nothing in common.« Hmmm...
|
Advert | |
|
11-26-2022, 11:57 AM | #18 | |
want to learn what I want
Posts: 1,050
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
Quote:
then I thought it was the other way -- the lower, the closer to identical |
|
06-12-2023, 10:46 AM | #19 |
Junior Member
Posts: 2
Karma: 10
Join Date: Jun 2023
Device: Tolino V 5
|
Hello, I tried the Plugin today by using it on similar ebooks and got the error meaasge:
AttributeError: 'TextDiffDialog' object has no attribute 'diff' I'm using Calibre 6.20, Plugin 1.2.1 on Win 11. |
06-12-2023, 12:41 PM | #20 |
Connoisseur
Posts: 55
Karma: 666
Join Date: May 2020
Location: Germany
Device: android smartphone + tablet
|
AttributeError: 'TextDiffDialog' object has no attribute 'diff'
Hello Robert1a,
I'm sorry, but I can't take care of it until next week. In the meantime, please send the complete Python stack trace with the line number of the error (if necessary, start Calibre in debug mode). |
Advert | |
|
06-13-2023, 03:03 AM | #21 |
Junior Member
Posts: 2
Karma: 10
Join Date: Jun 2023
Device: Tolino V 5
|
Sorry for my error message. I tried the tool for the first time and chose the save result to a file without having explicitely hit the compare before. So, the error massage appears when there is no result available. Maybe room for a small improvement, by checking if there is a comparision done before allowing to save the result.
The plugin works. |
06-13-2023, 06:56 AM | #22 |
Connoisseur
Posts: 55
Karma: 666
Join Date: May 2020
Location: Germany
Device: android smartphone + tablet
|
Thanks for the clarification! Version 1.2.2 next week 😊
|
08-23-2023, 07:27 AM | #23 |
Enthusiast
Posts: 29
Karma: 10
Join Date: Jul 2023
Device: KindleOasis10thGen
|
Hello,
love your plugin ! May I make the following suggestions / remarks ? - sometimes (= not always, and I haven't been able to determine why) if using the plugin (with a comparison displayed on screen) while editing the text of one of the compared files, it is not possible to "refresh" the comparison. It says "Error: no books selected", then the cursor starts spinning and never stops until Calibre is restarted (but everything keeps working). - as above, sometimes, clicking "refresh books formats list" causes the same book to appear twice, instead of the two originally selected books. - would it be possible to customize the colors used in the compare results ? Also, question: what's the difference in the context handling between plugin and htmldiff ? |
08-23-2023, 09:40 AM | #24 |
Enthusiast
Posts: 29
Karma: 10
Join Date: Jul 2023
Device: KindleOasis10thGen
|
seems that the issue occurs when clicking anywhere in the Calibre main windows or booklist while the Compare window is open... not sure yet.
|
12-25-2023, 04:18 PM | #25 |
Enthusiast
Posts: 29
Karma: 10
Join Date: Jul 2023
Device: KindleOasis10thGen
|
Feature suggestion: saving parameters
Hello, may I suggest a feature enhancement ? Would it be possible to configure parameters for the plugin, e.g. the "wrap columns at" (default=60, I like to set it higher), Tab size, Context handling, etc.
|
12-29-2023, 09:51 AM | #26 | |
Connoisseur
Posts: 55
Karma: 666
Join Date: May 2020
Location: Germany
Device: android smartphone + tablet
|
Customizing questions
Quote:
wrap columns and tab size works as expected (see attached images with wraps at 60 resp. 100 Characters). > Also, question: what's the difference in the context handling between plugin and htmldiff ? Handling by htmldiff (quote from the documentation): context and numlines are both optional keyword arguments. Set context to True when contextual differences are to be shown, else the default is False to show the full files. numlines defaults to 5. When context is True numlines controls the number of context lines which surround the difference highlights. When context is False numlines controls the number of lines which are shown before a difference highlight when using the “next” hyperlinks (setting to zero would cause the “next” hyperlinks to place the next difference highlight at the top of the browser without any leading context). https://docs.python.org/3/library/difflib.html Strategy is: - Put diff without table body in new text blob with marker for revised table body - Loop thru table body rows and build another text blob - Replace marker in text blob 1 with text blob 2 Context handling by the plugin: The plugin strips identical lines from the diff result, preserving n context lines (as set by user): abc ... [18 identical line(s).] def... BTW, there is a new version out (1.2.3). |
|
01-06-2024, 12:15 PM | #27 |
Enthusiast
Posts: 29
Karma: 10
Join Date: Jul 2023
Device: KindleOasis10thGen
|
Some bugs in TextDiff
Hello, while using this great plugin I noticed the following (on Calibre 7.2 and 7.3):
- choosing any font other that "sans serif" doesn't do anything - choosing any display format other than HTML (e.g. context, unified or ndiff) causes the following error: "ERROR: Unhandled Exception" - "NameError:name 'self' is not defined". From the Details screen: Traceback (most recent call last): File "calibre_plugins.textdiff.main", line 785, in compare
File "calibre_plugins.textdiff.main", line 1280, in create_diff File "calibre_plugins.textdiff.main", line 1311, in diff_lines_to_string NameError: name 'self' is not defined |
01-06-2024, 12:22 PM | #28 |
Enthusiast
Posts: 29
Karma: 10
Join Date: Jul 2023
Device: KindleOasis10thGen
|
Hello, thanks for the explanations. I still don't see what the "tab size" (tabulatorweite) does, I've tried multiple settings and can't see any difference in the output.
|
01-08-2024, 10:23 AM | #29 | |
Connoisseur
Posts: 55
Karma: 666
Join Date: May 2020
Location: Germany
Device: android smartphone + tablet
|
Some Bugs - fixed
Quote:
The tab width is used internally by Difflib when converting tabs to spaces and vice versa (see Difflib documentation). Probably only makes sense when comparing source codes. |
|
01-08-2024, 01:14 PM | #30 |
Enthusiast
Posts: 29
Karma: 10
Join Date: Jul 2023
Device: KindleOasis10thGen
|
Thanks
Thanks for the fix !! |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[GUI Plugin] KindleUnpack - The Plugin | DiapDealer | Plugins | 494 | 05-18-2024 02:34 AM |
[GUI Plugin] Noosfere_util, a companion plugin to noosfere DB | lrpirlet | Plugins | 2 | 08-18-2022 03:15 PM |
[GUI Plugin] Save Virtual Libraries To Column (GUI) | chaley | Plugins | 14 | 04-04-2021 05:25 AM |
[GUI Plugin] Plugin Updater **Deprecated** | kiwidude | Plugins | 159 | 06-19-2011 12:27 PM |