sigil_edit_interface.zip
Hi Varlog,
As promised:
This is a Python 2.7 or 2.6 script but not a Python 3 script
The edit_launcher.py needs the following 5 inputs:
1. path to ebook saved as epub by Sigil and unpacked into this directory
2. path to the opf file in that ebook
3. path to the output directory
4. the name of the target python script module you want to run
(do not add the .py)
5. the directory which holds the target pythoin script you want to run
If you unpack the zip I uploaded into your home directory it will generate:
- an empty ebook directory (ebook) into which you should unzip an epub previously save by Sigil
- a launcher directory which will become part of Sigil - Sigil will actually always run QProcess on the edit_launcher.py script which in turn spawns a thread and runs the target script
- a target_script directory where I have placed a test target python script
- and an empty testout directory (which is a placeholder for the output directory Sigil will create
Once you have unpacked an epub Saved by Sigil in ebook/ you can basically test the edit_launcher.py by invoking it from the command line just by doing the following (change to match where you unpack things)
python edit_launcher.py ~/ebook ~/ebook/OEBPS/content.opf ~/testout test_target ~/target_script
You should see the result XML file with all of the stdout and stderr logs from the target script. I do that so I can validate the output, that can be turned off when in production
python target script programmers can check out the edit_launch.py script and
the bookcontainer.py script which represents the real interface.
The test_target.py script simply tries to exercise that interface.
Please give this a try and see if this helps explain the idea.
Just let me know if you have any questions at all.
Last edited by KevinH; 08-12-2014 at 03:49 PM.
|