freehand drawing tool in Python, PyQt/PySide, Qt
Python
Latest commit 5b98c6a Apr 28, 2016 @bootchk Merge pull request #2 from kalemas/master
PySide support
Permalink
Failed to load latest commit information.
dist Production ready: eliminate print statements. Aug 15, 2013
freehandTool PySide support Apr 27, 2016
.gitignore Use logging in generators instead of print stmts. Nov 11, 2013
.project Move freehandTool from view to scene to simplify. Feb 17, 2013
.pydevproject Eliminate import __future__, logging, traceback unless debugging. Sep 18, 2014
CHANGELOG Eliminate import __future__, logging, traceback unless debugging. Sep 18, 2014
README Production ready: eliminate print statements. Aug 15, 2013
__init__.py Refactor PointerTrackGhost to separate file. Feb 16, 2013
alternatePaintingQGPI.py Revamp detecting pauses and forcing (flushing without closing.) Nov 15, 2013
freehandApp.py PySide support Apr 27, 2016
setup.py

README

                   -------------------------
                   freehand drawing tool
                    
                   Copyright 2012 L. Konneker
                   -------------------------

About
=====

A freehand drawing tool.
Where a tool is a user interface object, something a user uses.
A freehand drawing tool is a component of a vector graphics drawing app.

Input: pointer device (e.g. mouse) events, from the app
Output: graphic vector path (lines and splines) which the app (via a GUI toolkit) renders.

Includes a rudimentary GUI app for testing (draw with LMB, distort with key or Ctl-key)

Written in pure Python.
Emphasis on domain objects and class/responsibility/collaboration documentation.

Tags:
- freehand drawing.
- computational geometry.
- incremental (dynamic) line tracing.
- Python coroutines.
- pipe of filters.
- GUI toolkit Qt.

References:
- Derived from potrace by Peter Selinger.
- Object model somewhat similar to Shapely/GEOS

See much more technical discussion in the code.


Versions
========

See CHANGELOG.


Serialize/Deserialize
======================

The output SegmentString, a QGraphicsPathItem, does not pickle.
But QPainterPath implements << for serializing, and it's not hard to do (it's not in this package.)

Cuspness is not currently serializable/deserializable, only exists just after SegmentString creation.


Directory structure and distribution
====================================
The top directory freehandTool includes a demo app, freehandApp.py.
It also include other distribution artifacts e.g. setup.py.

The directory freehandTool.freehandTool is the main Python package of the tool.
In that package, freehand.py is the main program for the tool.
Also in the package are pointerEvent.py and ghostLine, glue between the tool and the app.

The directory freehandTool.freehandTool.generator is a Python package that the tool calls (the low-level implementation.)

The Python distribution (a zipped archive) includes only the package freehandTool.freehandTool and subpackages,
but not the demo app.


The demo app
============

Draw with the mouse left button down.
Any key modifies an arbitrary control point (the second one?)
A key with control key also down modifies said control point while maintaining cuspness.

A real app would have an alternate user interface for editing (dragging?) control points.


Installing
==========

If you clone the git repository, you can change directory to the project directory and simply execute freehandApp.py.

It is not useful to install as a Python package in the standard place, 
unless you have written your own app that uses the freehand tool.  
In that case, the setup.py scripts are in the project.
You should produce a distribution archive (>python setup.py sdist),
copy and upack the archive somewhere else,
cd to that directory,
and install it (>python setup.py install).
(The archive in the repository at dist/freehandTool-0.1.tar.gz
is only the tool and not the demo app,
and the archive may not be up to date.)