Closed derrickoswald closed 11 months ago
AccessAide does not require images to be in any particular folder. My guess is you have a link to an image in an Xhtml file that is broken or incorrect that does not point into the Images folder. But that is just a guess. Note that since these are URLs all paths are case sensitive.
Please run epubcheck on your epub before launching AccessAide and run Sigil's Images reports tool. Post the results of that here.
Also note that tk (plugin ui) does not support showing thumbnails of svg images. It tries to create them by running a limited internal executable so make sure that executable exists and matches your platform.
Hopefully something from epubcheck or Sigil's Images report will give us some clue as to what is going on.
Potentially that internal nanosvg executable is broken or no longer executable on your platform causing the png version of the svg version to never get created or created in the wrong place.
Perhaps moving this plugin away from the limiting tk gui to a full Qt gui would make some sense as the nanosvg executable would no longer be needed.
Most epubs use native image formats, not pure svg files as and just include the wrapper svg code inside the xhtml file to properly scale an image.
Actually according to the output you have image tags with emplty or blank src urls. Empty image urls are not legal. See for example inthe error message you posted the OEBPS/Text/Title_Page.xhtml which has an image tag with 'src' attribute that is blank. No url. There are others as well in OEBPS/Text/Mental_Model.xhtml and OEBPS/Text/Experiments.xhtml.
Find and fix these empty/broken src urls.
Building a GUI to speed image alt attribute updates
... OEBPS/Text/Title_Page.xhtml # 1 src: alt text:
... OEBPS/Text/Introduction.xhtml # 1 src: ../Images/placeholder.svg alt text: Oblique view of old school, wood framed, slate blackboard on a classroom wall,
an arm wearing a tweed elbow patch jacket is writing on the board,
the chalk marks on the board may be a geometry class notes,
a partially visible school clock is in the upper left showing 15:30
... OEBPS/Text/Magic_Powers.xhtml # 1 src: ../Images/placeholder.svg alt text: Sorcerers apprentice
with robe and a conical hat decorated with stars and astrological signs,
waving a wand with sparkles eminating from the end
over a cauldron on a cast iron tripod stand.
... OEBPS/Text/Mental_Model.xhtml # 1 src: alt text:
... OEBPS/Text/Mental_Model.xhtml # 2 src: ../Images/placeholder.svg alt text: Knife switch,
with rubberized conductors and big clanky bits of copper reminiscent of Frankenstein black and white movies.
... OEBPS/Text/Experiments.xhtml # 1 src: alt text:
... OEBPS/Text/Experiments.xhtml # 2 src: ../Images/scientific_process.svg alt text: A flow chart, top to bottom, illustrating the steps in an experiment.
Five boxes in sequence labeled observe, change, observe, revert and observe.
... OEBPS/Text/Hypothesis_Generation.xhtml # 1 src: ../Images/hypothesis-generation.jpg alt text: Bloodhound
in deerstalker hat with magnifying glass in foregroud left,
men's heeled shoe footprints lead out of the picture to the right.
... OEBPS/Text/Techniques.xhtml # 1 src: ../Images/system.svg alt text: A horizontal line of boxes joined by arrow lines pointing right.
An initial line on the left is labeled INPUT and the last line on the right is labeled OUTPUT.
Closing this since not a bug in AccessAide.
epubcheck shows no problems. The images report shows nothing unusual. I don't think the src urls are blank. It also does not pick up the alt property for these. The ePub is available here: https://gitlab.com/derrickoswald/troubleshooting/-/blob/master/Troubleshooting.epub?ref_type=heads
If AccessAide runs correctly on your machine, it could be closed as an svg problem.
Your epub fails the exact same way on my machine. So I have no idea why it can not find the proper url.
I am on it.
Okay, the problem seems to be the xhtml parser that Access-Aide uses seems not to skip newlines (ie not consider a newline to be whitespace) when embedded in the attribute list.
The fix will have to come in Sigil as Access-Aide just uses Sigil's internal quick parser.
To work around this parser bug in Title_Page.xhtml and the other two locations, simple convert the img tag attributes to not have newlines between each attribute.
For example use this in Title_Page.xhtml:
<img class="image" src="../Images/logo.svg" alt="Three by three matrix of redish-brown squares with lower right square replaced by matched parentheses and the word '9code' to the right"/>
I am surprised that others have not reported this issue in Sigil itself but I guess only some of the plugins use this parser implementation.
I will work around it by trimming whitespace from the attribute name before processing it.
Nice catch!
Thank you for your bug report.
Thank you for taking the time to investigate it. I presume you will raise the root cause issue to the attention of the Sigil developers. Without the whitespace in img tags it works for me too now. It's not really very good with SVG images though is it.
Workaround is to remove newlines in img tags.
New version of Access-Aide has now posted with a workaround in place.
As I am one of the two main Sigil developers you can consider them notified. In fact a commit to fix this bug has already been made to Sigil master.
And I agree python Tk's lack of support for rasterizing svg images is terrible. The nanosvg tool only handles very simple cases.
The next full release of Access-Aide in the new year will move away from the python Tk toolkit to use Qt's PySide6 which natively handles svg and rasterization quite easily.
Thanks for your bug report. It helped make both Access-Aide and Sigil better.
um, it might be just me, but Access-Aide_v055.zip fails for me referring to tkinter, which is only mentioned as a Mac OS problem:
Traceback (most recent call last):
File "/opt/sigil/share/sigil/plugin_launchers/python/launcher.py", line 142, in launch
self.exitcode = target_script.run(container)
File "/home/derrick/.local/share/sigil-ebook/sigil/plugins/Access-Aide/plugin.py", line 471, in run
naltlist = GUIUpdateFromList("Update Alt Text for Each Image", altlist, basewidth)
File "/home/derrick/.local/share/sigil-ebook/sigil/plugins/Access-Aide/accessgui.py", line 65, in GUIUpdateFromList
altnew = afield.get(1.0,"end")
File "/usr/lib/python3.10/tkinter/__init__.py", line 3750, in get
return self.tk.call(self._w, 'get', index1, index2)
_tkinter.TclError: invalid command name ".!updatelist.!frame.!text2"
Error: invalid command name ".!updatelist.!frame.!text2"
It's probably a version error. Mine ($tcl_version) is 8.6 and you probably used something newer maybe.
That is interesting. I use tcl/tk 8.6 as well.
Will Reopen and try this again.
Okay just installed the latest version. Ran the plugin with your epub testcase 10 times in a row, and never had any trouble.
Possibly this is a Python Interpreter version issue. How new is your Python?
This is the one I told the plugin system to use:
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
I mean, the GUI is displayed and it looks like it's working, but that is the error message in the text window.
And, yeah, now it doesn't show that error any more. Weird.
No, I lied. It sometimes shows that error. But I can't reproduce it reliably.
I am using Python 3.11.3. But what you are seeing sounds like a race or timing issue in the tcl/tk code itself. I am thinking the move to PySide6 is truly needed as tk is just not advancing as a gui for python.
Unless I can recreate the issue I probably can not track it down. Hopefully it will be rare and just re-running the plugin will fix things. Digging into the tcl/tk code to hunt bugs (especially thread related) can be a real bear. I think my time would be better spent moving the entire Access-Aide plugin to PySide6/Qt6.
Once question, does waiting to hit the Okay button or changing any of the alt strings actually make the issue appear more often or less often? If I can reproduce it I may be able to track it down.
No. I can't make it happen again.
FWIW, I had the issue you reported happen to me once now. It is an internal tcl/tk issue.
Then I spent some time looking for SVG support in Python pillow and python in general but it is missing and any work on it has basically stopped two years ago. So sad.
The only solution is to just move the gui to Qt6 PySide6) as there gui is much more stable and capable than tk (sadly).
BTW, I was intrigued by how messed up the logo.svg was when displayed.. So I tested it with a variety of tools and the only svg lib that renders it properly is a full browser implementation.
The issues are that the logo.svg uses things that are neither part of svg 1.1 nor the newer svg 2 standard. This includes using "flowRoot" which is not part of either spec and is deprecated and only supported by inkscape as far as I know.
It also uses desc and title tags inside of text tags when xml:space="preserve" is used which is a no-no in svg 1.1.
So that logo.svg code is a ripe mess when it comes to compatibility across various platforms and versions of svg. Inkscape can be used to fix it (by converting flowed root text to normal text) and by removing the use of title and desc inside of text tags.
If you know the author of the logo, you might want to pass these things along as having a messed up company logo is not a good thing. You want it always to display well on all systems which is easily achievable with a few edits.
Okay. I have posted Access-Aide_v090-Beta.zip in the Access-Aide plugin thread in the Sigil forum in Mobileread.
This version has moved to using Qt for Python as the graphical user interface and removes the fragile/broken Tk gui.
The added benefit is that this plugin now uses QtSvg to render pure svg images. So It does a much better job with your testcase epub svgs, plus the user can now adjust thumbnail size as desired.
Would love feedback on it if and when you get a free moment, before its final release.
Should be a big improvent in gui.
It works wonderfully. SVG files are correctly rendered and the thumbnail size can be adjusted.
Some niggles:
Thanks for your effort. It looks very good.
I don't really use SVG except as wrapper for bitmaps, so can't comment on that. But it seems to work as expected, and way faster than previous version. One small glitch though: I use the same image (the Creative Commons-logo) twice in the same file – once with a danish alt-text, once with an english alt-text. The old version of the plugin understood this and showed the image twice with the different alt-texts. The beta version shows the image only once, and replaces the alt-text with whatever text it finds by the first occurence of the image.
Otherwise it looks good to me, and thanks for keeping it up-to-date.
@derrickoswald Thank you for the feedback. I am glad you liked the improved svg display.
You can use MathML in your epub, but the accessibility criteria change and mathml specific accessibility features are needed in order for en epub that uses mathml to be considered "compliant". That is outside the scope of this plugin, which is why the plugin aborts (just like it will abort with audio and video resources as the plugin has no way to detect if there are accessibility issues (too much flashing, etc) with these types of resources. This plugin was designed is for text and static image based epubs (ie. basic fiction/non-fiction).
The plugin Cancel button is available only up to the point the plugin itself has finished. Unfortunately, the plugin is so fast it finishs so qucikly after hitting Cancel in the Alt Text Editor, that it can not be done.
I used Sigil's Checkpoint feature and made a checkpoint before firing up the plugin and then moved that Alt Text Editor out of the way and pressed Cancel in Sigil's plugin runner Window.
I then used Sigil's Checkpoint compare/diffing and you are right the only change was in dc:modified. That is an issue within Sigil itself and that will have to be examined at some point. I will look into it when I get a chance.
I did find and fix a bug when the Alt Text Editor Cancel button is used it still tried to update things in img tag alt strings when it should not have. I will include that fix before the official release.
@KimNJensen
Thank you for your testing and feedback.
That change was deliberate as earlier feedback from users who used the same image multiple times in an epub did not want to have to update the alt string repeatedly for the exact same image.
That was thought to be a more common case than wanting to use different alt strings in different languages for the same image.
In your case, it might be possible to place both translations (with proper prefix) in the same alt value. If this is a large hurdle for you, I might be able to code it up both the old way and the new way and set a user controlled preference to control things.
Okay tracked down that bug in Sigil's PluginRunner when Cancel is used still updating the dc modified date. It is now fixed in Sigil master and that fix will be in the next release of Sigil. Thank you for your bug report.
For me, it won't be a big issue placing both languages in the alt-text, but since that is, what is being read to a user of text-to-speech assistive technologies, having read aloud a double-language text would probably be irritating.
Quick thought: Instead of an option to do it either the old or the new way, how about an option to leave images, that already has an alt-text, alone?
Skipping alt values that are already filled would not help because of the way they are now passed back and forth into and out of the gui.
Because people did not want to add alt values for identical images I now pass a dictionary of image paths and alt values into the gui and back out with the key to the dictionary being the image's path inside the epub (ie unique) - but NOT where it is being used in the epub.
That would have to change so that instances of the same image used more than once could have different alt values.
Let me think on it a bit.
Okay, after some more thought, I have reverted to allowing multiple identical images and will return to tracking them in unique ways. The reason I decided to go back to the previous behaviour is that with the new gui, copying and pasting alt text is much easier. So no one would have to retype anything if identical images and they wanted identical alt text.
@KimNJensen That should handle your issue.
Again, thank you both for testing it and feeding back.
reverted to allowing multiple identical images and will return to tracking them in unique ways
@kevinhendricks Thanks for that. For me that's a real bug since I use a blank placeholder image and track what I want to draw in many locations using the alt text. I just spent some minutes restoring my alt text for placeholder images - thank goodness I use Git. When the new version is available, I'll start using Access-Aide again, but at the moment it's too dangerous.
The new production version is 0.9.1 and it was released yesterday. It is available here and on MobileRead.
FYI, Sigil has a built-in Checkpoint function that uses dulwich (a pure python implementation of git) to create the Checkpoints. So with a single icon click you can make a Checkpoint (an internal commit) and there are built-in comparison/diffing tools as well. Typically much faster than using my FolderIn and FolderOut plugins to sync to an external git repo. You can of course restore from any previous Checkpoint, all from with Sigil,
FWIW, the Checkpoint's internal git repo is stored in your Sigil preferences folder using the epub's opf unique uuid. You can manage if from Sigil or if you are a git user, simply cd to your epub's folder and run any command line git commands you want on it.
I make it a point to always make a Checkpoint before running any plugin. I made it part of an Automation list to make launching it even easier.
Error: FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmplbb4p_at/OEBPS/Text/' Text from plugin run is attached as Access-Aide.error.txt.
It seems to me that the temp_dir used for images does not also contain XHTML files as expected, either because they are not being copied, or the path should be something else. Examining the specified directory, there is an Images directory, but not a Text directory:
Sigil 2.0.2 Qt: 6.2.4 OS: Linux xxxxxxx 6.2.0-37-generic #38~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 2 18:01:13 UTC 2 x86_64 x86_64 x86_64 GNU/Linux Access-Aide_v054.zip