Console Drawing Tool

The MIT License (MIT)

Copyright (c) 2016 Stephan Kristyn (meshfields.de)

http://meshfields.de/mit-license/

GitHub

https://github.com/nottinhill/console-paint

Console Drawing Tool README

With this tool you can draw on console in Linux. It uses Python.

Versions

  • v0.1: First fully working version

Libraries

unittest: (for TDD) sys: (basic python interpreter methods) regex: (for user input sanitation)

Usage

You can draw lines, rectangles and use bucket fills after you declared a canvas.

Start: ./main.py

Tests: ./test.py

Development: methods.py and helpers.py

Screenshot

.....................
.ooooooooooooooooooo.
.ooooooooooooooooooo.
.ooooooooooooooooooo.
.oooxxxxxxxxxxxooooo.
.oooxxxxxxxxxxxxxxxxx
.oooxx        x-----.
.oooxx        x-----.
.oooxx        x-----.
.oooxx        x-----.
.oooxx        x-----.
.oooxx        x-----.
.oooxx        x-----.
.oooxx        x-----.
.oooxxxxxxxxxxx-----.
.oooox--------------.
.ooooxxxxxxxxxxxxxxxx
.ooooooooooooooooooo.
.ooooooooooooooooooo.
.ooooooooooooooooooo.
.....................
[Line] [Canvas] [Rectangle] [Bucketfill] [Quit]

Development

Testing

This is what you want to see:

Unit Tests

> Should Get Color Of Coordinates
> Should add reduntant Items to pixels and uniquify
> Should Set Color for a specific Coordinate
> Should add reduntant Items to pixels and uniquify
> Should get colored Canvas
> Should get colored Rectangle
> Should colorise the Coordinates
> Should get Coordinates of Line

8 Tests passed.

And in methods.py uncomment #testDrawFourNeighbour() and #testPlotPixels() and run ./methods.py to run these two tests.

Design-Decisions and Trade-Offs

  • Decided against nCurses or gnuPlot because of requirement to not use a library
  • Emphasised on self-explanatory Code and helpful UX/UI
  • DRY is not fully followed, since there wasn't enough time. The introduced technical debt should be managed soon.
  • 2 remaining tests in methods.py

ToDo's:

  • Re-Write as Class for cleaner testing
  • Then move 2 remaining Test to test.py
  • Modularise further

Questions and Feedback to stephan@meshfields.de