Skip to main content

Simple interface to edit drawio files

Project description

Drawioedit is a simple interface to edit drawio files. It uses N2G functions and adds some features.

Features

Drawioedit has following features:
  • load embedded drawio from png files

  • set styles of shapes and links

  • all of the N2G drawio features

Installation

Install drawioedit by running:

pip3 install drawioedit

Examples

import sys
sys.path.insert(0, "../")
from drawioedit import DrawIOEdit
import os
red='#ff0000'
base_path=os.path.dirname(os.path.realpath(__file__))
drawing=DrawIOEdit(file_path=f'{base_path}/input.drawio.svg')
drawing.set_shape_color('DC1-SW1',red)
drawing.set_shape_color('bbnew-1',red)
drawing.set_shape_color('iperf-1',red)
drawing.set_shape_color('iperf-3',red)

for link in drawing.find_link_between_nodes('DC1-SW1','bbnew-1'):
    link.attrib['style']=drawing._edit_style(link.attrib['style'],'strokeColor',red)

for link in drawing.find_link_between_nodes('Backbone-1','BB-new'):
    link.attrib['style']=drawing._edit_style(link.attrib['style'],'strokeColor',red)

print(f'saving {base_path}/output.drawio.png')
drawing.save(f'{base_path}/output.drawio.png')
print(f'saving {base_path}/output.drawio.svg')
drawing.save(f'{base_path}/output.drawio.svg')
print(f'saving {base_path}/output.drawio.jpg')
drawing.save(f'{base_path}/output.drawio.jpg')
print(f'saving {base_path}/output.drawio')
drawing.save(f'{base_path}/output.drawio')

Contribute

Roadmap

Selected Roadmap items:
  • add class documentation

For documentation please refer to https://drawioedit.readthedocs.io/en/latest/

License

This project is licensed under the Apache License Version 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

drawioedit-0.3.6-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file drawioedit-0.3.6-py3-none-any.whl.

File metadata

  • Download URL: drawioedit-0.3.6-py3-none-any.whl
  • Upload date:
  • Size: 19.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/54.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5

File hashes

Hashes for drawioedit-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 1d26f28d76d98fe3df929882263dadb4c1c6014370ff5e282b3d441a976a5c3c
MD5 86164f8fe5494032b20435cb2223c1a3
BLAKE2b-256 f6688160a64293671b56a5e82832f877204da713c94e7c0bbbac80f04ff80eb7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page