changing current layer through an extension
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
| Inkscape |
Low
|
cosmin |
Bug Description
When trying to modify the current layer through a python extension, it doesn't work.
When I try to set up the inkscape:
nv = self.getNamedView()
nv.set(
When this code is executed, I would expect that the layer with the id 'my_new_layer' is selected, but instead the same layer is selected (that was selected before executing the code). Please find attached a demo extension. Execute the extension. You will notice that although the output document contains the correct id in the inkscape:
cosmin (cosminadrianpopescu) wrote : | #1 |
tags: | added: extensions-plugins |
su_v (suv-lp) wrote : | #2 |
su_v (suv-lp) wrote : | #3 |
Nevermind the previous comment (doesn't seem related bug-wise, maybe slightly related to using methods to avoid creating objects in 'root').
su_v (suv-lp) wrote : | #4 |
Similar comment by another extension developer:
<http://
Changed in inkscape: | |
status: | New → Confirmed |
cosmin (cosminadrianpopescu) wrote : | #5 |
Please find attached a patch for this bug. Copy the file inside the inkscape-
patch -i script.patch
Please note that the patch is made on the code downloaded from here: http://
Changed in inkscape: | |
importance: | Undecided → Wishlist |
milestone: | none → 0.49 |
status: | Confirmed → Triaged |
jazzynico (jazzynico) wrote : | #6 |
Patch tested successfully on Windows XP, Inkscape trunk revision 10568.
More tests later on Ubuntu.
Changed in inkscape: | |
assignee: | nobody → JazzyNico (jazzynico) |
status: | Triaged → In Progress |
cosmin (cosminadrianpopescu) wrote : | #7 |
I've tested the patch on Ubuntu before submitting it.
jazzynico (jazzynico) wrote : | #8 |
Fix committed in the trunk, revision 10608.
Thanks for the patch!
Changed in inkscape: | |
assignee: | JazzyNico (jazzynico) → cosmin (cosminadrianpopescu) |
status: | In Progress → Fix Committed |
su_v (suv-lp) wrote : | #9 |
@JazzyNico - would you consider it save to backport the fix to the stable branch? It was originally written against 0.48.1, has no string changes, and maybe could be considered as bug fix rather than implementing a new feature.
(question based on an inquiry in #inskcape on irc about the bug status)
jazzynico (jazzynico) wrote : | #10 |
@ ~suv - No objection. Tests in progress!
Changed in inkscape: | |
importance: | Wishlist → Low |
jazzynico (jazzynico) wrote : | #11 |
Patch backported to the branch, revision 9836.
Changed in inkscape: | |
milestone: | 0.49 → 0.48.3 |
Changed in inkscape: | |
status: | Fix Committed → Fix Released |
su_v (suv-lp) wrote : | #12 |
Based on <https:/
AFAIU the id "base" is not reserved for Inkscape's <sodipodi:
The bug demo extension to change the current layer to a newly added one (with id "my_new_layer"):
- works, if <sodipodi:namedview id="base" …> (file was based on a default template)
- fails [1], if <sodipodi:namedview id="namedview1234" … /> and <rect id=base" … />
- fails, if <sodipodi:namedview id="namedview1234" … /> and no object has id = "base" (crash in 0.48.3.1)
Isn't there a more reliable way to retrieve and set the current layer information from <sodipodi:
---
[1] Console warning from trunk after running the bug demo extension, if a regular object uses the id "base" (and <sodipodi:
** (inkscape:44023): CRITICAL **: SPObject* SPDocument:
jazzynico (jazzynico) wrote : | #13 |
Yes, we can select the namedview directly from the document.
Patch attached, tested (very quicky) on Windows XP only.
su_v (suv-lp) wrote : | #14 |
> Patch attached, tested (very quicky) on Windows XP only.
Initial tests with Inkscape 0.48+devel r11563+
Thx for looking into this :)
jazzynico (jazzynico) wrote : | #15 |
Redirecting the patch and WIP status to Bug #944077.
su_v (suv-lp) wrote : | #16 |
Backported patch tested ok with Inkscape 0.48.x r9904 on OS X 10.7.4 (64bit build)
(attached patch includes two white-space changes to match coding style of the rest of the document)
Possibly related:
'Live Preview' issue described in comments #16 and #17 of bug #789122.