Skip to main content

HomLab Editor

HomLab Editor is a pygame-based graphical editor for HomLab JSON diagrams, with a Pillow-based static renderer for producing image files without opening the editor window. It edits genus handles, border handles, ordinary nodes, edges, crossings, and the saved view parameters directly in the JSON file.

Chinese manual: docs/user-guide.zh-CN.md

Features

  • Creates a default HomLab JSON file when the target path does not exist.
  • Adds, drags, deletes, and connects ordinary nodes in the graphical editor.
  • Temporarily highlights ordinary nodes with more than two incident edges in red.
  • Connects ordinary nodes to genus handles or border handles.
  • Stores optional per-edge RGB colors while keeping older JSON files compatible.
  • Adjusts genus count, view scale, window size, view center, and border spacing.
  • Detects crossings between non-adjacent line segments and lets the user swap the crossing order by clicking a crossing.
  • Supports read-only mode and a read-only crossing-pick mode for integration workflows.
  • Saves through a soft file lock next to the JSON file.
  • Provides command line entry points and a Python API.
  • Renders JSON diagrams to static images with Pillow through homlab-render.

Installation

Python 3.9 or newer is required.

For local development:

python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e .

For a normal package installation:

python -m pip install homlab-editor

Run The Editor

Open or create a HomLab JSON file:

homlab-editor data/example.json

The module entry point is equivalent:

python -m homlab_editor data/example.json

Open without allowing topology edits:

homlab-editor data/example.json --readonly

Open in read-only crossing-pick mode:

homlab-editor data/example.json --pick-crossing data/selected-crossing.json

In crossing-pick mode the user can still move and scale the view, but cannot edit nodes, edges, genus count, border spacing, or crossing order. Clicking a crossing closes the editor and writes the selected edge pair and crossing coordinates to the output JSON file.

Static Rendering

Render a HomLab JSON file to an image without opening a pygame window:

homlab-render data/example.json data/example.png --size 1000

--size sets the square output width and height in pixels. Static rendering auto-fits the drawn content by default and does not draw the editor toolbar.

Use the saved JSON view instead of auto-fitting:

homlab-render data/example.json data/example.png --size 1000 --use-json-view

Basic Editing

Left-click empty canvas space to create a node. Hold and drag a node to move it. Light-click a node or a handle to enter drawing mode. In drawing mode, click empty space to create and connect another node while staying in drawing mode; click an existing node or handle to connect and return to free mode.

Right-click an ordinary node to delete it. Right-click a visible edge to delete it. Left-click an ordinary node-to-node edge to split it by inserting a node at the cursor. Click a crossing to swap which of the two crossing edges is drawn on top.

Use Edge_Color, then click an edge to enter RGB values. Use All_Color to apply one RGB color to every existing edge. Edges without a saved color field use the default black edge color. Special-edge red highlighting still takes display priority over saved edge colors.

Python API

from homlab_editor import HomologyLabEditor

editor = HomologyLabEditor("data/example.json", readonly=True)
editor.mainloop()

Static image rendering API:

from homlab_editor.static_image import render_homlab_file

render_homlab_file("data/example.json", "data/example.png", size=1000)

Documentation

Build

Build the source distribution and wheel:

python -m pip install build
python -m build

Build artifacts are written to dist/.

Metadata

Release files for homlab-editor 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for homlab-editor 0.1.9
File Size Uploaded
homlab_editor-0.1.9.tar.gz 34.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for homlab-editor 0.1.9
File Interpreter ABI Platform
homlab_editor-0.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 72.8 kB

Release files / homlab_editor-0.1.9.tar.gz

Download URL homlab_editor-0.1.9.tar.gz
Size 34.7 kB
Tags Source
SHA-256 checksum
How to use checksums
206e2d3aee1b552a15f24af12a7e40e9956f7e9553897c6484fd7a0df94edc66
BLAKE2b-256 checksum
How to use checksums
ca94e225e71807c77e38e163ca59f92e70fb4cb73a0bbf22f02d083a4a4b65b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.11.15 Windows/10

Release files / homlab_editor-0.1.9-py3-none-any.whl

Download URL homlab_editor-0.1.9-py3-none-any.whl
Size 38.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2db5deb39cbd7458ba1443656739d38b96c753f6879c6f5cc4136e76090dc7ba
BLAKE2b-256 checksum
How to use checksums
5e6c43252b9d59ccad59b5ffdd71d03d4bb40bf07e9573c5dbfa74d37058eead
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.11.15 Windows/10

Release history Release notifications | RSS feed

This release

0.1.9 This release

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page