General Purpose Python Scripting for Inkscape.

classic Classic list List threaded Threaded
28 messages Options
12
Reply | Threaded
Open this post in threaded view
|

General Purpose Python Scripting for Inkscape.

Frank Martínez
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-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user

inkscape pyscript.png (168K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: General Purpose Python Scripting for Inkscape.

Inkscape - User mailing list
Does it provide similar capabilities to/like
 lisp in autoCAD?

Sent from my iPhone

> On Mar 22, 2019, at 21:42, Frank Martínez <[hidden email]> 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/inkscape-user



_______________________________________________
Inkscape-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user
Reply | Threaded
Open this post in threaded view
|

Re: General Purpose Python Scripting for Inkscape.

doctormo
In reply to this post by Frank Martínez
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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/inkscape-user



_______________________________________________
Inkscape-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user
C R
Reply | Threaded
Open this post in threaded view
|

Re: General Purpose Python Scripting for Inkscape.

C R
Really exciting news! Thanks for your work! 

On Sat, 23 Mar 2019, 03:27 , <[hidden email]> 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/inkscape-user



_______________________________________________
Inkscape-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user


_______________________________________________
Inkscape-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user
Reply | Threaded
Open this post in threaded view
|

Re: General Purpose Python Scripting for Inkscape.

Frank Martínez
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 <[hidden email]> wrote:
Really exciting news! Thanks for your work! 

On Sat, 23 Mar 2019, 03:27 , <[hidden email]> 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/inkscape-user



_______________________________________________
Inkscape-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user
_______________________________________________
Inkscape-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user


--
Frank D. Martínez M.


_______________________________________________
Inkscape-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user

Screenshot3.png (196K) Download Attachment
Screenshot2.png (223K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: General Purpose Python Scripting for Inkscape.

doctormo
Thanks for the updates Frank,

This changes the calculation a little bit.

> 2. 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?

> 5. 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



_______________________________________________
Inkscape-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user
Reply | Threaded
Open this post in threaded view
|

Re: General Purpose Python Scripting for Inkscape.

Andrew Kurn
In reply to this post by Frank Martínez
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user
Reply | Threaded
Open this post in threaded view
|

Re: General Purpose Python Scripting for Inkscape.

Frank Martínez
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 <[hidden email]> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user


--
Frank D. Martínez M.


_______________________________________________
Inkscape-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user
Reply | Threaded
Open this post in threaded view
|

Re: General Purpose Python Scripting for Inkscape.

Frank Martínez
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):


Cheers,

Frank D. Martínez. (mnesarco)






On Tue, Mar 26, 2019 at 1:38 PM Frank Martínez <[hidden email]> 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 <[hidden email]> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user


--
Frank D. Martínez M.


--
Frank D. Martínez M.


_______________________________________________
Inkscape-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user
Reply | Threaded
Open this post in threaded view
|

Re: General Purpose Python Scripting for Inkscape.

doctormo
In reply to this post by Frank Martínez
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user
Reply | Threaded
Open this post in threaded view
|

Re: General Purpose Python Scripting for Inkscape.

Frank Martínez
Hi Martin, it sounds great!

El mar., 26 de mar. de 2019 2:43 p. m., <[hidden email]> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user


_______________________________________________
Inkscape-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user
Reply | Threaded
Open this post in threaded view
|

Re: General Purpose Python Scripting for Inkscape.

Andrew Kurn
In reply to this post by doctormo
Yes!

I wished I could do it several different times.

Andrew


On Tue 26 Mar 2019 15:42 -0400, [hidden email] 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/inkscape-user


_______________________________________________
Inkscape-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user
Reply | Threaded
Open this post in threaded view
|

Re: General Purpose Python Scripting for Inkscape.

Frank Martínez
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 <[hidden email]> wrote:
Yes!

I wished I could do it several different times.

Andrew


On Tue 26 Mar 2019 15:42 -0400, [hidden email] 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/inkscape-user


_______________________________________________
Inkscape-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user


--
Frank D. Martínez M.


_______________________________________________
Inkscape-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user
Reply | Threaded
Open this post in threaded view
|

Re: General Purpose Python Scripting for Inkscape.

doctormo
In reply to this post by Frank Martínez
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., <[hidden email]>
> 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
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/inkscape-user
>
> _______________________________________________
> Inkscape-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/inkscape-user



_______________________________________________
Inkscape-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user
Reply | Threaded
Open this post in threaded view
|

Re: General Purpose Python Scripting for Inkscape.

doctormo
In reply to this post by Frank Martínez
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user
Reply | Threaded
Open this post in threaded view
|

Re: General Purpose Python Scripting for Inkscape.

Frank Martínez
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 <[hidden email]> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user


--
Frank D. Martínez M.


_______________________________________________
Inkscape-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user
Reply | Threaded
Open this post in threaded view
|

Re: General Purpose Python Scripting for Inkscape.

doctormo
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:
>
> 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 <[hidden email]> 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
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/inkscape-user
>
>
> _______________________________________________
> Inkscape-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/inkscape-user



_______________________________________________
Inkscape-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user
Reply | Threaded
Open this post in threaded view
|

Re: General Purpose Python Scripting for Inkscape.

Steve Litt
In reply to this post by Frank Martínez
On Tue, 26 Mar 2019 13:38:58 -0500
Frank Martínez <[hidden email]> 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


_______________________________________________
Inkscape-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user
Reply | Threaded
Open this post in threaded view
|

Re: General Purpose Python Scripting for Inkscape.

Steve Litt
In reply to this post by doctormo
On Tue, 26 Mar 2019 15:42:52 -0400
[hidden email] 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


_______________________________________________
Inkscape-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user
Reply | Threaded
Open this post in threaded view
|

Re: General Purpose Python Scripting for Inkscape.

Andrew Kurn
On Thu 28 Mar 2019 18:29 -0400, Steve Litt wrote:

> On Tue, 26 Mar 2019 15:42:52 -0400
> [hidden email] 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-user
12