MerrimanInd / drawpyo

A Python library for programmatically generating Draw.io charts.
https://pypi.org/project/drawpyo/
MIT License
222 stars 15 forks source link

Support Draw.io's XML based library file structure #26

Open MerrimanInd opened 6 months ago

MerrimanInd commented 6 months ago

The Draw.io app supports importing and exporting from an XML file format. This should be supported.

Also, if the base libraries that ship with the Draw.io app are saved in this format then this could supplant the TOML defs for the built in libraries.

tmjo commented 1 week ago

Hi, just started using drawpyo and really like what I've seen so far. Great work!

The feature you suggest here would be really helpful since I've already got several custom libraries from before that I would like to continue using with drawpyo. Is there any manual workaround that you are aware to achieve the same?

MerrimanInd commented 1 day ago

Hey @tmjo, thanks! I won't get a chance to really look into this for a few weeks but for an interim solution you can either recreate your libraries as a TOML (docs at the bottom of this page) or style your objects by copying the style string in Draw.io (halfway down this page under 'Generating from a style string'). To make this easier you can also pass in the template_object arg to the init function when you create a new object and it will copy the styling.

Neither might be ideal right now but I'm traveling so I won't be able to do any meaningful development on parsing the XML libraries. But I don't see any blockers to implementing that feature, it'll just take a bit of time.