Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 02-05-2017, 03:56 PM   #1
CalibUser
Addict
CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.
 
Posts: 202
Karma: 62362
Join Date: Jul 2015
Device: Sony
Plugin to insert and wrap an image with SVG

Description
The attached plugin will enable you to select an image that already exists in your ePub book or import an external image and then insert it in a new or existing xhtml section, wrapping it with SVG tags.

How to use the plugin
Please see the attached user guide.

UPDATE
I have updated this plugin to version 0.2.1.0 to put an image on the clipboard from one that already exists in your ePub book or from an external image. The image on the clipboard is surrounded by SVG tags. The image and these tags can then be pasted into any part of your ePub.
  • Images are inserted in the Book Browser in the position that you select using this plugin; however, you may want to move the page containing the image to a different position in the underlying ePub structure of the book for Sigil version 1.0.0.0 or above. To do this (after running this plugin) right-click on the xhtml section that contains the image and select Move from the pop up menu. You can then select the underlying folder in the ePub structure where you want to put this page.
  • Similarly, if you import an image you may wish to move it to a different position in the underlying ePub structure of the ePub.


After pasting in the image and SVG code, you may want to add a class to the <div> wrapper eg div.breakavoid {page-break-inside: avoid;} as suggested by AlanHK.

I have updated this plugin to version 0.2.1.1. This version has the following improvements:
  • Checking for updates - you can set the time interval between reminders
  • The copy button changes colour when an image has been selected for import
  • Code has been improved for the copying process.

I have updated this plugin to version 0.2.1.3 to fix a small bug.

Update I have updated this plugin to version 0.2.1.4 to reflect an update in one of the libraries that this plugin depends on.

Please note that if you are using Sigil 0.99 then the first time you run the plugin it will try to run again when an image has been imported. To get round this issue please close Sigil after installing the plugin. You can then use the plugin next time you open Sigil.
Attached Files
File Type: zip InsertImageSVG_02.1.4.zip (14.2 KB, 728 views)
File Type: epub User Guide for InsertImageSVG_v0.2.1.3.epub (473.5 KB, 292 views)

Last edited by CalibUser; 11-17-2023 at 07:43 AM. Reason: Updated user guide to v0.2.1.3.
CalibUser is offline   Reply With Quote
Old 02-05-2017, 04:49 PM   #2
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,040
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Thanks! I'll get it added to the plugin index.
DiapDealer is offline   Reply With Quote
Advert
Old 02-05-2017, 06:16 PM   #3
bravosx
Zealot
bravosx began at the beginning.
 
Posts: 103
Karma: 10
Join Date: Jun 2014
Location: Poland, Żory
Device: Prestigio PER3464B, Onyx Lynx, Lenovo S5000 i Tab4-8"
@CalibUser...

When you attempt to use the plug getting the message.



bravosx
Attached Thumbnails
Click image for larger version

Name:	zrzut.png
Views:	1239
Size:	24.8 KB
ID:	154778  
bravosx is offline   Reply With Quote
Old 02-05-2017, 06:27 PM   #4
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
@bravosx: The plugin works fine on my Windows 10 machine. Did you check the Use Bundled Python box in the Manage Plugins dialog box?

If so, you'll need to post the steps that caused this message to be displayed, unless it's being displayed immediately after running the plugin.
Doitsu is offline   Reply With Quote
Old 02-05-2017, 06:37 PM   #5
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,040
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
The epub he opened probably has no images in it. I get the same error when launching the plugin when no images exist (in the plugin). Works fine on Linux, otherwise.

Just needs a way to handle the empty list situation, is all.


EDIT: I take that back. It's not the images. The error happens when an epub only has 1 xhtml file. One of the combo boxes is set to default to the second entry in the list ... but a brand-new epub only has one xhtml file.

Last edited by DiapDealer; 02-05-2017 at 06:51 PM.
DiapDealer is offline   Reply With Quote
Advert
Old 02-05-2017, 06:56 PM   #6
bravosx
Zealot
bravosx began at the beginning.
 
Posts: 103
Karma: 10
Join Date: Jun 2014
Location: Poland, Żory
Device: Prestigio PER3464B, Onyx Lynx, Lenovo S5000 i Tab4-8"
@Doitsu...
@DiapDealer...

Field: of Use Bundled Python box in the Manage Plugins dialog box is checked.

An error message is given a moment after starting the plug.

Images are included eo Images directory.

edit: The plugin works properly when epub is a lot of files in the folder text.

Sorry for my English.
Regards
bravosx

Last edited by bravosx; 02-05-2017 at 07:09 PM.
bravosx is offline   Reply With Quote
Old 02-06-2017, 03:17 AM   #7
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
Thanks! I will wait for an update for the reported bug though!
Toxaris is offline   Reply With Quote
Old 02-06-2017, 09:28 AM   #8
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,040
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Some suggestions in the attached patch.

In addition to the index error, I'd suggest populating the combo box with the xhtml file _names_, rather than their manifest ids. Many people won't recognize those offhand.

