Skip to main content

pydrawio: manage draw.io file

Project description

Pydrawio

Quick Start

~$ pip install pydrawio

Usage

MxGraphModel

        # get compressed string from Mxfile or Mxlibrary
        compressed = 'lJI9b8MgGIR/DWMlA1WaDl5i5WNIl2ZIOyLz1iDxJUJip7++ChCMoizdfA9nOO4F0U5PW8+c+LAcFCINn1pECMbNAhFy09ebXuJlkoOXPBpmeZC/EFGT2VlyOFWmYK0K0tWot8ZAHyrCvLdjbfmxqj7JsQEe5KFn6pEdJQ8iJiZvM92BHEQ6DS/eE9csGXPqk2DcjgXQNaKdtzakLz11oG71pNvPFkQ2ee2ZrwTzYMJ/foRud/naD+bTuOG4N99yp8lL3u3C1DleOwcP19SCt2fDgbcNoqtRyAAHx3poR88coisRtGoxoqvHSPddwQeYCsihtmA1BH9FpIlrZcjxVeDXrMZ76/hepyiNLzJhcbhD2bDuoRzzrBpENvMgkn1+sHT9BwAA//8BAAD//w=='
        mxgraphmodel = decompress(compressed)
        # processing mxgraphmodel
        mxgraphmodel.compress()

Mxlibrary

        # create Mxlibrary instance
        mxlibrary = Mxlibrary() # or Mxlibrary(Mxlibrary_file_contents)
        # make mxlibobject
        mxlibobj1 = mxlibrary.make_mxlibobject(mxgraphmodel, 'test_lib_1',  25, 25)
        mxlibobj2 = mxlibrary.make_mxlibobject(mxgraphmodel, 'test_lib_2',  25, 25)
        # set Mxlibobject
        mxlibrary.set_mxlibobject([ mxlibobj1, mxlibobj2 ])
        # write mxlibrary file
        mxlibrary.write(filepath)
        
        # get Mxlibobject
        mxlibobj = json.loads(mxlibrary.value)
        for mxlibobj in mxlibobjs:
            mxlibobj = Mxlibobject(**mxlibobj)

Mxfile

        mxfile = Mxfile() # or Mxfile(Mxfile_file_contents)
        # get MxGraphModel from Mxfile
        compressed = mxfile.diagram[0].value
        mxgraphmodel = decompress(compressed)

        # processing MxGraphModel

        # write mxfile file
        mxfile.write(filepath)

Project details


Download files

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

Source Distribution

pydrawio-1.1.0.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydrawio-1.1.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file pydrawio-1.1.0.tar.gz.

File metadata

  • Download URL: pydrawio-1.1.0.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for pydrawio-1.1.0.tar.gz
Algorithm Hash digest
SHA256 d3221339a99d1852f70ef5c1acfc60506df40e0d2618dbce64d63668152ba69a
MD5 b73d3abf58ba80e8f4926bbe6b052626
BLAKE2b-256 851457e56c312892da92bcd46ad2a4da9ef99d0866b8d95c3e2edee2bd769a21

See more details on using hashes here.

File details

Details for the file pydrawio-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pydrawio-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for pydrawio-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ba08fad2c819269619643be14300049f2e89a101537ea034df9e51ab09134f3
MD5 4b4c0fe9d593d4e6eda038b83d1bfde0
BLAKE2b-256 7dae661c201b8411cb0bf7c11dfc491094083590d5d68af1d35ab31c10bfaac2

See more details on using hashes here.

Supported by

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