GithubHelp home page GithubHelp logo

rpi_lcars's Introduction

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

rpi_lcars's People

Contributors

bakercp avatar jdat avatar malmarpadecain avatar mattfletcher avatar roguepullrequest avatar skyrmey avatar statictank avatar tobykurien avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rpi_lcars's Issues

Buttons not working on main screen

After the change from authorize to main, the buttons no longer work. I tracked it down to turning off DEV_MODE, which sets pygame.mouse.set_visible(False).

Not sure why, but that is causing my touch screen to loose the button somehow, though it makes the sound as if I touched the screen.

I was able to resolve it by changing the set_visible(False) instead to this, which makes the cursor invisible.

pygame.mouse.set_cursor((8,8),(0,0),(0,0,0,0,0,0,0,0),(0,0,0,0,0,0,0,0))

Running on NON RPi hardware..

Hello,
Thank you for this brilliant project!

I have been working to get this running on an Ubuntu Server build with no default gui.. I have tried using Snakeware OS as the basis for my project but that failed to boot on my older hardware..

anyway, I have managed to bypass the RPi elements and have the main app running on my Toshiba Satellite C855D..
I have found that as per my comment on closed issue #32, xorg needs to be run with root privlages..

I have also found that changing the resolution in the config.py file from the default 800x480, to the included widescreen resloution of 1366x768, does not make the LCARS expand to fill the screen, instead it moves the same 800x480 window to the top left of the screen... The native resolution of my laptop screen is 1366x768 so I thought it would simply work lol..

Also the mouse fails to appear when using xint (or run.sh) however when using the startx mouse shows up with no problem..

I will continue working on these issues as i wish to make a fully working LCARS distro with voice control and i would love to use your rpi_lcars as the base!

python-pil package not available in default repositories

In setup.sh you install the python-pil package.
On a vanilla and up-to-date RPi installation this package doesn't exist. Is there a custom repository that needs to be added?
I tried using the python-imaging package in its place, but that doesn't work (image.tobytes() does not exist).
Do we need the regular Pything Imaging Library, or Pillow perhaps?
Cheers,
Justin

Can't get this thing working

Sorry but I just can't figure this out, I'm stumped
from what I understand I should just clone the repository to /home/pi/rpi_lcars
then open a terminal and move to /home/pi/rpi_lcars/app and type python lcars.py i get:

Traceback (most recent call last):
File "lcars.py", line 1, in
from screens.authorize import ScreenAuthorize
File "/home/pi/rpi_lcars/app/screens/authorize.py", line 6, in
from ui.widgets.gifimage import LcarsGifImage
File "/home/pi/rpi_lcars/app/ui/widgets/gifimage.py", line 1, in
from ui.utils.gif_image import GIFImage
File "/home/pi/rpi_lcars/app/ui/utils/gif_image.py", line 3, in
from PIL import Image
ImportError: No module named PIL

I have a pi2, I'm also using a 30 in hdmi monitor if that makes a difference

Trying to introduce screen blanking

I want to modify the first screen authorize.py ( With the spinning logo ) so that after a period of time if no event is registered the screen goes blank ( turn off all sprites ) but continues to look for a MOUSEBUTTONDOWN / MOUSEBUTTONUP to return to normal.

I thought that this would just be a matter of a simple loop , and say after X many times set inside of authorize.py handleEvents :

for sprite in self.layer1: sprite.visible = False
for sprite in self.layer2: sprite.visible = False

So far I have not been able to make this work.

The normal Xwindows screensaver ( via openbox ) does not work because the loop that constantly redraws the screen defeats it , and it just flashes.

I'm thinking either a loop to turn off both sprties after X many cycles, or create an all black sprite that is visible ( blanking out everything ) after X many cycles.

I'm a reasonable n00b to Python , so please forgive any blindingly obvious answers I might have overlooked.

Thanks ,

Autostarte

how can i make the lcars so that it autostart. i tryed many ways but it is not working

Disable Sounds

