Skip to main content

Gaphas is a GTK+ based diagramming widget

Project description

Gaphas

Build state Maintainability Test Coverage Docs build state Code style: black standard-readme compliant Gitter All Contributors

Gaphas is the diagramming widget library for Python.

Gaphas Demo

Gaphas is a library that provides the user interface component (widget) for drawing diagrams. Diagrams can be drawn to screen and then easily exported to a variety of formats, including SVG and PDF. Want to build an app with chart-like diagrams? Then Gaphas is for you! Use this library to build a tree, network, flowchart, or other diagrams.

This library is currently being used by Gaphor for UML drawing, RAFCON for state-machine based robot control, and ASCEND for solving mathematical models.

📑 Table of Contents

📜 Background

Gaphas was built to provide the foundational diagramming portions of Gaphor. Since Gaphor is built on GTK and Cairo, PyGObject provides access to the GUI toolkit and PyCairo to the 2D graphics library. However, there wasn't a project that abstracted these technologies to easily create a diagramming tool. Hence, Gaphas was created as a library to allow others to create a diagramming tool using GTK and Cairo.

Here is how it works:

  • Items (Canvas items) can be added to a Canvas.
  • The Canvas maintains the tree structure (parent-child relationships between items).
  • A constraint solver is used to maintain item constraints and inter-item constraints.
  • The item (and user) should not be bothered with things like bounding-box calculations.
  • Very modular--e.g., handle support could be swapped in and swapped out.
  • Rendering using Cairo.

The main portions of the library include:

  • canvas - The main canvas class (container for Items).
  • items - Objects placed on a Canvas.
  • solver - A constraint solver to define the layout and connection of items.
  • gtkview - A view to be used in GTK applications that interacts with users with tools.
  • painters - The workers used to paint items.
  • tools - Tools are used to handle user events (such as mouse movement and button presses).
  • aspects - Provides an intermediate step between tools and items.

Gaphas contains default implementations for Canvas and Items. There are protocols in place to allow you to make your own canvas.

💾 Install

To install Gaphas, simply use pip:

$ pip install gaphas

Use of a virtual environment is highly recommended.

Development

To setup a development environment with Linux:

$ sudo apt-get install -y python3-dev python3-gi python3-gi-cairo
    gir1.2-gtk-3.0 libgirepository1.0-dev libcairo2-dev
$ pip install poetry
$ poetry install

🔦 Usage

API docs and tutorials can be found on Read the Docs.

♥ Contributing

Thanks goes to these wonderful people (emoji key):

Arjan Molenaar
Arjan Molenaar

💻 🐛 📖 👀 💬 🔌
Dan Yeaw
Dan Yeaw

💻 ⚠️ 👀 🐛 💬 🚇 📖
wrobell
wrobell

💻 ⚠️ 👀
Jean-Luc Stevens
Jean-Luc Stevens

💻 🐛 📖
Franz Steinmetz
Franz Steinmetz

💻 🐛
Adrian Boguszewski
Adrian Boguszewski

💻
Rico Belder
Rico Belder

🐛 👀
Adam Boduch
Adam Boduch

🐛
Janet Jose
Janet Jose

📖

This project follows the all-contributors specification. Contributions of any kind are welcome!

  1. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug. There is a first-timers-only tag for issues that should be ideal for people who are not very familiar with the codebase yet.
  2. Fork the repository on GitHub to start making your changes to the master branch (or branch off of it).
  3. Write a test which shows that the bug was fixed or that the feature works as expected.
  4. Send a pull request and bug the maintainers until it gets merged and published. :smile:

See the contributing file!

© License

Copyright © Arjan Molenaar and Dan Yeaw

Licensed under the Apache License 2.0.

Summary: You can do what you like with Gaphas, as long as you include the required notices. This permissive license contains a patent license from the contributors of the code.

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

gaphas-3.2.0.tar.gz (67.8 kB view details)

Uploaded Source

Built Distribution

gaphas-3.2.0-py3-none-any.whl (79.5 kB view details)

Uploaded Python 3

File details

Details for the file gaphas-3.2.0.tar.gz.

File metadata

  • Download URL: gaphas-3.2.0.tar.gz
  • Upload date:
  • Size: 67.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.8.12 Linux/5.11.0-1020-azure

File hashes

Hashes for gaphas-3.2.0.tar.gz
Algorithm Hash digest
SHA256 789a1c7af7c18387a1d2b24d12eb5defacc277440d72ec4af278444943fa90a7
MD5 4974568744c1b65feb43d6ff6de0c44b
BLAKE2b-256 2b60d9fcde3d1d95b52133fb69aeb8a0ffdbfaef525ea5312cfcf73a75d4c6c0

See more details on using hashes here.

File details

Details for the file gaphas-3.2.0-py3-none-any.whl.

File metadata

  • Download URL: gaphas-3.2.0-py3-none-any.whl
  • Upload date:
  • Size: 79.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.8.12 Linux/5.11.0-1020-azure

File hashes

Hashes for gaphas-3.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a1b52bff05c92a3f60f6d0c9faa16a1fdd38b6d5be33325828c6704a49727fcf
MD5 67dd37636c84a235ad735134285a4e33
BLAKE2b-256 16a89ad78e1a10dda97b33ceaf0f2c8a4bd9599d437a4757d7916d0d48f356f4

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