Luma.Emulator

https://travis-ci.org/rm-hull/luma.emulator.svg?branch=master https://coveralls.io/repos/github/rm-hull/luma.emulator/badge.svg?branch=master https://img.shields.io/maintenance/yes/2017.svg?maxAge=2592000 https://img.shields.io/pypi/pyversions/luma.emulator.svg https://img.shields.io/pypi/v/luma.emulator.svg

Introduction

There are various display emulators available for running code against, for debugging and screen capture functionality:

  • The luma.emulator.device.capture device will persist a numbered PNG file to disk every time its display method is called.
  • The luma.emulator.device.gifanim device will record every image when its display method is called, and on program exit (or Ctrl-C), will assemble the images into an animated GIF.
  • The luma.emulator.device.pygame device uses the pygame library to render the displayed image to a pygame display surface.
  • The luma.emulator.device.asciiart device renders the displayed image to a terminal using ANSI color codes and varying ASCII characters to represent pixel density.

Check out the examples on how to use the luma.emulator devices.

Installation

Note

The library has been tested against Python 2.7 and 3.4+.

For Python3 installation, substitute the following in the instructions below.

  • pippip3,
  • pythonpython3,
  • python-devpython3-dev,
  • python-pippython3-pip.

Installing from PyPi

Install the latest version of the library directly from PyPI:

$ sudo apt install python-dev python-pip build-essential
$ sudo apt install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev
$ sudo pip install --upgrade --ignore-installed setuptools pip
$ sudo pip install --upgrade luma.emulator

API Documentation

luma.emulator.device

luma.emulator.render

Contributing

Pull requests (code changes / documentation / typos / feature requests / setup) are gladly accepted. If you are intending to introduce some large-scale changes, please get in touch first to make sure we’re on the same page: try to include a docstring for any new method or class, and keep method bodies small, readable and PEP8-compliant. Add tests and strive to keep the code coverage levels high.

GitHub

The source code is available to clone at: https://github.com/rm-hull/luma.emulator

Contributors

  • Thijs Triemstra (@thijstriemstra)
  • Christoph Handel (@fragfutter)
  • Boeeerb (@Boeeerb)
  • xes (@xes)
  • Roger Dahl (@rogerdahl)
  • Václav Šmilauer (@eudoxos)
  • Claus Bjerre (@bjerrep)

ChangeLog

Version Description Date
1.0.0
  • Stable version
  • Minor documentation and setup fixes
2017/11/03
0.2.5
  • Correct noop import
2017/09/06
0.2.4
  • Move show/hide/contrast methods into emulator
  • Add segment mapper
  • Refactor tests
2017/04/30
0.2.3
  • Added ASCII-art emulator
2017/04/15
0.1.3
  • Add contrast & show/hide functionality to pygame emulator
2017/03/02
0.1.2
  • Restrict exported Python symbols from luma.emulator.device
2017/03/02
0.1.1
  • Split out emulator functionality from rm-hull/luma.core
2017/02/17

The MIT License (MIT)

Copyright (c) 2017 Richard Hull & Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.