Also the image file filter is broken on the openfile dialog. My png files wouldn't show up unless I changed to "All files".

Yours to do with what you will, of course. Thanks for the plugin!
Attached Files
File Type: txt insertsvg.patch.txt (1.6 KB, 859 views)

Last edited by DiapDealer; 02-06-2017 at 11:33 AM.
DiapDealer is offline   Reply With Quote
Old 02-06-2017, 03:38 PM   #9
CalibUser
Addict
CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.
 
Posts: 202
Karma: 62362
Join Date: Jul 2015
Device: Sony
Thanks for the bug report and for the suggested patch - I have uploaded a correction in the first post of this thread

Last edited by CalibUser; 02-06-2017 at 04:21 PM.
CalibUser is offline   Reply With Quote
Old 02-11-2017, 04:53 PM   #10
CalibUser
Addict
CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.
 
Posts: 202
Karma: 62362
Join Date: Jul 2015
Device: Sony
I have updated the plugin in the first post of this thread.

Quote:
Originally Posted by DiapDealer View Post
...I'd suggest populating the combo box with the xhtml file _names_, rather than their manifest ids. Many people won't recognize those offhand.
I am not sure what you were referring to - the combo box showed the names of the xhtml files when I ran the original plugin eg Section0001.xhtml. Was you referring to the Images\... reference in the listbox? The new version no longer shows Images\...
CalibUser is offline   Reply With Quote
Old 02-11-2017, 05:06 PM   #11
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,040
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by CalibUser View Post
I have updated the plugin in the first post of this thread.



I am not sure what you were referring to - the combo box showed the names of the xhtml files when I ran the original plugin eg Section0001.xhtml. Was you referring to the Images\... reference in the listbox? The new version no longer shows Images\...
No. The first version I saw was populating the combo box with the manifest ids of the epub's text files. Many epubs made by Sigil will have ids that match the filename (Sigil creates new files with ids equal to the filename if it can, but this isn't always guaranteed), but others may not. When I opened some of my own epubs, the combobox was populated with entries like "nav, toc" etc. They didn't match what I was seeing in Sigil's Book Browser.

You're not doing anything wrong, it's just that the manifest ids of an epub's files won't always match what a user sees in Sigil's Book Browser.

I included a "fix" for it in my patch. Perhaps you already applied it?

EDIT: Yes, I see my patched code being used on line 139
Code:
for id, href in self.bk1.text_iter():
    self.xhtmlTuple=self.xhtmlTuple + (os.path.basename(href),)
Originally it was:
Code:
for id, href in self.bk1.text_iter():
    self.xhtmlTuple=self.xhtmlTuple + (id,)

Last edited by DiapDealer; 02-11-2017 at 05:15 PM.
DiapDealer is offline   Reply With Quote
Old 02-11-2017, 05:10 PM   #12
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,160
Karma: 5450818
Join Date: Nov 2009
Device: many
The content.opf uses manifest ids. A manifest id is any unique identifier name. To make dure the id is unique, some people and somesofrware will copy the file name and use it as the manifest identifier. This is a simple way to assure uniqeness but can be confusing as both the actual filename based on the manifest href and the manifest id can look identical but need not be. That is why using the filenam part of the href is recommended as the id for that same manifest entry could be something like "c1" instead of "chapter1.xhtml".

Hope this explains things.

KevinH
KevinH is offline   Reply With Quote
Old 02-11-2017, 05:20 PM   #13
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,040
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Also, a heads-up to all that Python 3.6 absolutely detests tuples with null elements. For future compatibility, consider not using code like:

EDIT: never mind ... I remembered the issue wrong. The issue was empty/Null first elements in tuple that can cause problems in 3.6+. But only in freaky os.execvp() commands that you probably won't run into. Sorry for any confusion.

Last edited by DiapDealer; 02-11-2017 at 05:33 PM.
DiapDealer is offline   Reply With Quote
Old 02-11-2017, 05:21 PM   #14
CalibUser
Addict
CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.
 
Posts: 202
Karma: 62362
Join Date: Jul 2015
Device: Sony
@DiapDealer - Thanks for the supplying the bug fix - I had not realised that my original code populated the combobox with entries like "nav, toc" etc as my tests did not show this - all my IDs did match the filenames in my tests so I didnot detect this problem.

@KevinH - Thanks for the clarification.
CalibUser is offline   Reply With Quote
Old 02-11-2017, 05:35 PM   #15
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,040
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
No problem!
DiapDealer is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wrap in SVG plugin? gezginrocker Plugins 18 07-05-2015 01:20 AM
svg image on top of a background png image roger64 ePub 25 04-24-2015 12:00 PM
Display of a png image linked to a svg image roger64 Editor 6 03-13-2015 07:21 AM
Image wrap test Jellby ePub 15 05-04-2011 03:30 PM
Combining blockquote with image wrap WRB Sigil 1 02-12-2011 08:46 PM


All times are GMT -4. The time now is 05:04 AM.


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