View Single Post
Old 02-02-2018, 11:49 PM   #314
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,961
Karma: 6361444
Join Date: Nov 2009
Device: many
I am not sure what you are asking exactly, but plugins and the plugin interfaces actually only work at the file level of an expanded epub inside Sigil (and uses copy on modify semantics too) and do not interact in any way with other elements of Sigil directly. It was designed that way to protect Sigil. As the plugin makes changes to xhtml, image, etc using the interface the opf is rebuilt automatically and the copied and modified results are stored away in a temporary directory. Upon completion of the plugin, an xml file which lists the changed, deleted, and added files is passed back from the forked plugin process and is used by Sigil itself to update the files that were changed, add the new files, and delete the removed files. The plugin interface does offer the list of files that are highlighted in the Bookbrowser when the plugin in launched if you only want to process a limited set of files.

A plugin also has access to bs4, gumbo, hunspell spellcheckers, and a number of required python libraries like cssutils, lxml, PIL and things and can use its own gui either pyqt or tk to interact with the user, but it is always working on the epub's file (copies of them) in a forked process that Sigil itself is waiting to finish and reading stdout from for the xml that tells Sigil what to do.

If you need to pass a specfic location in the code to the plugin, you must explain how the user should mark that text in some way using tags or text keys, before launching the plugin and then have the plugin limit itself to the currently highlighted file in Bookbrowser and search for your marker in that file and process it as you want.
KevinH is online now   Reply With Quote