General Purpose Python Scripting for Inkscape.
Hi Guys,
Inkscape is amazing!, I am a professional software developer, I have been working in an embedded scripting plugin for Inkscape, I started doing it for my own purposes (designing electric guitars and CNC parts) And now I have complete support for python scripting inside inkscape. I will release the code as open source in Github or Gitlab as soon as I can write some documentation. The attached screenshot shows how it looks. The plugin has its own code editor with syntax highlight, compilation check, and run. It uses only python and gtk3, my working environment is Linux Mint, I am not sure if it will work out of the box in windows or mac yet, but i am pretty sure it will run in all platforms eventually soon.
The scripting environment gives full access to the svg document, xml manipulation and also Object Oriented wrappers (mainly for path creation and manipulation). Full python environment is also available. The scripting code is stored inside the document (<script> tags) and you can import external libraries too of course.
I hope some contributions will make the project better with time. This is not a macro system, you can not record actions or invoke GUI actions, you can just write scripts inside the document and manipulate the document itself, move, transform, change attributes, create objects etc.. from python scripts.
All your feedback will be welcome and I will be very pleased if the project result useful for the community.
Cheers,
Frank.
Does it provide similar capabilities to/like lisp in autoCAD?
Sent from my iPhone
On Mar 22, 2019, at 21:42, Frank Martínez <mnesarco@...155...> wrote:
Hi Guys,
Inkscape is amazing!, I am a professional software developer, I have been working in an embedded scripting plugin for Inkscape, I started doing it for my own purposes (designing electric guitars and CNC parts) And now I have complete support for python scripting inside inkscape. I will release the code as open source in Github or Gitlab as soon as I can write some documentation. The attached screenshot shows how it looks. The plugin has its own code editor with syntax highlight, compilation check, and run. It uses only python and gtk3, my working environment is Linux Mint, I am not sure if it will work out of the box in windows or mac yet, but i am pretty sure it will run in all platforms eventually soon.
The scripting environment gives full access to the svg document, xml manipulation and also Object Oriented wrappers (mainly for path creation and manipulation). Full python environment is also available. The scripting code is stored inside the document (<script> tags) and you can import external libraries too of course.
I hope some contributions will make the project better with time. This is not a macro system, you can not record actions or invoke GUI actions, you can just write scripts inside the document and manipulate the document itself, move, transform, change attributes, create objects etc.. from python scripts.
All your feedback will be welcome and I will be very pleased if the project result useful for the community.
Cheers,
Frank.
-- Frank D. Martínez M.
<inkscape pyscript.png> _______________________________________________ Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
Dear Frank Martínez,
This work looks really exciting. I'd love to get you in touch with Thomas Wiesner who has done a similar work in progress merge request:
https://gitlab.com/inkscape/inkscape/merge_requests/417
This functionality is similar, although not exactly the same. I believe though that issues around how python accesses the internal svg document are going to be the same.
The landing plan for such a feature would have to be post 1.0, so if you were able to produce a branch on GitLab, then we would review it but only want to merge it in after the 1.0 release is out the door.
You can also join us at https://chat.inkscape.org to talk more to other developers as well as sending your message to the inkscape-devel mailing list.
Best Regards, Martin Owens
On Fri, 2019-03-22 at 20:42 -0500, Frank Martínez wrote:
Hi Guys,
Inkscape is amazing!, I am a professional software developer, I have been working in an embedded scripting plugin for Inkscape, I started doing it for my own purposes (designing electric guitars and CNC parts) And now I have complete support for python scripting inside inkscape. I will release the code as open source in Github or Gitlab as soon as I can write some documentation. The attached screenshot shows how it looks. The plugin has its own code editor with syntax highlight, compilation check, and run. It uses only python and gtk3, my working environment is Linux Mint, I am not sure if it will work out of the box in windows or mac yet, but i am pretty sure it will run in all platforms eventually soon.
The scripting environment gives full access to the svg document, xml manipulation and also Object Oriented wrappers (mainly for path creation and manipulation). Full python environment is also available. The scripting code is stored inside the document (<script> tags) and you can import external libraries too of course.
I hope some contributions will make the project better with time. This is not a macro system, you can not record actions or invoke GUI actions, you can just write scripts inside the document and manipulate the document itself, move, transform, change attributes, create objects etc.. from python scripts.
All your feedback will be welcome and I will be very pleased if the project result useful for the community.
Cheers,
Frank.
Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
Really exciting news! Thanks for your work!
On Sat, 23 Mar 2019, 03:27 , <doctormo@...155...> wrote:
Dear Frank Martínez,
This work looks really exciting. I'd love to get you in touch with Thomas Wiesner who has done a similar work in progress merge request:
https://gitlab.com/inkscape/inkscape/merge_requests/417
This functionality is similar, although not exactly the same. I believe though that issues around how python accesses the internal svg document are going to be the same.
The landing plan for such a feature would have to be post 1.0, so if you were able to produce a branch on GitLab, then we would review it but only want to merge it in after the 1.0 release is out the door.
You can also join us at https://chat.inkscape.org to talk more to other developers as well as sending your message to the inkscape-devel mailing list.
Best Regards, Martin Owens
On Fri, 2019-03-22 at 20:42 -0500, Frank Martínez wrote:
Hi Guys,
Inkscape is amazing!, I am a professional software developer, I have been working in an embedded scripting plugin for Inkscape, I started doing it for my own purposes (designing electric guitars and CNC parts) And now I have complete support for python scripting inside inkscape. I will release the code as open source in Github or Gitlab as soon as I can write some documentation. The attached screenshot shows how it looks. The plugin has its own code editor with syntax highlight, compilation check, and run. It uses only python and gtk3, my working environment is Linux Mint, I am not sure if it will work out of the box in windows or mac yet, but i am pretty sure it will run in all platforms eventually soon.
The scripting environment gives full access to the svg document, xml manipulation and also Object Oriented wrappers (mainly for path creation and manipulation). Full python environment is also available. The scripting code is stored inside the document (<script> tags) and you can import external libraries too of course.
I hope some contributions will make the project better with time. This is not a macro system, you can not record actions or invoke GUI actions, you can just write scripts inside the document and manipulate the document itself, move, transform, change attributes, create objects etc.. from python scripts.
All your feedback will be welcome and I will be very pleased if the project result useful for the community.
Cheers,
Frank.
Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
Hi Guys, Thanks for the enthusiasm, I have to highlight some important points:
1. I started this as a hack initially to control some drawing constraints, then it grows to something bigger. 2. I used the standard Inkscape extension mechanism. So this "plugin" is a simple python extension. 3. I am not an Autocad user, so I can't compare with Autocad's lisp macro system. 4. What you get: In your script you can manipulate the current svg document. You can do whatever you want with it. 5. I have coded a general purpose Path object wrapper to create and modify paths in an OOP fashion. 6. The code of this extension is simple, not rocket science ;) 7. I am on travel, but next week I will push it to gitlab. 8. There is a lot of room for improvement. 9. Two more screenshots attached ;)
Cheers, Frank.
On Sat, Mar 23, 2019 at 4:02 AM C R <cajhne@...155...> wrote:
Really exciting news! Thanks for your work!
On Sat, 23 Mar 2019, 03:27 , <doctormo@...155...> wrote:
Dear Frank Martínez,
This work looks really exciting. I'd love to get you in touch with Thomas Wiesner who has done a similar work in progress merge request:
https://gitlab.com/inkscape/inkscape/merge_requests/417
This functionality is similar, although not exactly the same. I believe though that issues around how python accesses the internal svg document are going to be the same.
The landing plan for such a feature would have to be post 1.0, so if you were able to produce a branch on GitLab, then we would review it but only want to merge it in after the 1.0 release is out the door.
You can also join us at https://chat.inkscape.org to talk more to other developers as well as sending your message to the inkscape-devel mailing list.
Best Regards, Martin Owens
On Fri, 2019-03-22 at 20:42 -0500, Frank Martínez wrote:
Hi Guys,
Inkscape is amazing!, I am a professional software developer, I have been working in an embedded scripting plugin for Inkscape, I started doing it for my own purposes (designing electric guitars and CNC parts) And now I have complete support for python scripting inside inkscape. I will release the code as open source in Github or Gitlab as soon as I can write some documentation. The attached screenshot shows how it looks. The plugin has its own code editor with syntax highlight, compilation check, and run. It uses only python and gtk3, my working environment is Linux Mint, I am not sure if it will work out of the box in windows or mac yet, but i am pretty sure it will run in all platforms eventually soon.
The scripting environment gives full access to the svg document, xml manipulation and also Object Oriented wrappers (mainly for path creation and manipulation). Full python environment is also available. The scripting code is stored inside the document (<script> tags) and you can import external libraries too of course.
I hope some contributions will make the project better with time. This is not a macro system, you can not record actions or invoke GUI actions, you can just write scripts inside the document and manipulate the document itself, move, transform, change attributes, create objects etc.. from python scripts.
All your feedback will be welcome and I will be very pleased if the project result useful for the community.
Cheers,
Frank.
Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
Thanks for the updates Frank,
This changes the calculation a little bit.
- I used the standard Inkscape extension mechanism. So this "plugin"
is a simple python extension.
This is interesting, there is a todo task for building a python extensions manager that allows one to download extensions from the internet, remove extensions and see other information about them.
Perhaps this can move in that direction?
- I have coded a general purpose Path object wrapper to create and
modify paths in an OOP fashion.
We have developed a new OOP Path (and other things) python library into Inkscape Extensions 1.0 project. This is a new python3 based, unit test driven repository that replaces the old python extensions repository completely.
If you're developing these advances as python extensions, then I'd love to get your code into the extensions repository, especially advances in the Path manipulation API or even just a review of the Path API we have constructed.
When you create a GitLab branch/project you have two choices I think. You can make your own project with only the new files, or you could commit an Inkscape branch with the changes. If you do the later, please do also make an extensions branch with any python pieces so we can review how to integrate them (hopefully!)
Thanks for your contribution Frank, this is exciting work.
Best Regards, Martin Owens
On Fri 22 Mar 2019 20:42 -0500, Frank Mart?nez wrote:
Hi Guys,
Inkscape is amazing!, I am a professional software developer, I have been working in an embedded scripting plugin for Inkscape, . . .
One question: Have you found a way of selecting an object after your script runs?
This point bothered me several times and I hope you found a solution.
Andrew
Hi Andrew,
I am afraid it is not possible to select objects inside inkscape from external python extensions without using dbus or something like that. My scripting extension knows nothing about inkscape itself, only have access to the svg document. It is possible to add some metadata with ids of selected objects to be used later for other extensions, but Inkscape will ignore them.
If I am wrong about this, please show me the light ;)
Cheers, Frank.
On Mon, Mar 25, 2019 at 9:46 PM Andrew Kurn <kurn@...3346...> wrote:
On Fri 22 Mar 2019 20:42 -0500, Frank Mart?nez wrote:
Hi Guys,
Inkscape is amazing!, I am a professional software developer, I have been working in an embedded scripting plugin for Inkscape, . . .
One question: Have you found a way of selecting an object after your script runs?
This point bothered me several times and I hope you found a solution.
Andrew
Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
Dear Inkscape Friends,
I have pushed the current code to Gitlab, take it as an experiment, the code is pretty basic, it just works for me and my use cases. There is no documentation yet but i published it to hear some feedback.
I suspect this kind of functionality can be developed inside inkscape c++ codebase, it is pretty simple, it is just a window to edit code, and a call to python external interpreter.
My current environment is: Inkscape 0.92.4 and Python 2.7.12
Here is the link to the project (work in progress project):
https://gitlab.com/mnesarco/inkscape-pyscript
Cheers,
Frank D. Martínez. (mnesarco)
On Tue, Mar 26, 2019 at 1:38 PM Frank Martínez <mnesarco@...155...> wrote:
Hi Andrew,
I am afraid it is not possible to select objects inside inkscape from external python extensions without using dbus or something like that. My scripting extension knows nothing about inkscape itself, only have access to the svg document. It is possible to add some metadata with ids of selected objects to be used later for other extensions, but Inkscape will ignore them.
If I am wrong about this, please show me the light ;)
Cheers, Frank.
On Mon, Mar 25, 2019 at 9:46 PM Andrew Kurn <kurn@...3346...> wrote:
On Fri 22 Mar 2019 20:42 -0500, Frank Mart?nez wrote:
Hi Guys,
Inkscape is amazing!, I am a professional software developer, I have
been
working in an embedded scripting plugin for Inkscape, . . .
One question: Have you found a way of selecting an object after your script runs?
This point bothered me several times and I hope you found a solution.
Andrew
Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
-- Frank D. Martínez M.
On Tue, 2019-03-26 at 13:38 -0500, Frank Martínez wrote:
If I am wrong about this, please show me the light ;)
Is it something we should add?
<g inkscape:selectme="true">...</g>
And Inkscape selects such things after running extensions (and cleans up the attribute). It could be added I think very easily.
Martin,
Hi Martin, it sounds great!
El mar., 26 de mar. de 2019 2:43 p. m., <doctormo@...155...> escribió:
On Tue, 2019-03-26 at 13:38 -0500, Frank Martínez wrote:
If I am wrong about this, please show me the light ;)
Is it something we should add?
<g inkscape:selectme="true">...</g>
And Inkscape selects such things after running extensions (and cleans up the attribute). It could be added I think very easily.
Martin,
Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
So I couldn't get code to work with "inkscape:selected" attribute, but I could get it working with class="selected", so take a look at this branch/merge request:
https://gitlab.com/inkscape/inkscape/merge_requests/608
It'll allow any extension to add (but not remove) selected items. (comment in the Merge request to continue this conversation)
Martin,
On Tue, 2019-03-26 at 15:27 -0500, Frank Martínez wrote:
Hi Martin, it sounds great!
El mar., 26 de mar. de 2019 2:43 p. m., <doctormo@...155...> escribió:
On Tue, 2019-03-26 at 13:38 -0500, Frank Martínez wrote:
If I am wrong about this, please show me the light ;)
Is it something we should add?
<g inkscape:selectme="true">...</g>
And Inkscape selects such things after running extensions (and cleans up the attribute). It could be added I think very easily.
Martin,
Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
Yes!
I wished I could do it several different times.
Andrew
On Tue 26 Mar 2019 15:42 -0400, doctormo@...155... wrote:
On Tue, 2019-03-26 at 13:38 -0500, Frank Martínez wrote:
If I am wrong about this, please show me the light ;)
Is it something we should add?
<g inkscape:selectme="true">...</g>
And Inkscape selects such things after running extensions (and cleans up the attribute). It could be added I think very easily.
Martin,
Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
Digging a little inside inkscape/extensions/ source code at Gitlab, I have discovered that extensions code have changed a lot from 0.92.4, so I will have to port the pyscript at some point in near future. By now I will try to maintain this version because no one knows when new extensions 1.0 will be released.
On Tue, Mar 26, 2019 at 4:58 PM Andrew Kurn <kurn@...3346...> wrote:
Yes!
I wished I could do it several different times.
Andrew
On Tue 26 Mar 2019 15:42 -0400, doctormo@...155... wrote:
On Tue, 2019-03-26 at 13:38 -0500, Frank Martínez wrote:
If I am wrong about this, please show me the light ;)
Is it something we should add?
<g inkscape:selectme="true">...</g>
And Inkscape selects such things after running extensions (and cleans up the attribute). It could be added I think very easily.
Martin,
Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
On Tue, 2019-03-26 at 21:22 -0500, Frank Martínez wrote:
Digging a little inside inkscape/extensions/ source code at Gitlab, I have discovered that extensions code have changed a lot from 0.92.4, so I will have to port the pyscript at some point in near future. By now I will try to maintain this version because no one knows when new extensions 1.0 will be released.
It's targeted for release with Inkscape 1.0
Hi Martin, The work from Thomas at https://gitlab.com/inkscape/inkscape/merge_requests/417 looks amazing. It makes my extension useless :D but I love it.
So, I think I can maintain my extension for (0.92) for some time, but if the Thomas's works is included soon, there is no need to port my extension to inkscape 1.0+.
I was reviewing my knowledge of C++ just to do what Thomas is doing already :D :D :D
Just two things I thing are important to include:
1. Embedded Python code editor with syntax highlight and ideally code completion. 2. Support to create/edit/execute embeded python scripts in the svg document itself:
<script type="text/python" id="main"> ..... </script>
Cheers,
Frank.
On Tue, Mar 26, 2019 at 10:53 PM <doctormo@...155...> wrote:
On Tue, 2019-03-26 at 21:22 -0500, Frank Martínez wrote:
Digging a little inside inkscape/extensions/ source code at Gitlab, I have discovered that extensions code have changed a lot from 0.92.4, so I will have to port the pyscript at some point in near future. By now I will try to maintain this version because no one knows when new extensions 1.0 will be released.
It's targeted for release with Inkscape 1.0
Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
Hi Frank,
I think the feature is going to be held in a queue until Inkscape 1.0 is out the door. But this means it's going to need support, to keep the branch up to date (sync with master) as well as improve it and refine it.
It would be great if you could help with this process. Just keep an eye on it, test it now and then and see if there's anything interesting in the work you've done (like the embedded script feature) which would be a good fit to add. In my experience cool ideas happen only when the force behind them puts the time in to making it happen and you could create amerge request to merge your ideas into Thomas' branch without it having to touch master first (this is the advantage of git).
Thanks for looking at the branch too, I was hoping you would find it exciting!
Best Regards, Martin Owens
On Thu, 2019-03-28 at 10:07 -0500, Frank Martínez wrote:
Hi Martin, The work from Thomas at https://gitlab.com/inkscape/inkscape/merge_requests/417 looks amazing. It makes my extension useless :D but I love it.
So, I think I can maintain my extension for (0.92) for some time, but if the Thomas's works is included soon, there is no need to port my extension to inkscape 1.0+.
I was reviewing my knowledge of C++ just to do what Thomas is doing already :D :D :D
Just two things I thing are important to include:
- Embedded Python code editor with syntax highlight and ideally code
completion. 2. Support to create/edit/execute embeded python scripts in the svg document itself:
<script type="text/python" id="main"> ..... </script>
Cheers,
Frank.
On Tue, Mar 26, 2019 at 10:53 PM <doctormo@...155...> wrote:
On Tue, 2019-03-26 at 21:22 -0500, Frank Martínez wrote:
Digging a little inside inkscape/extensions/ source code at
Gitlab, I
have discovered that extensions code have changed a lot from
0.92.4,
so I will have to port the pyscript at some point in near future.
By
now I will try to maintain this version because no one knows
when
new extensions 1.0 will be released.
It's targeted for release with Inkscape 1.0
Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
On Tue, 26 Mar 2019 15:42:52 -0400 doctormo@...155... wrote:
On Tue, 2019-03-26 at 13:38 -0500, Frank Martínez wrote:
If I am wrong about this, please show me the light ;)
Is it something we should add?
<g inkscape:selectme="true">...</g>
And Inkscape selects such things after running extensions (and cleans up the attribute). It could be added I think very easily.
Another cool thing about that is that selections survives stops and restarts in normal Inkscape usage.
SteveT
On Thu 28 Mar 2019 18:29 -0400, Steve Litt wrote:
On Tue, 26 Mar 2019 15:42:52 -0400 doctormo@...155... wrote:
On Tue, 2019-03-26 at 13:38 -0500, Frank Martínez wrote:
If I am wrong about this, please show me the light ;)
Is it something we should add?
<g inkscape:selectme="true">...</g>
And Inkscape selects such things after running extensions (and cleans up the attribute). It could be added I think very easily.
Another cool thing about that is that selections survives stops and restarts in normal Inkscape usage.
SteveT
Steve,
Either you misunderstand or I do.
What I think Martin means is that, at the end of running each extension, it finds all /selectme/ attributes and makes the selection from them. We agree there.
But, when he says "cleans up", I take it to mean "immediately removes the attribute(s) from the SVG." Thus there is nothing left around to keep in a saved SVG file.
This seems like a required part of the extension-selection process.
Andrew
Btw. did you know that since Inkscape 0.92.4, Inkscape already tries to keep selected objects selected, even after running the extension?
This works for modified objects only, not for rendered ones.
Maren
Am 29.03.19 um 03:34 schrieb Andrew Kurn:
On Thu 28 Mar 2019 18:29 -0400, Steve Litt wrote:
On Tue, 26 Mar 2019 15:42:52 -0400 doctormo@...155... wrote:
On Tue, 2019-03-26 at 13:38 -0500, Frank Martínez wrote:
If I am wrong about this, please show me the light ;)
Is it something we should add?
<g inkscape:selectme="true">...</g>
And Inkscape selects such things after running extensions (and cleans up the attribute). It could be added I think very easily.
Another cool thing about that is that selections survives stops and restarts in normal Inkscape usage.
SteveT
Steve,
Either you misunderstand or I do.
What I think Martin means is that, at the end of running each extension, it finds all /selectme/ attributes and makes the selection from them. We agree there.
But, when he says "cleans up", I take it to mean "immediately removes the attribute(s) from the SVG." Thus there is nothing left around to keep in a saved SVG file.
This seems like a required part of the extension-selection process.
Andrew
Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
On Fri 29 Mar 2019 04:58 +0100, Maren Hachmann wrote:
Btw. did you know that since Inkscape 0.92.4, Inkscape already tries to keep selected objects selected, even after running the extension?
No and that's not I want to do anyway.
This works for modified objects only, not for rendered ones.
We had a long talk a while ago about what /rendered/ might mean. What do you mean here?
Andrew
On Thu, 28 Mar 2019 21:05:48 -0700 Andrew Kurn <kurn@...3346...> wrote:
On Fri 29 Mar 2019 04:58 +0100, Maren Hachmann wrote:
Btw. did you know that since Inkscape 0.92.4, Inkscape already tries to keep selected objects selected, even after running the extension?
No and that's not I want to do anyway.
=========================================================== About 20 posts back, you began this train of thought with the question: "Have you found a way of selecting an object after your script runs?" ===========================================================
Did you mean?:
* Select the object(s) the script finished?
* Re-select the objects that were selected when Inkscape closed?
* Enable someone, running Inkscape after your script ran, to select something?
* Select a random object(s)?
* Something else? If so, please elaborate succinctly and unambiguously.
* Some combination of the preceding?
This entire thread has apparently been built on misunderstandings, so please be sure not to top post, answer the preceding questions inline, succinctly, and unambiguously. Once we're all on the same page the discussion will be much more efficient.
SteveT
On Fri 29 Mar 2019 02:11 -0400, Steve Litt wrote:
On Thu, 28 Mar 2019 21:05:48 -0700 Andrew Kurn <kurn@...3346...> wrote:
=========================================================== About 20 posts back, you began this train of thought with the question: "Have you found a way of selecting an object after your script runs?" ===========================================================
Sorry. Didn't mean to sow confusion.
Did you mean?:
None of the above.
I want the power, as the author of the extension/script to choose what gets selected when the script finishes. Martin's suggestion of adding an attribute to those items that I want to select seems to meet with some approval, so I'm happy to go with that, if it works for the programmers. Other ways would also be acceptable.
This entire thread has apparently been built on misunderstandings, so please be sure not to top post,
While we're at it, what does "top post" mean?
answer the preceding questions inline,
succinctly, and unambiguously. Once we're all on the same page the discussion will be much more efficient.
I'm not sure I've met the criterion of succinctness, but I believe my meaning is now unambiguous.
Do you agree, SteveT?
Andrew
On Fri, 29 Mar 2019 00:25:08 -0700 Andrew Kurn <kurn@...3346...> wrote:
On Fri 29 Mar 2019 02:11 -0400, Steve Litt wrote:
This entire thread has apparently been built on misunderstandings, so please be sure not to top post,
While we're at it, what does "top post" mean?
Long story: See :
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
https://en.wikipedia.org/wiki/Posting_style#Top-posting
https://en.wikipedia.org/wiki/Posting_style#Bottom-posting
When the article says interleave style can be combined with top-posting, that's not true in the real world. Only bottom posting is compatible with interleave style.
Interleave style is by far the least ambiguous. Questions are answered immediately below the corresponding question. Words like "it" and "you" and "I disagree" are absolutely unambiguous in interleave posting, whereas they're gobbletygoop in top posting, especially when ten people have responded and their quoted context is still visible.
Top posting is a ball of confusion in a multi party mind meld like a mailing list, but I've mostly surrendered the war to Microsoft and Google and all the vendors whose mail clients automatically top post. Also, top posting (without trimming) is the standard in business communication in order to keep a running log and promote CYA.
But once in a while, when misunderstanding becomes a way of life in a thread, I step in to ask people not to top post.
SteveT
On Fri, 29 Mar 2019 00:25:08 -0700 Andrew Kurn <kurn@...3346...> wrote:
On Fri 29 Mar 2019 02:11 -0400, Steve Litt wrote:
On Thu, 28 Mar 2019 21:05:48 -0700
[snip]
Did you mean?:
None of the above.
I want the power, as the author of the extension/script to choose what gets selected when the script finishes. Martin's suggestion of adding an attribute to those items that I want to select seems to meet with some approval, so I'm happy to go with that, if it works for the programmers. Other ways would also be acceptable.
[snip]
answer the preceding questions inline,
succinctly, and unambiguously. Once we're all on the same page the discussion will be much more efficient.
I'm not sure I've met the criterion of succinctness, but I believe my meaning is now unambiguous.
Do you agree, SteveT?
I do, assuming what you mean is that you author an extension or script, it runs on the SVG file, and then when a human pulls up the SVG modified by yours script, the objects your script asked to be selected are signified as selected within the Inkscape program.
SteveT
Am 29.03.19 um 05:05 schrieb Andrew Kurn:
On Fri 29 Mar 2019 04:58 +0100, Maren Hachmann wrote:
Btw. did you know that since Inkscape 0.92.4, Inkscape already tries to keep selected objects selected, even after running the extension?
No and that's not I want to do anyway.
- Ah, it was a possible interpretation.
This works for modified objects only, not for rendered ones.
We had a long talk a while ago about what /rendered/ might mean. What do you mean here?
- Objects that are modified by an extensions exist before the extension runs. Objects that are rendered by an extension only come into existence once the extension has been run.
Maren
Andrew
Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
Hi, I have published a more interesting example document. It contains scripting to generate a complete parameterized Guitar Neck profile. I use this to laser cut templates.
The document is in the repo: https://gitlab.com/mnesarco/inkscape-pyscript/blob/master/pyscript_samples/u...
But also attached for general interest (if exists).
Cheers, Frank.
On Thu, Mar 28, 2019 at 10:59 PM Maren Hachmann <maren@...3112...> wrote:
Btw. did you know that since Inkscape 0.92.4, Inkscape already tries to keep selected objects selected, even after running the extension?
This works for modified objects only, not for rendered ones.
Maren
Am 29.03.19 um 03:34 schrieb Andrew Kurn:
On Thu 28 Mar 2019 18:29 -0400, Steve Litt wrote:
On Tue, 26 Mar 2019 15:42:52 -0400 doctormo@...155... wrote:
On Tue, 2019-03-26 at 13:38 -0500, Frank Martínez wrote:
If I am wrong about this, please show me the light ;)
Is it something we should add?
<g inkscape:selectme="true">...</g>
And Inkscape selects such things after running extensions (and cleans up the attribute). It could be added I think very easily.
Another cool thing about that is that selections survives stops and restarts in normal Inkscape usage.
SteveT
Steve,
Either you misunderstand or I do.
What I think Martin means is that, at the end of running each extension, it finds all /selectme/ attributes and makes the selection from them. We agree there.
But, when he says "cleans up", I take it to mean "immediately removes the attribute(s) from the SVG." Thus there is nothing left around to keep in a saved SVG file.
This seems like a required part of the extension-selection process.
Andrew
Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
On Tue, 26 Mar 2019 13:38:58 -0500 Frank Martínez <mnesarco@...155...> wrote:
Hi Andrew,
I am afraid it is not possible to select objects inside inkscape from external python extensions without using dbus or something like that.
Please don't use dbus. Architecturally it's a mess, and from time to time I see real world practical problems caused by that architecture. Plus, when tracking a problem, I like to easily discern who gave wrong info to whom, rather than tracing every message through a single switchtrack (fan in, fan out).
My scripting extension knows nothing about inkscape itself, only have access to the svg document.
Nice: Uber modularity. Everyone should do this.
It is possible to add some metadata with ids of selected objects to be used later for other extensions, but Inkscape will ignore them.
If it's *that* important (which I don't think it is), then Inkscape could be changed slightly to read your special metadata.
If I am wrong about this, please show me the light ;)
An earlier poster asked "Have you found a way of selecting an object after your script runs?" That's ambiguous. Select a random object(s)? Select the object(s) your script changed? Re-select the objects that were selected when Inkscape closed? Enable someone running Inkscape after your script ran to select something? Those are very different questions with very different answers.
If the request is to highlight the objects your script changed, for the purpose of letting the human Inkscape operator check and modify, I think it would suffice for your script to create a run log that identifies changes made.
SteveT
participants (7)
-
unknown@example.com
-
Andrew Kurn
-
C R
-
Frank Martínez
-
Maren Hachmann
-
Steve Litt
-
Tim Hoenninger