I love the work you have done here. Admittedly I am very inexperienced when it comes to any sort of programming. I just sorta jump into it, but I can follow directions very slowly figure things out.

My questions is: How can I disable lcars from using or configuring any sound settings. I currently have my pi setup with an IQaudIODAC sound card hat which I use to Airplay music from my phone to my pi. When I execute the script to run lcars, my music no longer plays through my speakers (no sounds play that are supposed to occur when pushing buttons in lcars but that is a much smaller issue to me). If they both played their sounds accordingly that would be super, but I imagine it would take a lot more tweaking to get that to happen then to just prevent lcars from overriding the airplay program that I have running.

Okay...small edit to my question.

I figured out how to change the UI setting so now I am getting the LCARS sound effects as intended through my speakers now via my IQaudIODAC+ .
But my music will still not play when LCARS is running.

Using Variable from another script

I apologize if this is easy, I am new to python. I want to trigger an handler event on the main screen based on a variable from another script. What would be the best way to go about this?

Thanks!

3.5 tft screen

I'm trying to setup for a 3.5" touchscreen for raspberry pi 3

# global config
UI_PLACEMENT_MODE = True
RESOLUTION = (480, 320)
# RESOLUTION = (1366, 768)
FPS = 60
DEV_MODE = True
SOUND = True

But the app is not resized and I'm unable to see the whole window.

Nothing, blank screen

When I run sudo python3 lcars.py,

I get nothing, just a black screen on the display.

No errors in the console (I'm ssh'd in) any ideas?

On cancel (ctrl + c) I get the following

Traceback (most recent call last):
  File "lcars.py", line 11, in <module>
    ui.tick()
  File "/home/pi/Desktop/LCARS_Python/rpi_lcars/app/ui/ui.py", line 66, in tick
    self.update()
  File "/home/pi/Desktop/LCARS_Python/rpi_lcars/app/ui/ui.py", line 37, in update
    pygame.display.update()

Thanks.

Screensaver - LCD Burnin

I'm worried about LCD screen burn in. Is there a way, or what can be done to "shut off" the screen?

I have lcars running as a service on RPI startup, but the lcar screen runs forever.

LCARS WITH Home Assistant

Hey. Just found this prohject and would like to know ifyou got it running with home-assistant and IF .. HOW:) maybe u might help me to set this up because your project is awesome!

Fullscreen

When I launch it within Raspbian it launches in a window. How can I make it launch fullscreen?

Sorry ... total noob here but I did get it installed and running ... baby steps!

#40 not solved

Youl cloesed in for mention a nother issu but i tryed the solution but it still not working
#40

Lights etc.

How can i add like the lights to controll light withe the lcars. And is ther a red alert?

start erro

Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "lcars.py", line 2, in
from ui.ui import UserInterface
File "/home/pi/rpi_lcars-master/app/ui/ui.py", line 4, in
from ui.utils import sound
ImportError: No module named utils

Will not fill 7" touchscreen

Using a Pi 4 and a 7" touchscreen with a resolution of 1024x600

No matter what I do the lcars will not fill the screen. It is always too small and in the upper left corner.

I have tried editing /boot/config.txt , /app/config.py , /ui/ui.py etc. None of it seems to make any difference. I'm not sure what I'm missing but it will never be centered and fill the screen.

Any help would be greatly appreciated.

This is more a question than an issue

In which file do you configure the touch buttons? When I run rpi_lcars I get to the "Authorization Required" screen, which I touch and then see eight buttons appear at the bottom, none of which do anything. Also, I still see "Authorization Required". So I am at a loss on what to do at this point.

Bill Richards
RPi3 w/Touch Screen

10.1 inch

Is it possible to run the script on a 10.1 inch Touchscreen ?

Buttons and Hidden Buttons

I discovered a minor issue. This occurs if you have two buttons that exist in the same space. In my case one button was hidden and another was visible. When you click/tap a visible button it will act normal. However if you hide the visible button and show the hidden button. The previously hidden button will be white as though it was pressed but never released. I was able to fix this by adding "and self.visible == True" to two if statements under the def handleEvent in the lcars_widget.py code.

