• Stars
    star
    646
  • Rank 67,138 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Star Trek LCARS interface for Raspberry Pi using Pygame

RaspberryPi LCARS Interface

Star Trek LCARS interface for Raspberry Pi using Pygame.

The code is an example of implementing a custom MovieOS-style interface for your RaspberryPi projects that include the RaspberryPi touch screen (e.g. home automation control panel). The LCARS assets can be replaced with assets from any other style of user interface (e.g. from games, cartoons, or TV series).

screenshot 1

(Click screenshot for a video)

Global Config

  • UI_PLACEMENT_MODE - if set to True, allows you to long-press any widget (except background items) and then drag them to any location. When you release the widget, it's new top and left co-ordinates are printed in the console, which you can use in your code to place the widget there.
  • DEV_MODE - if set to True, will show the mouse cursor and a close button, for example. The mouse cursor is useful during development (on a non-touch screen).
  • SOUND - if set to False, will disable all sounds and prevent errors if a sound device isn't present
  • PIN - Set authorization code. For now only numbers are supported.

Usage

  • The starting point for modifying this interface to your needs is the initial Screen that is loaded, which is ScreenAuthorize. The Screens are defined in the screens folder.
  • Screens extend the LcarsScreen class and define a setup() method, and optionally the handleEvents() and update() methods.
  • The setup() method initializes the widgets to display. See lcars_widgets.py for some of the implemented widgets.
  • The handleEvents() method is used to respond to clicks. If this method returns True, the event is "consumed", otherwise other widgets get a chance to act on the event.
  • The update() method is called once per frame, allowing the Screen to update how it is drawn. Code in here needs to be highly optimized. This method is called after the widgets are drawn, but there is a pre_update() method you can override to draw before the widgets get drawn.
  • The method loadScreen() can be called to open a new Screen. There is no backstack, so you will have to manage the Screen flows manually.
  • To use the SOUND config, you need to use ui.utils.sound.Sound instead of the normal pygame.mixer.Sound.

Installation

  • Download or Git clone this repository into a local folder
  • Run the setup.sh script to install the needed dependencies, OR if you have pip, run pip install -r requirements.txt

Launching

  • You can launch the interface from inside an X desktop session by opening a terminal and running python lcars.py from inside the app folder.
  • To launch the interface from the command line, run the run.sh script in the project root. Note that you will need to have xinit installed (sudo apt-get install xinit). While you can run it without X, the touch points will be mis-aligned, and so is not feasible.
  • You can launch the interface on bootup by adding the following to the /etc/rc.local file:
cd /home/pi/rpi_lcars/app
sudo -u pi xinit /usr/bin/python3 lcars.py

The above assumes you want to run the interface from the /home/pi/rpi_lcars folder as the pi user. To run as root, simply omit the sudo -u pi bit.

Notes

  • Although not implemented in the demo, an interpolator is provided to allow for animations. To see how this can be used, see the LcarsMoveToMouse widget, which smoothly follows screen touches/mouse clicks.
  • The applyColour() method is used to take an image asset of a uniform colour (e.g. white) and change its colour to any other colour. This is how buttons of various colours are created from one asset. However, currently this is a very simple implementation which results in aliasing artifacts, which is why the buttons look aliased. The advantage of this method is that it is trivial to use it to add highlighting of touches on buttons and keep the number of assets required to a minimum.
  • If you are using the Waveshare 5" or 7" touch screen (or similar), then you can use the sample boot/config.txt to get the screen running at the correct resolution, and install a user-space touch driver, like this one

Credits

More Repositories

1

Xtendroid

Xtendroid is a DSL (domain-specific language) for Android that greatly reduces boilerplate code while providing great tooling support
Xtend
242
star
2

WebApps

DEPRECATED ⛔️ Android app to provide sandboxed (private) browsing of webapps
Xtend
229
star
3

SherlockNavigationDrawer

Modification of the Android NavigationDrawer sample to use ActionbarSherlock so that we can use the NavigationDrawer on older devices
Java
127
star
4

NSA_b_gone

A Linux shell script to improve your privacy online
Shell
83
star
5

WebMediaShare

DEPRECATED ⛔️ A fork of WebApps to allow sharing media from websites for the purpose of casting/sharing/downloading
Xtend
68
star
6

BatteryFu

BatteryFu (pronounced Battery-Foo, like in Kung-Fu) is an Android app that extends battery life (and lowers data usage) by changing always-on mobile/wifi data to periodic sync (meaning it disables your mobile data and/or Wifi, then checks your accounts every X minutes).
Java
68
star
7

GoogleApps

DEPRECATED ⛔️ An Android app to sandbox Google websites from your default browser, for privacy
Java
44
star
8

pi-tracking-telescope

An optical tracking telescope using OpenCV, Raspberry Pi, Arduino, and 3D printed parts
Python
40
star
9

MakerDroid

3D modelling and printing Android app! It allows the user to draw a shape on the device and have it printed out on a 3D printer
Python
21
star
10

Sparkler

Sparkler is an attempt to bring developer-friendliness to Java web development by using Rails/Sinatra-style Java libraries/frameworks together with Xtend to provide syntactic sugar and other fun language features (like extension methods and lambdas).
Xtend
21
star
11

rpi_tablet_os

Customization of Raspberry Pi OS for tablet use
Shell
10
star
12

baasbox_admin

An HTML 5 web component that can be used to create admin tools for BaasBox documents
HTML
7
star
13

ScriptDroid

Mobile development is too hard, especially for new developers! This project is an experiment to see how much we can simplify it for new developers, based on some of the work done in QML. It is targetted at Android and uses BeanShell Script to demonstrate some of the ideas.
Java
6
star
14

XtendApp

A skeleton Xtend app with gradle and Android Studio integration
Xtend
5
star
15

DroidOrb

Extensible, open source Android accessory
Java
4
star
16

MxitRuby

A skeleton Mxit app written in Ruby. A good starting point for your own Ruby app.
Ruby
4
star
17

android-groovy-support

A support library to leverage Android development using Groovy
Groovy
4
star
18

micropub-to-markdown

IndieWeb scripts for publishing using micropub to a static-site generator like Pelican
PHP
4
star
19

Android101

Android source material from Android 101 training
Java
3
star
20

Economics

Simulations of economics concepts using Ruby
Ruby
3
star
21

vCardImporter

Simple Firefox OS app to import contacts exported from ownCloud in vCard 3.0 format
JavaScript
2
star
22

OPHW-EL-BlueWatch

OPHW BlueMote Watch
Java
2
star
23

AndroidIntro

Code and presentation for Android Intro talk
JavaScript
1
star
24

libgdx-utils

Collection of libgdx notes and utility classes
Xtend
1
star
25

Ruby101

Introductory course to Ruby
Ruby
1
star
26

jozijs-2020

Building web apps in plain JavaScript https://www.meetup.com/Jozi-JS/events/271620720/
JavaScript
1
star
27

aircore

An Arduino sketch to drive the tachometer of a Jeep using an ignition coil pickup from the engine.
C++
1
star
28

tobykurien.github.io

CSS
1
star
29

transference

Game entry for Global Game Jam 2014
Java
1
star
30

webapp_skeleton

A minimal web application skeleton using web components and a simple router.
JavaScript
1
star
31

JoziJug

Demo app for Jozi JUG
Java
1
star