12-19-2015, 11:35 PM | #121 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Also, note that it is now important to rely on the plugin launcher's recorded preferences dir, since Sigil 0.9.2 has the ability to relocate the preferences dir via an environment variable.
I have mentioned that at portableapps.com so hopefully they will be using that once they publish a portable Sigil 0.9.2 |
12-20-2015, 06:41 AM | #122 |
Grand Sorcerer
Posts: 27,979
Karma: 198535232
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Very good point. I don't know of any plugins that really utilize a "hackish" method of determining the prefs directory, but if there are ... they should probably think about switching to the discussed method. But in reality, any method that computes the path to the preferences directory as a parent directory of the current running plugin's location should still be OK. the plugins are IN the prefs directory, afterall.
Last edited by DiapDealer; 12-21-2015 at 06:19 PM. |
Advert | |
|
12-20-2015, 11:08 AM | #123 |
Sigil Developer
Posts: 8,113
Karma: 5450184
Join Date: Nov 2009
Device: many
|
Head's Up for Plugin Developers: autostart capability for plugins being added
This is a head's up for all plugin developers. In my dev tree I have made changes to support the following new plugin.xml tag.
Code:
<autostart>true</autostart> Therefore this change should be completely backwards compatible and my plan is to add it for the next release of Sigil unless there is no interest from plugin developers. Also, if there is interest from plugin developers, I could also add an: Code:
<autoclose>true</autoclose> Please let me know what you think of the autostart capability and if you would like an autoclose tag as well. Thanks, KevinH |
12-20-2015, 11:16 AM | #124 |
Banned
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
|
I would appreciate both
|
12-20-2015, 11:45 AM | #125 |
Grand Sorcerer
Posts: 5,637
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
Both would be extremely helpful for validation plugins.
|
Advert | |
|
12-20-2015, 12:00 PM | #126 |
Sigil Developer
Posts: 8,113
Karma: 5450184
Join Date: Nov 2009
Device: many
|
Hi Doitsu,
Validation plugins that report no errors (return an error value of 0 from run()) should already autoclose. That said, I went and added support for autoclose to my tree as well. If anyone builds their own, grab master today and you should have both for testing with. Take care, KevinH |
12-20-2015, 01:26 PM | #127 |
Grand Sorcerer
Posts: 27,979
Karma: 198535232
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
That's quite lovely, thanks!
|
12-20-2015, 02:36 PM | #128 |
Banned
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
|
I'm adding a file with
Code:
bk.addfile(uid, basename, data, mt) Last edited by rubeus; 12-20-2015 at 02:40 PM. |
12-20-2015, 02:47 PM | #129 |
Sigil Developer
Posts: 8,113
Karma: 5450184
Join Date: Nov 2009
Device: many
|
You have to add it to the spine. You can add many file types that should not be added directly to the spine.
|
12-20-2015, 03:09 PM | #130 | |
Banned
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
|
Quote:
Code:
bk._w.spine.append((uid, None)) Code:
Traceback (most recent call last): File "C:\Program Files\Sigil\plugin_launchers\python\launcher.py", line 301, in <module> sys.exit(main()) File "C:\Program Files\Sigil\plugin_launchers\python\launcher.py", line 268, in main ps.launch() File "C:\Program Files\Sigil\plugin_launchers\python\launcher.py", line 149, in launch container._w.write_opf() File "C:\Program Files\Sigil\plugin_launchers\python\wrapper.py", line 268, in write_opf data = utf8_str(self.build_opf()) File "C:\Program Files\Sigil\plugin_launchers\python\wrapper.py", line 256, in build_opf data.append(self.build_spine_xml()) File "C:\Program Files\Sigil\plugin_launchers\python\wrapper.py", line 230, in build_spine_xml for (id, linear, properties) in self.spine: ValueError: need more than 2 values to unpack |
|
12-20-2015, 03:13 PM | #131 |
Sigil Developer
Posts: 8,113
Karma: 5450184
Join Date: Nov 2009
Device: many
|
No, you should not use calls to the wrapper directly. ie. not bk._w ...
The correct call is direct to the bk object. See the bookcontainer.py code in the developers manual. bk.spine_insert_before(pos, sid, linear, properties=None) If you set the position, pos, to -1 or something greater than the number of current spine entries, it will append it to the end of the current spine. Last edited by KevinH; 12-20-2015 at 03:23 PM. |
12-20-2015, 03:26 PM | #132 |
Banned
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
|
Sorry i'm to dumb for that, what is linear?
Code:
bk.spine_insert_before(-1, uid, linear, properties=None) Last edited by rubeus; 12-20-2015 at 03:32 PM. |
12-20-2015, 03:32 PM | #133 |
Sigil Developer
Posts: 8,113
Karma: 5450184
Join Date: Nov 2009
Device: many
|
That is the spine itemref linear attribute. You can set it to None for default.
According to the spec, it determines if the referenced content is "primary" or not. It takes values "yes", "no", and can be left out entirely by setting it to None which then defaults to "yes". Last edited by KevinH; 12-20-2015 at 03:39 PM. |
12-20-2015, 03:41 PM | #134 |
Sigil Developer
Posts: 8,113
Karma: 5450184
Join Date: Nov 2009
Device: many
|
I will test this from my end and get back to you soon.
KevinH |
12-20-2015, 03:52 PM | #135 | |
Banned
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
|
Quote:
Code:
uid = 'T12345' bk.addfile(uid, 'Test0001.xhtml', xml, 'application/xhtml+xml') bk.spine_insert_before(-1, uid, None, properties=None) Code:
Traceback (most recent call last): File "C:\Program Files\Sigil\plugin_launchers\python\launcher.py", line 301, in <module> sys.exit(main()) File "C:\Program Files\Sigil\plugin_launchers\python\launcher.py", line 268, in main ps.launch() File "C:\Program Files\Sigil\plugin_launchers\python\launcher.py", line 149, in launch container._w.write_opf() File "C:\Program Files\Sigil\plugin_launchers\python\wrapper.py", line 268, in write_opf data = utf8_str(self.build_opf()) File "C:\Program Files\Sigil\plugin_launchers\python\wrapper.py", line 256, in build_opf data.append(self.build_spine_xml()) File "C:\Program Files\Sigil\plugin_launchers\python\wrapper.py", line 230, in build_spine_xml for (id, linear, properties) in self.spine: TypeError: 'NoneType' object is not iterable |
|
|
Similar Threads | ||||
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 |