Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 11-26-2022, 07:32 AM   #16
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,023
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
Quote:
Originally Posted by feuille View Post
Hello Comfy.n,

I implemented two of your hints (see history).

In order to calculate the display time of a progress bar, I stopped intermediate times in the program flow. To my surprise, the HTML rendering of the text browser widget consumes 2/3 of the total runtime! I may implement in a future release a workaround like stepwise asynchronous loading with a timer or so, but I need to do some research on that.
Thank you for the mention, I appreciate it!
Just did a quick test and confirmed that I had two identical books (Ratio 0):

Click image for larger version

Name:	MWSnap0922 2022-11-26, 09_09_47.png
Views:	148
Size:	61.7 KB
ID:	198017

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.
Comfy.n is online now   Reply With Quote
Old 11-26-2022, 11:22 AM   #17
feuille
Connoisseur
feuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enough
 
Posts: 53
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...
feuille is offline   Reply With Quote
Advert
Old 11-26-2022, 11:57 AM   #18
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,023
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
Quote:
Originally Posted by feuille View Post
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...
yes I found it interesting to be zero, because when i did previous comparisons with very similar texts (translation variations), ratio would be like 0.95 or so

then I thought it was the other way -- the lower, the closer to identical
Comfy.n is online now   Reply With Quote
Old 06-12-2023, 10:46 AM   #19
Robert1a
Junior Member
Robert1a began at the beginning.
 
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.
Robert1a is offline   Reply With Quote
Old 06-12-2023, 12:41 PM   #20
feuille
Connoisseur
feuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enough
 
Posts: 53
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).
feuille is offline   Reply With Quote
Advert
Old 06-13-2023, 03:03 AM   #21
Robert1a
Junior Member
Robert1a began at the beginning.
 
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.
Robert1a is offline   Reply With Quote
Old 06-13-2023, 06:56 AM   #22
feuille
Connoisseur
feuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enough
 
Posts: 53
Karma: 666
Join Date: May 2020
Location: Germany
Device: android smartphone + tablet
Thanks for the clarification! Version 1.2.2 next week 😊
feuille is offline   Reply With Quote
Old 08-23-2023, 07:27 AM   #23
Zillion_
Enthusiast
Zillion_ began at the beginning.
 
Posts: 27
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 ?
Zillion_ is offline   Reply With Quote
Old 08-23-2023, 09:40 AM   #24
Zillion_
Enthusiast
Zillion_ began at the beginning.
 
Posts: 27
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.
Zillion_ is offline   Reply With Quote
Old 12-25-2023, 04:18 PM   #25
Zillion_
Enthusiast
Zillion_ began at the beginning.
 
Posts: 27
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.
Zillion_ is offline   Reply With Quote
Old 12-29-2023, 09:51 AM   #26
feuille
Connoisseur
feuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enough
 
Posts: 53
Karma: 666
Join Date: May 2020
Location: Germany
Device: android smartphone + tablet
Customizing questions

Quote:
Originally Posted by Zillion_ View Post
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.
Hello Zillion_,

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).
Attached Thumbnails
Click image for larger version

Name:	brueder_60.png
Views:	63
Size:	51.0 KB
ID:	205473   Click image for larger version

Name:	brueder_100.png
Views:	48
Size:	56.0 KB
ID:	205474  
feuille is offline   Reply With Quote
Old 01-06-2024, 12:15 PM   #27
Zillion_
Enthusiast
Zillion_ began at the beginning.
 
Posts: 27
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
Zillion_ is offline   Reply With Quote
Old 01-06-2024, 12:22 PM   #28
Zillion_
Enthusiast
Zillion_ began at the beginning.
 
Posts: 27
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.
Zillion_ is offline   Reply With Quote
Old 01-08-2024, 10:23 AM   #29
feuille
Connoisseur
feuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enough
 
Posts: 53
Karma: 666
Join Date: May 2020
Location: Germany
Device: android smartphone + tablet
Some Bugs - fixed

Quote:
Originally Posted by Zillion_ View Post
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:
[/INDENT]
Thanks for your patient testing. The error has been fixed in the just released version 1.2.4.
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.
feuille is offline   Reply With Quote
Old 01-08-2024, 01:14 PM   #30
Zillion_
Enthusiast
Zillion_ began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Jul 2023
Device: KindleOasis10thGen
Thumbs up Thanks



Thanks for the fix !!
Zillion_ is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUI Plugin] KindleUnpack - The Plugin DiapDealer Plugins 492 10-25-2022 08:13 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


All times are GMT -4. The time now is 10:27 PM.


MobileRead.com is a privately owned, operated and funded community.