From 3a6928a0189bfe8d481c7eeac7a3d3df5dd9cdc0 Mon Sep 17 00:00:00 2001 From: Abdellah El Morabit Date: Sun, 24 Nov 2024 12:41:38 +0100 Subject: updates to the web gui --- .vscode/settings.json | 25 +++++++++-- README.md | 20 +++++++++ api_server.service | 15 +++++++ templates/api.py | 27 +++++++++++ templates/index.html | 37 ++++++++++++++++ templates/live_preview.py | 14 ++++++ templates/page/notes.html | 24 ++++++++++ templates/page/overview.html | 29 ++++++++++++ templates/page/recourses.html | 29 ++++++++++++ templates/page/speech.html | 29 ++++++++++++ templates/static/main.mjs | 13 ++++++ templates/static/styles.css | 101 ++++++++++++++++++++++++++++++++++++++++++ webGUI/index.html | 33 -------------- webGUI/main.mjs | 13 ------ webGUI/pages/cpuinfo.html | 30 ------------- webGUI/pages/general.html | 30 ------------- webGUI/pages/main.js | 0 webGUI/pages/notes.html | 25 ----------- webGUI/pages/recourses.html | 30 ------------- webGUI/pages/speech.html | 30 ------------- webGUI/styles.css | 92 -------------------------------------- 21 files changed, 359 insertions(+), 287 deletions(-) create mode 100644 api_server.service create mode 100644 templates/api.py create mode 100644 templates/index.html create mode 100644 templates/live_preview.py create mode 100644 templates/page/notes.html create mode 100644 templates/page/overview.html create mode 100644 templates/page/recourses.html create mode 100644 templates/page/speech.html create mode 100644 templates/static/main.mjs create mode 100644 templates/static/styles.css delete mode 100644 webGUI/index.html delete mode 100644 webGUI/main.mjs delete mode 100644 webGUI/pages/cpuinfo.html delete mode 100644 webGUI/pages/general.html delete mode 100644 webGUI/pages/main.js delete mode 100644 webGUI/pages/notes.html delete mode 100644 webGUI/pages/recourses.html delete mode 100644 webGUI/pages/speech.html delete mode 100644 webGUI/styles.css diff --git a/.vscode/settings.json b/.vscode/settings.json index 66f540e..dd10108 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,22 @@ { - "python.testing.pytestArgs": ["I2C"], - "python.testing.unittestEnabled": false, - "python.testing.pytestEnabled": true -} + "workbench.colorCustomizations": { + "activityBar.activeBackground": "#1a1a1a", + "activityBar.background": "#1a1a1a", + "activityBar.foreground": "#e7e7e7", + "activityBar.inactiveForeground": "#e7e7e799", + "activityBarBadge.background": "#606020", + "activityBarBadge.foreground": "#e7e7e7", + "commandCenter.border": "#e7e7e799", + "sash.hoverBorder": "#1a1a1a", + "statusBar.background": "#000000", + "statusBar.foreground": "#e7e7e7", + "statusBarItem.hoverBackground": "#1a1a1a", + "statusBarItem.remoteBackground": "#000000", + "statusBarItem.remoteForeground": "#e7e7e7", + "titleBar.activeBackground": "#000000", + "titleBar.activeForeground": "#e7e7e7", + "titleBar.inactiveBackground": "#00000099", + "titleBar.inactiveForeground": "#e7e7e799" + }, + "peacock.color": "black" +} \ No newline at end of file diff --git a/README.md b/README.md index 46c8b77..5bc547a 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,23 @@ This is a starter project with the goal of expanded everything later on to let's 18/11/2024 migrating to C for the main code The program is Multi-platform and even supports a web-console + +MAIN USE OF THE PROGRAM : + +the main feature of the program is the ability to control and I2C display really extensivly and be abel to do alot of things with it + +CURRENT FEATURES -> + +* weather display +* random generated greeting quote ( still dont know what to really do about that, could add a joke of the day system or something like that) +* a button powered button pomodore timer +* some sort of clock mechanisme that adds an alarm clock, timer and stopwatch +* system monitor dashbord ( cpu , ram , disk , temp , ... ) +* speech command center +* generative AI model that uses meta's llama +* current playing audio +* voice based notes +* to do list integration based on the personal calender + + +A nice idea is to make it somehting easily installabled and configurable in the future without to much tinkering need diff --git a/api_server.service b/api_server.service new file mode 100644 index 0000000..b69c5e4 --- /dev/null +++ b/api_server.service @@ -0,0 +1,15 @@ +[Unit] +Description=REST API Server for RPI +After=network.target + +[Service] +ExecStart=/usr/bin/python3 /home/pi/I2C/bin/main.py +WorkingDirectory=/home/pi/I2C +User=nasr +Group=pi +Restart=always +Environment="PYTHONUNBUFFERED=1" + +[Install] +WantedBy=multi-user.target + diff --git a/templates/api.py b/templates/api.py new file mode 100644 index 0000000..b04ef77 --- /dev/null +++ b/templates/api.py @@ -0,0 +1,27 @@ +from flask import Flask, request, jsonify, render_template + +app = Flask(__name__) + + +@app.route("/") +def index(): + return render_template("index.html") + + +@app.route("/api/run-script", methods=["POST"]) +def run_script(): + data = request.json + if not data: + return jsonify({"error": "No data provided"}), 400 + + script_result = my_script_logic(data.get("input")) + + return jsonify({"result": script_result}) + + +def my_script_logic(input_value): + return f"Processed input: {input_value}" + + +if __name__ == "__main__": + app.run(host="0.0.0.0", port=5000, debug=True) diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..5436dbd --- /dev/null +++ b/templates/index.html @@ -0,0 +1,37 @@ + + + + + + + CONSOLE + + + + + + + +
+ Resources + Speech Transcriber + Display a Message + General Tools +
+
+

This is the main control center for the I2C deivce. You can find + the main code and information about the project under my GITHUB

+ +
+ + + + + diff --git a/templates/live_preview.py b/templates/live_preview.py new file mode 100644 index 0000000..e753fc6 --- /dev/null +++ b/templates/live_preview.py @@ -0,0 +1,14 @@ +from livereload import Server + +server = Server() +# Watch HTML file +server.watch('index.html') +# Watch CSS files +server.watch('static/styles.css') +# Watch JavaScript files +server.watch('static/main.mjs') +# Watch other files if needed +server.watch('page/*') # Watch everything in the page folder + +# Serve the current directory +server.serve(root='.') diff --git a/templates/page/notes.html b/templates/page/notes.html new file mode 100644 index 0000000..3f24816 --- /dev/null +++ b/templates/page/notes.html @@ -0,0 +1,24 @@ + + + + + + + Display a Message + + + + + + + +
+

Display a Message

+
+ +