From bff7d8ca7b62f6f9508a1915d725755349c62a90 Mon Sep 17 00:00:00 2001 From: WhaX Date: Sun, 21 Jan 2024 18:13:31 +0100 Subject: [PATCH] feat(docker): docker image --- Dockerfile | 19 +++++++++++++++ README.md | 67 +++++++++++++++++++++++++++++++++++++---------------- compose.yml | 17 ++++++++++++++ tsr | 17 ++++++++++++++ 4 files changed, 100 insertions(+), 20 deletions(-) create mode 100644 Dockerfile create mode 100644 compose.yml create mode 100755 tsr diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..b24e6dcd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +ARG PYTHON_VERSION=3.12-alpine3.19 +FROM python:${PYTHON_VERSION} + +WORKDIR /app + +COPY . . + +RUN apk add --no-cache \ + build-base~=0.5 \ + font-roboto-mono~=3.000 \ + git~=2.43 \ + linux-headers~=6.5 \ + python3-tkinter~=3.11.6 \ + && pip3 install --no-cache-dir -r requirements.txt \ + && mv tsr /usr/local/bin \ + && chmod +x /usr/local/bin/tsr + +CMD ["tsr"] + diff --git a/README.md b/README.md index b32990ea..b3d0d597 100644 --- a/README.md +++ b/README.md @@ -5,18 +5,19 @@ This project is **not affiliated, associated, authorized, endorsed by, or in any way officially connected with Turing / XuanFang / Kipye brands**, or any of theirs subsidiaries, affiliates, manufacturers or sellers of their products. All product and company names are the registered trademarks of their original owners. This project is an open-source alternative software, NOT the original software provided for the smart screens. **Please do not open issues for USBMonitor.exe/ExtendScreen.exe or for the smart screens hardware here**. -* for Turing Smart Screen, use the official forum here: http://discuz.turzx.com/ + +* for Turing Smart Screen, use the official forum here: * for other smart screens, contact your reseller + --- ![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black) ![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white) ![macOS](https://img.shields.io/badge/mac%20os-000000?style=for-the-badge&logo=apple&logoColor=white) ![Raspberry Pi](https://img.shields.io/badge/Raspberry%20Pi-A22846?style=for-the-badge&logo=Raspberry%20Pi&logoColor=white) ![Python](https://img.shields.io/badge/Python-3.8/3.12-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54) [![Licence](https://img.shields.io/github/license/mathoudebine/turing-smart-screen-python?style=for-the-badge)](./LICENSE) - -A Python system monitor program and an abstraction library for **small IPS USB-C (UART) displays.** +A Python system monitor program and an abstraction library for **small IPS USB-C (UART) displays.** Supported operating systems : macOS, Windows, Linux (incl. Raspberry Pi), basically all OS that support Python 3.8+ -### Supported smart screens models: +### Supported smart screens models | ✅ Turing Smart Screen 3.5" | ✅ XuanFang 3.5" | ✅ Turing Smart Screen 5" | |------------------------------------------------------|---------------------------------------------------|---------------------------------------------| @@ -35,12 +36,12 @@ This project offers an abstraction layer to manage all of these products in a un If you haven't received your screen yet but want to start developing your theme now, you can use the [**"simulated LCD" mode!**](https://github.com/mathoudebine/turing-smart-screen-python/wiki/Simulated-display) -### Not (yet) supported / not tested smart screen models: +### Not (yet) supported / not tested smart screen models | ❔ _Turing Smart Screen 8.8"_ | ❔ _Turing Smart Screen 2.1"_ | ❌ _[(Fuldho?) 3.5" IPS Screen](https://aliexpress.com/item/1005005632018367.html)_ | |--------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | | | | -| Very similar protocol than the 5". [Support planned in a future version.](https://github.com/mathoudebine/turing-smart-screen-python/issues/264) | Very similar protocol than the 5". [Support planned in a future version.](https://github.com/mathoudebine/turing-smart-screen-python/issues/264) | Managed with [proprietary Windows software `SmartMonitor.exe`](https://smartdisplay.lanzouo.com/b04jvavkb). Cannot be supported by this project: [see here](https://github.com/mathoudebine/turing-smart-screen-python/discussions/298). Use alternative library https://github.com/braewoods/hidss | +| Very similar protocol than the 5". [Support planned in a future version.](https://github.com/mathoudebine/turing-smart-screen-python/issues/264) | Very similar protocol than the 5". [Support planned in a future version.](https://github.com/mathoudebine/turing-smart-screen-python/issues/264) | Managed with [proprietary Windows software `SmartMonitor.exe`](https://smartdisplay.lanzouo.com/b04jvavkb). Cannot be supported by this project: [see here](https://github.com/mathoudebine/turing-smart-screen-python/discussions/298). Use alternative library | | ❔ _Waveshare [2.1inch](https://www.waveshare.com/wiki/2.1inch-USB-Monitor) / [2.8inch](https://www.waveshare.com/wiki/2.8inch-USB-Monitor) / [5inch](https://www.waveshare.com/wiki/5inch-USB-Monitor) / [7inch](https://www.waveshare.com/wiki/7inch-USB-Monitor) USB-Monitor_ | ❔ _[GUITION Smart screen](https://aliexpress.com/item/1005006169962183.html)_ | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------| @@ -57,6 +58,7 @@ If you haven't received your screen yet but want to start developing your theme ### [> Follow instructions on the wiki to configure and start this project.](https://github.com/mathoudebine/turing-smart-screen-python/wiki) There are 2 possible uses of this project Python code: + * **[as a System Monitor](#system-monitor)**, a standalone program working with themes to display your computer HW info and custom data in an elegant way. [Check if your hardware is supported.](https://github.com/mathoudebine/turing-smart-screen-python/wiki/System-monitor-:-hardware-support) * **[integrated in your project](#control-the-display-from-your-python-projects)**, to fully control the display from your own Python code. @@ -65,7 +67,9 @@ There are 2 possible uses of this project Python code: This project is mainly a complete standalone program to use your screen as a system monitor, like the original vendor app. Some themes are already included for a quick start! + ### [> Configure and start system monitor](https://github.com/mathoudebine/turing-smart-screen-python/wiki/System-monitor-:-how-to-start) + * Fully functional multi-OS code base (operates out of the box, tested on Windows, Linux & MacOS). @@ -78,44 +82,67 @@ Some themes are already included for a quick start! * Tray icon with Exit option, useful when the program is running in background. ### [> List and preview of included themes](res/themes/themes.md) + ... [view full list](res/themes/themes.md) + ### [> Themes creation/edition (using theme editor)](https://github.com/mathoudebine/turing-smart-screen-python/wiki/System-monitor-:-themes) + ### [> Themes shared by the community](https://github.com/mathoudebine/turing-smart-screen-python/discussions/categories/themes) + and more... Share yours! ## Control the display from your Python projects If you don't want to use your screen for system monitoring, you can just use this project as a module from any Python code to do some simple operations on the display: -- **Display custom picture** -- **Display text** -- **Display horizontal / radial progress bar** -- **Screen rotation** -- Clear the screen (blank) -- Turn the screen on/off -- Display soft reset -- Set brightness -- Set backplate RGB LEDs color (on supported hardware rev.) + +* **Display custom picture** +* **Display text** +* **Display horizontal / radial progress bar** +* **Screen rotation** +* Clear the screen (blank) +* Turn the screen on/off +* Display soft reset +* Set brightness +* Set backplate RGB LEDs color (on supported hardware rev.) This project will act as an abstraction library to handle specific protocols and capabilities of each supported smart screen models in a transparent way for the user. Check `simple-program.py` as an example. ### [> Control the display from your code](https://github.com/mathoudebine/turing-smart-screen-python/wiki/Control-screen-from-your-own-code) +## Run with docker + +### Start container using docker compose + +```sh +docker compose up -d +``` + +### Run configuration script + +```sh +docker exec -it tsr tsr configure +``` + +Then restart your container + +```sh +docker compose restart +``` + ## Troubleshooting + If you have trouble running the program as described in the wiki, please check [open/closed issues](https://github.com/mathoudebine/turing-smart-screen-python/issues) & [the wiki Troubleshooting page](https://github.com/mathoudebine/turing-smart-screen-python/wiki/Troubleshooting) -## They're talking about it! +## They're talking about it * [Hackaday - Cheap LCD Uses USB Serial](https://hackaday.com/2023/09/11/cheap-lcd-uses-usb-serial/) - * [CNX Software - Turing Smart Screen – A low-cost 3.5-inch USB Type-C information display](https://www.cnx-software.com/2022/04/29/turing-smart-screen-a-low-cost-3-5-inch-usb-type-c-information-display/) - -* [Phazer Tech - Turing Smart Screen Python ](https://phazertech.com/tutorials/turing-smart-screen.html) +* [Phazer Tech - Turing Smart Screen Python](https://phazertech.com/tutorials/turing-smart-screen.html) ## Star History [![Star History Chart](https://api.star-history.com/svg?repos=mathoudebine/turing-smart-screen-python&type=Date)](https://star-history.com/#mathoudebine/turing-smart-screen-python&Date) - diff --git a/compose.yml b/compose.yml new file mode 100644 index 00000000..5f6f1ff6 --- /dev/null +++ b/compose.yml @@ -0,0 +1,17 @@ +version: "3.8" + +services: + app: + build: + context: . + container_name: ${APP_NAME:-tsr} + tty: true + environment: + - DISPLAY=${DISPLAY} + network_mode: host + volumes: + - $HOME/.Xauthority:/root/.Xauthority:rw + - ./config.yaml:/app/config.yaml + devices: + - /dev/ttyACM0 + restart: unless-stopped diff --git a/tsr b/tsr new file mode 100755 index 00000000..895c041c --- /dev/null +++ b/tsr @@ -0,0 +1,17 @@ +#!/bin/sh + +case "$1" in + "simple-program") + python3 /app/configure.py + ;; + "configure") + python3 /app/configure.py + ;; + "theme-editor") + python3 /app/theme-editor.py + ;; + *) + python3 /app/main.py + ;; +esac +