Skip to content

Commit a8be8b3

Browse files
Add MissionCenter theme with Linux support
1 parent 0581cb3 commit a8be8b3

6 files changed

Lines changed: 517 additions & 0 deletions

File tree

LINUX-INSTALL.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Linux Installation Instructions
2+
3+
## Method 1: Build from Source (Recommended)
4+
5+
### Ubuntu/Debian:
6+
```bash
7+
# Clone repository
8+
git clone https://github.com/mathoudebine/turing-smart-screen-python.git
9+
cd turing-smart-screen-python
10+
11+
# Install system dependencies
12+
sudo apt update
13+
sudo apt install python3 python3-pip python3-venv
14+
15+
# Build
16+
chmod +x build-linux.sh
17+
./build-linux.sh
18+
19+
# Run
20+
cd dist/turing-system-monitor
21+
./main
22+
```
23+
24+
## Method 2: Run from Source (No Build)
25+
26+
```bash
27+
# Setup virtual environment
28+
python3 -m venv venv
29+
source venv/bin/activate
30+
pip install -r requirements.txt
31+
32+
# Run
33+
python3 main.py
34+
```
35+
36+
## Auto-start with systemd
37+
38+
Create service file:
39+
```bash
40+
sudo nano /etc/systemd/system/turing-screen.service
41+
```
42+
43+
Content:
44+
```ini
45+
[Unit]
46+
Description=Turing Smart Screen Monitor
47+
After=network.target
48+
49+
[Service]
50+
Type=simple
51+
User=YOUR_USERNAME
52+
WorkingDirectory=/path/to/turing-smart-screen-python
53+
ExecStart=/path/to/turing-smart-screen-python/venv/bin/python main.py
54+
Restart=always
55+
RestartSec=5
56+
57+
[Install]
58+
WantedBy=multi-user.target
59+
```
60+
61+
Enable and start:
62+
```bash
63+
sudo systemctl daemon-reload
64+
sudo systemctl enable turing-screen.service
65+
sudo systemctl start turing-screen.service
66+
67+
# Check status
68+
sudo systemctl status turing-screen.service
69+
```
70+
71+
## USB Permissions
72+
73+
Add your user to dialout group for USB access:
74+
```bash
75+
sudo usermod -a -G dialout $USER
76+
# Log out and back in for changes to take effect
77+
```
78+
79+
## Your Custom Updates Included
80+
81+
✅ MissionCenter theme (`res/themes/MissionCenter/`)
82+
✅ psutil fallback for CPU frequency
83+
✅ Fill and antialias support for line graphs

build-linux.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "=== Building Turing System Monitor for Linux ==="
5+
6+
# Install dependencies
7+
echo "Installing dependencies..."
8+
python3 -m pip install --upgrade pip
9+
python3 -m pip install -r requirements.txt
10+
python3 -m pip install pyinstaller
11+
12+
# Build with PyInstaller
13+
echo "Building executables..."
14+
pyinstaller turing-system-monitor.spec --clean
15+
16+
echo ""
17+
echo "=== Build Complete ==="
18+
echo "Executables location: dist/turing-system-monitor/"
19+
echo ""
20+
echo "To run:"
21+
echo " cd dist/turing-system-monitor"
22+
echo " ./main"

library/sensors/sensors_librehardwaremonitor.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,14 @@ def frequency() -> float:
203203
except:
204204
pass
205205

206+
# Fallback to psutil if LHM doesn't return valid frequencies
207+
try:
208+
freq = psutil.cpu_freq()
209+
if freq and freq.current > 0:
210+
return freq.current
211+
except:
212+
pass
213+
206214
# Frequencies reading is not supported on this CPU
207215
return math.nan
208216

1.96 KB
Loading
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Mission Center Theme Background Generator - V2 (Fixed)
4+
Clean dark theme without accent lines
5+
For Turing Smart Screen 3.5" Landscape (480x320)
6+
"""
7+
8+
from PIL import Image, ImageDraw
9+
import os
10+
11+
# Screen dimensions
12+
WIDTH = 480
13+
HEIGHT = 320
14+
15+
# Color palette
16+
COLORS = {
17+
'bg_dark': (20, 22, 28), # Dark background
18+
'bg_panel': (32, 34, 44), # Panel background
19+
'bg_graph': (26, 28, 36), # Graph area
20+
'border': (55, 58, 70), # Panel borders
21+
'grid': (42, 45, 55), # Grid lines
22+
}
23+
24+
25+
def draw_rounded_rect(draw, xy, radius, fill=None, outline=None, width=1):
26+
"""Draw a rounded rectangle"""
27+
draw.rounded_rectangle(xy, radius=radius, fill=fill, outline=outline, width=width)
28+
29+
30+
def draw_grid(draw, x, y, w, h, color):
31+
"""Draw subtle grid lines"""
32+
# 3 horizontal lines
33+
for i in range(1, 4):
34+
ly = y + (h * i // 4)
35+
draw.line([(x, ly), (x + w, ly)], fill=color, width=1)
36+
# 5 vertical lines
37+
for i in range(1, 6):
38+
lx = x + (w * i // 6)
39+
draw.line([(lx, y), (lx, y + h)], fill=color, width=1)
40+
41+
42+
def create_background():
43+
img = Image.new('RGB', (WIDTH, HEIGHT), COLORS['bg_dark'])
44+
draw = ImageDraw.Draw(img)
45+
46+
# Panel layout
47+
margin = 4
48+
gap = 4
49+
panel_w = (WIDTH - margin * 2 - gap) // 2 # 234
50+
panel_h = (HEIGHT - margin * 2 - gap) // 2 # 154
51+
52+
panels = [
53+
(margin, margin), # CPU
54+
(margin + panel_w + gap, margin), # GPU
55+
(margin, margin + panel_h + gap), # RAM
56+
(margin + panel_w + gap, margin + panel_h + gap), # NET
57+
]
58+
59+
for px, py in panels:
60+
# Panel background
61+
draw_rounded_rect(
62+
draw,
63+
(px, py, px + panel_w, py + panel_h),
64+
radius=6,
65+
fill=COLORS['bg_panel'],
66+
outline=COLORS['border'],
67+
width=1
68+
)
69+
70+
# Graph area (leave space for header:24px and footer:30px)
71+
gx = px + 6
72+
gy = py + 26
73+
gw = panel_w - 12
74+
gh = panel_h - 58 # 96px for graph
75+
76+
# Graph background
77+
draw_rounded_rect(
78+
draw,
79+
(gx, gy, gx + gw, gy + gh),
80+
radius=4,
81+
fill=COLORS['bg_graph']
82+
)
83+
84+
# Grid inside graph
85+
draw_grid(draw, gx + 2, gy + 2, gw - 4, gh - 4, COLORS['grid'])
86+
87+
# Save
88+
script_dir = os.path.dirname(os.path.abspath(__file__))
89+
output_path = os.path.join(script_dir, 'background.png')
90+
img.save(output_path, 'PNG')
91+
print(f"Saved: {output_path}")
92+
print(f"Panel: {panel_w}x{panel_h}, Graph area: Y+26, H=96")
93+
94+
95+
if __name__ == '__main__':
96+
create_background()

0 commit comments

Comments
 (0)