pygame.error: Surface has no palette

Hi,
Firstly thanks for creating the LCARS interface. Its a great piece of software!
I've had the software working for some time on my raspberry pi 4 with no issues. However recently i've come to fire it up and get the following errors when its trying to launch the ScreenAuthorize. Unable to set the palette. I've not changed any of the original software so i'm thinking i've updated something in the background and its broken it. If anyone has any ideas how to fix that would be great :) Cheers

File "/home/pi/Documents/Python_Projects/rpi_lcars-master_original/app/ui/utils/gif_image.py", line 95, in get_frames
pi.set_palette(palette)
pygame.error: Surface has no palette

pygame.error: File is not a Windows BMP file

Raspberry Pi 4 running Raspbian Buster Slim using the Adafruit 7" Touchscreen display.

Using ./run.sh gets me to this error message:

Traceback (most recent call last):
  File "lcars.py", line 8, in <module>
    config.SOUND)
  File "/home/pi/rpi_lcars/app/ui/ui.py", line 30, in __init__
    self.screen.setup(self.all_sprites)
  File "/home/pi/rpi_lcars/app/screens/authorize.py", line 16, in setup
    all_sprites.add(LcarsBackgroundImage("assets/lcars_screen_2.png"),
  File "/home/pi/rpi_lcars/app/ui/widgets/background.py", line 14, in __init__
    self.image = pygame.image.load(image).convert()
pygame.error: File is not a Windows BMP file

I've verified that Pillow is installed and all needed libraries are installed. Any assistance would be appreciated.

Install issue: missing module?

On pi3 with latest updates and freashest git repo.
After running ´setup.sh´ move over into the ´app´ dir and run ´python lcars.py´

´´´
...
from ui.utils import sound
ImportError: no module named utils
´´´

Been poking around but cant see where exactly what is missing to be installed.

lcarscom.net now a webshop

It seems the domain lcarscom.net has been bought up and is now running an online shop. It does not seem to have anything more to do with LCARS. I suggest removing the link.

No module named utils

I get this error when i try to run the program:

Traceback (most recent call last):
File "lcars.py", line 2, in
from ui.ui import UserInterface
File "/home/praveetminash/rpi_lcars-master/app/ui/ui.py", line 4, in
from ui.utils import sound
ImportError: No module named utils

Sliders, Graphs, configuration management, integrations, and customizations

Hi there.

First: This is simply badass. Thank you for your work.

Second: I don't see a slider implementation. I figure that's a piece that is sorta crucial to the interface and you probably have an implementation in mind.

Third: I'd like to see an example of how you'd like integrations submitted. There are plenty of different things... dynamic graphs from monitoring systems, camera feeds, light controls, terminal data, actual weather systems, traffic maps, heat maps, environmental charts, multimedia controls, etc.

not sure how these things would best be integrated such that custom configuration could be deployed alongside the app, and integrations people write could be easily utilized so as to not re-invent the wheel.

Is screenblanking a thing you want to manage?

Would a chef cookbook to deploy this be helpful? it seems that having many LCARS terminals around a location would be cool, however manually configuring everything would likely become painful quickly.

Start error

i always become the erro massege
(EE)
Fatal server error:
(EE) Server is already active for display 0
If this server is no longer running, remove /tmp/.X0-lock
and start again.
(EE)
(EE)
Please consult the The X.Org Foundation support
at http://wiki.x.org
for help.
(EE)

when i starte the lcars

traceback issue

pi@raspberrypi:~/rpi_lcars-master/app $ sudo python lcars.py
Traceback (most recent call last):
File "lcars.py", line 2, in
from ui.ui import UserInterface
File "/home/pi/rpi_lcars-master/app/ui/ui.py", line 4, in
from ui.utils import sound
ImportError: No module named utils
__

For some reason I can't get this to work on my raspberry pi 3B plus

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.