UI Tweaks

This commit is contained in:
2025-05-12 16:28:28 +02:00
parent b694d9d086
commit 986d887587
5 changed files with 39 additions and 7 deletions

View File

@@ -2,9 +2,12 @@ from kivy.uix.screenmanager import Screen
from kivy.lang import Builder from kivy.lang import Builder
import webbrowser import webbrowser
from gui.popups.popups import SingleRowPopup
class AboutScreen(Screen): class AboutScreen(Screen):
def report_issue(self): def report_issue(self):
SingleRowPopup().open("Opened your web-browser")
webbrowser.open('https://github.com/janishutz/BiogasControllerApp/issues', new=2) webbrowser.open('https://github.com/janishutz/BiogasControllerApp/issues', new=2)
Builder.load_file('./gui/about/about.kv') Builder.load_file('./gui/about/about.kv')

View File

@@ -19,7 +19,7 @@
pos_hint:{"x":0.05, "y":0.35} pos_hint:{"x":0.05, "y":0.35}
size_hint: 0.9, 0.5 size_hint: 0.9, 0.5
Label: Label:
text: "This is a rework of the BiogasControllerApp V1, that was originally programmed by S. Reichmuth." text: "This is a controller sofware that helps you reprogram and monitor the micro-controller used in ENATECH at KSWO"
Label: Label:
text: "Written by: Janis Hutz\nDesigned by: Janis Hutz\nDesign language: Kivy" text: "Written by: Janis Hutz\nDesigned by: Janis Hutz\nDesign language: Kivy"
Label: Label:

View File

@@ -32,8 +32,7 @@
on_release: on_release:
root.quit() root.quit()
Label: Label:
text: "App version" text: "You are running version V3.0.0"
id: app_version
font_size: 13 font_size: 13
pos_hint: {"y": -0.45, "x":0.05} pos_hint: {"y": -0.45, "x":0.05}
Button: Button:

View File

@@ -1,9 +1,23 @@
from kivy.uix.screenmanager import Screen from kivy.uix.screenmanager import Screen
from kivy.lang import Builder from kivy.lang import Builder
from gui.popups.popups import QuitPopup, TwoActionPopup from gui.popups.popups import DualRowPopup, QuitPopup, TwoActionPopup
from lib.com import ComSuperClass from lib.com import ComSuperClass
import platform
import configparser
# Information for errors encountered when using pyserial
information = {
"Windows": {
"2": "Un- and replug the cable and ensure you have the required driver(s) installed",
"13": "You are probably missing a required driver or your cable doesn't work. Consult the wiki for more information",
"NO_COM": "Could not find a microcontroller. Please ensure you have one connected and the required driver(s) installed"
},
"Linux": {
"2": "Un- and replug the cable, or if you haven't plugged a controller in yet, do that",
"13": "Incorrect permissions at /dev/ttyUSB0. Open a terminal and type: sudo chmod 777 /dev/ttyUSB0",
"NO_COM": "Could not find a microcontroller. Please ensure you have one connected"
}
}
# This is the launch screen, i.e. what you see when you start up the app # This is the launch screen, i.e. what you see when you start up the app
@@ -24,8 +38,22 @@ class HomeScreen(Screen):
# Open popup for details as to why the connection failed # Open popup for details as to why the connection failed
def open_details_popup(self): def open_details_popup(self):
# TODO: Finish DualRowPopup().open("Troubleshooting tips", self._generate_help())
print( 'Details' )
def _generate_help(self) -> str:
operating_system = platform.system()
if operating_system == "Windows" or operating_system == "Linux":
port = self._com.get_comport();
information["Linux"]["13"] = f"Incorrect permissions at {port}. Resolve by running 'sudo chmod 777 {port}'"
if port == "":
return information[operating_system]["NO_COM"]
err = self._com.get_error()
if err != None:
return information[operating_system][str(err.errno)]
else:
return "No error message available"
else:
return "You are running on an unsupported Operating System. No help available"
# Helper to open a Popup to ask user whether to quit or not # Helper to open a Popup to ask user whether to quit or not
def quit(self): def quit(self):

View File

@@ -25,6 +25,7 @@ class ProgramScreen(Screen):
# Load the current configuration from the micro-controller # Load the current configuration from the micro-controller
def _load(self, dt: float): def _load(self, dt: float):
# Hook to the microcontroller's data stream (i.e. sync up with it)
if self._instructions.hook("RD", ["\n", "R", "D", "\n"]): if self._instructions.hook("RD", ["\n", "R", "D", "\n"]):
config: List[List[str]] = [] config: List[List[str]] = []
@@ -35,6 +36,7 @@ class ProgramScreen(Screen):
try: try:
received = self._com.receive(28) received = self._com.receive(28)
except: except:
# Open error popup
TwoActionPopup().open( TwoActionPopup().open(
"Failed to connect to micro-controller, retry?", "Failed to connect to micro-controller, retry?",
"Cancel", "Cancel",