![]() |
#196 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,735
Karma: 24031401
Join Date: Dec 2010
Device: Kindle PW2
|
@rubeus: you could also rename files with an input/output plugin.
|
![]() |
![]() |
![]() |
#197 | |
Banned
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
|
Quote:
For example: chapter05 chapter05_x chapter05_001 SVGIMG chapter05_end should be chapter05 chapter05_0001 chapter05_0002 chapter05_0003 chapter05_0004 In Sigil you have to do this block for block entering the startfilename newly each time. But if there is no API to call the rename funtionality in Sigil i will stop here as i dont want to care of links myself. |
|
![]() |
![]() |
Advert | |
|
![]() |
#198 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,819
Karma: 6000000
Join Date: Nov 2009
Device: many
|
Hi rubeus,
FYI: The plugin interface has absolutely no capability to call anything inside Sigil. The plugin interface simply saves all tabs to files to get the current state of the epub, launches python, running its launcher code, that parses the current content.opf and tries to make those files available to the plugin in a safe way. Anytime a plugin changes a file, a copy is made and the modified version is stored in a temp directory. When the plugin run() routine returns, the builtin python code tells Sigil what files were added, deleted, or modified (via the result.xml you saw briefly flash on the screen) as it exits. Sigil then processes ths list to make the changes the plugin requested using the modified copies stored in temp if needed. So the plugin code never actually calls back into Sigil, it instead let's Sigil be in charge. Hope this helps, KevinH |
![]() |
![]() |
![]() |
#199 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,819
Karma: 6000000
Join Date: Nov 2009
Device: many
|
FYI:,
I have updated the first post in this thread with a sampleOutput plugin that will properly obfuscate fonts on output and that will remove the Sigil version metadata by example. It will require the forthcoming Sigil-0.9.3 to work due to recently fixed bugs in the plugin launcher code. I have also added an updated testme3_v030.zip edit plugin that provides many examples of how to use the plugin interfaces. Also added links to Sigil_Plugin_Framework_rev7.epub and the launcher_version date for the upcoming Sigil-0.9.3 release. Last edited by KevinH; 01-30-2016 at 12:53 PM. |
![]() |
![]() |
![]() |
#200 |
Banned
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
|
If i set the return code to something different as zero, are the changes i did via writefile, addfile etc rolled backed?
|
![]() |
![]() |
Advert | |
|
![]() |
#201 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,819
Karma: 6000000
Join Date: Nov 2009
Device: many
|
Hi rubeus,
Yes. If you set the return value to -1 (or any non-zero value), none of the changes you made will be used. They will all be discarded. The way the plugin interface is designed, any modificatins done by the plugin are simply recorded (as in the case of deletes) or stored in a temp directory. When the plugin completes and control returns to Sigil, if the plugin returns success (0), the actual changes are made by Sigil itself, otherwise it ignores them. KevinH |
![]() |
![]() |
![]() |
#202 |
Banned
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
|
Hi,
I've currently played around with bk.selected_iter() wich gives the tupel (Id_type, id) back, In my case, id_type has always the value manifest. Whats the intention returning always (?) this value? //rubeus |
![]() |
![]() |
![]() |
#203 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,631
Karma: 204624552
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Not all files return an id_type value of "manifest". The OPF file for instance doesn't. But you're right, most will. There's not many unmanifested files in an epub, but they need to be accounted for.
|
![]() |
![]() |
![]() |
#204 |
Banned
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
|
I'm trying now to get a preference dialog in my AddImgasSVG plugin.
So i had a look at DiapDealers TagMechanic but failed, what i could achieve is a dialog window but without a simple button ![]() So i'm trying to find a tutorial but none was so simple that even i was able to understand it. I would like to have a separate class so i started creating one derived from TopLevel. What i currently dont understand is why do i need to call the Grame Method to put a button in it? DiapDealer created a box, and inside the box a second frame for the buttons and here i give up. So: are there tutorials dealing with this? I was unable to find one, most of them are just opening a window and this is what i have already. I would like to have a fourth Button - no problem. Took some code from DiapDealer (which i didnt understand), i got a window but the simple button i added doesnt show up. As i'm not getting any error message i dont know what i'm doing wrong. What i have "stolen" so far; Code:
class PrefDialog(tkinter.Toplevel): def __init__(self, parent): tkinter.Toplevel.__init__(self, parent) self.resizable(False, False) self.title('Preferences') self.parent = parent self.initUI() def initUI(self): body = tkinter.Frame(self) body.pack(fill=tkinter_constants.BOTH) buttons = tkinter.Frame(body) cancelButton = tkinter.Button(buttons, text='Done', command=self.cmdDo) cancelButton.pack(side=tkinter_constants.LEFT, fill=tkinter_constants.BOTH, expand=True) self.withdraw() self.transient(self.parent) self.grab_set() self.center() self.deiconify() self.maingui.wait_window(self) Last edited by rubeus; 03-17-2016 at 08:23 AM. |
![]() |
![]() |
![]() |
#205 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,631
Karma: 204624552
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
@rubeus: Tkinter gui stuff can be incredibly tedious and unintuitive for anything other than the simplest of dialogs/tasks. What I've picked up about it has mostly been through Google searches, hours of tedious trial and error, and much, much "code borrowing."
When it comes to placing widgets (geometry management), there are two methods used "grid" and "pack." Both have their pluses/minuses, but both can be used pretty easily (for simple interfaces). The only time you really need to worry about using Frames is when your interface layouts get increasingly complex. Some sites I've used repeatedly are: http://effbot.org/tkinterbook/ http://zetcode.com/gui/tkinter/ And of course, Stackoverflow.com. If you want to create git repositories for your plugins' code, I'd be happy to provide some input/direction/pointers when you get stuck on something. Last edited by DiapDealer; 03-17-2016 at 08:37 AM. |
![]() |
![]() |
![]() |
#206 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,735
Karma: 24031401
Join Date: Dec 2010
Device: Kindle PW2
|
![]()
Is it possible to use HTML/Pango markup to change font properties in the Plugin Runner/Valdiation windows? (E.g. change the font color and/or add yellow highlight to specific words.)
|
![]() |
![]() |
![]() |
#207 | |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,819
Karma: 6000000
Join Date: Nov 2009
Device: many
|
Hi Doitsu,
Quote:
The only thing you can control is the info/warning/error level. The message will be xml escaped and uploaded as part of the result xml from the plugin. Html may survive but I am not sure if any of the display widgets used will treat it as anything other than text. |
|
![]() |
![]() |
![]() |
#208 |
Witchman
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
Problem with bk.setmetadataxml()
Hi everyone...I'm currently writing an edit plugin for my own use called Split2TOC. This plugin only works on imported html files and does the following:
* Splits the html file into separate xhtml files at heading boundaries * Allows you to choose which heading style to use to split your file * Adds the guides for cover, TOC and begin read(set to Chapter 1 or default) * Removes any existing doc TOC * Creates a Level 1 TOC file in the epub * Creates a TOC CSS * Adds the book cover * Adds the metadata Everything is working fine except when I try to add the epub metadata using setmetadataxml(). Here is my function that tries to set the metadata in the epub: Spoiler:
And this is what I get in the epub opf metadata section after running that function: Spoiler:
As you can see, the 'dc:' tag prefix/suffix is missing on all metadata items in the epub. It appears that setmetadaxml() is deliberately removing 'dc:' from my data. What am I missing or is this a known problem with setmetadataxml()? Any ideas? Last edited by slowsmile; 07-03-2017 at 10:42 PM. |
![]() |
![]() |
![]() |
#209 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,631
Karma: 204624552
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
Code:
xmlns:dc="http://purl.org/dc/elements/1.1/" Look at the metadata tag properties in the OPF of Sigil's empty epub template for an example of the namepace declaration(s) you need to provide for the metadata tag that you ultimately hand back to the setmetadataxml() function if you're using dc metadata. Instead of: Code:
data = (' <metadata>') Code:
data = (' <metadata xmlns:opf="http://www.idpf.org/2007/opf" xmlns:dc="http://purl.org/dc/elements/1.1/">') Last edited by DiapDealer; 07-03-2017 at 10:45 PM. |
|
![]() |
![]() |
![]() |
#210 |
Witchman
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
@DiapDealer...Much thanks for your quick reply. I'll give that a try.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Loading Plugin in development | Sladd | Development | 6 | 06-17-2014 06:57 PM |
Question for plugin development gurus | DiapDealer | Plugins | 2 | 02-04-2012 11:33 PM |
DR800 Plugin development for DR800/DR1000 | yuri_b | iRex Developer's Corner | 0 | 09-18-2010 09:46 AM |
Device plugin development | reader42 | Plugins | 10 | 03-29-2010 12:39 PM |
Calibre plugin development - Newbie problems | minstrel | Plugins | 5 | 04-12-2009 12:44 PM |