Start reworking design

This commit is contained in:
2025-06-15 15:33:11 +02:00
parent d875119071
commit 2b8f3c8aad
9 changed files with 31 additions and 36 deletions

View File

@@ -54,7 +54,7 @@ else:
# Load kivy modules. Kivy is the UI framework used. See https://kivy.org # Load kivy modules. Kivy is the UI framework used. See https://kivy.org
# from kivy.core.window import Window, Config # from kivy.core.window import Window, Config
from kivy.uix.screenmanager import ScreenManager from kivy.uix.screenmanager import ScreenManager
from kivy.app import App from kivymd.app import MDApp
# Store the current app version # Store the current app version
@@ -77,7 +77,7 @@ from gui.main.main import MainScreen
# │ Screen Manager │ # │ Screen Manager │
# ╰────────────────────────────────────────────────╯ # ╰────────────────────────────────────────────────╯
# Kivy uses a screen manager to manage pages in the application # Kivy uses a screen manager to manage pages in the application
class BiogasControllerApp(App): class BiogasControllerApp(MDApp):
def __init__(self, **kwargs): def __init__(self, **kwargs):
super().__init__(**kwargs) super().__init__(**kwargs)
self.screen_manager = ScreenManager() self.screen_manager = ScreenManager()
@@ -88,6 +88,12 @@ class BiogasControllerApp(App):
if config["Dev"]["use_test_library"] == "True": if config["Dev"]["use_test_library"] == "True":
com = lib.test.com.Com() com = lib.test.com.Com()
self.theme_cls.theme_style = "Dark"
self.theme_cls.primary_palette = "Green"
self.theme_cls.accent_palette = "Lime"
self.theme_cls.theme_style_switch_animation = True
self.theme_cls.theme_style_switch_animation_duration = 0.8
self.icon = "./BiogasControllerAppLogo.png" self.icon = "./BiogasControllerAppLogo.png"
self.title = "BiogasControllerApp-" + app_version self.title = "BiogasControllerApp-" + app_version
self.screen_manager.add_widget(HomeScreen(com, name="home")) self.screen_manager.add_widget(HomeScreen(com, name="home"))

View File

@@ -1,3 +0,0 @@
from gui.popups.popups import *

View File

@@ -1,8 +1,8 @@
from kivy.uix.screenmanager import Screen from kivymd.uix.screen import MDScreen
from kivy.lang import Builder from kivy.lang import Builder
class CreditsScreen(Screen): class CreditsScreen(MDScreen):
pass pass
Builder.load_file('./gui/credits/credits.kv') Builder.load_file('./gui/credits/credits.kv')

View File

@@ -1,40 +1,36 @@
<HomeScreen>: <HomeScreen>:
name: "home" name: "home"
canvas.before:
Color:
rgba: (20,20,20,0.2)
Rectangle:
size: self.size
pos: self.pos
GridLayout: GridLayout:
cols:1 cols:1
Label: MDLabel:
text: "BiogasanlageControllerApp" text: "BiogasanlageControllerApp"
font_size: 50 font_size: 50
color: (0, 113, 0, 1) halign: 'center'
bold:True valign: 'center'
italic:True bold: True
italic: True
theme_text_color: 'Secondary'
FloatLayout: FloatLayout:
GridLayout: GridLayout:
cols: 2 cols: 2
size_hint: 0.8, 0.8 size_hint: 0.8, 0.8
pos_hint: {"x": 0.1, "y": 0.1} pos_hint: {"x": 0.1, "y": 0.1}
Button: MDRaisedButton:
style: "outlined"
on_release: root.start()
text: "Start" text: "Start"
background_color: (0, 0, 0, 0.6)
font_size: 30 font_size: 30
on_release:
root.start()
Button: Button:
text: "Quit" text: "Quit"
background_color: (0, 0, 0, 0.6) background_color: (0, 0, 0, 0.6)
font_size: 30 font_size: 30
on_release: on_release:
root.quit() root.quit()
Label: MDLabel:
text: "You are running version V3.0.1" text: "You are running version V3.0.1"
font_size: 13 font_size: 13
pos_hint: {"y": -0.45, "x":0.05} pos_hint: {"y": -0.45, "x":0}
halign: 'center'
Button: Button:
text: "About" text: "About"
font_size: 13 font_size: 13

View File

@@ -1,4 +1,5 @@
from kivy.uix.screenmanager import Screen from kivymd.app import MDApp
from kivymd.uix.screen import MDScreen
from kivy.lang import Builder from kivy.lang import Builder
from gui.popups.popups import DualRowPopup, QuitPopup, TwoActionPopup from gui.popups.popups import DualRowPopup, QuitPopup, TwoActionPopup
from lib.com import ComSuperClass from lib.com import ComSuperClass
@@ -21,7 +22,7 @@ information = {
# 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
class HomeScreen(Screen): class HomeScreen(MDScreen):
def __init__(self, com: ComSuperClass, **kw): def __init__(self, com: ComSuperClass, **kw):
self._com = com; self._com = com;
super().__init__(**kw) super().__init__(**kw)

View File

@@ -1,8 +1,7 @@
from ctypes import ArgumentError from ctypes import ArgumentError
from time import time from time import time
from types import prepare_class
from typing import List, override from typing import List, override
from kivy.uix.screenmanager import Screen from kivymd.uix.screen import MDScreen
from kivy.lang import Builder from kivy.lang import Builder
from gui.popups.popups import SingleRowPopup, TwoActionPopup, empty_func from gui.popups.popups import SingleRowPopup, TwoActionPopup, empty_func
from kivy.clock import Clock, ClockEvent from kivy.clock import Clock, ClockEvent
@@ -96,7 +95,7 @@ class ReaderThread(threading.Thread):
# │ Main App Screen │ # │ Main App Screen │
# ╰────────────────────────────────────────────────╯ # ╰────────────────────────────────────────────────╯
# This is the main screen, where you can read out data # This is the main screen, where you can read out data
class MainScreen(Screen): class MainScreen(MDScreen):
_event: ClockEvent _event: ClockEvent
# The constructor if this class takes a Com object to share one between all screens # The constructor if this class takes a Com object to share one between all screens

View File

@@ -1,12 +1,7 @@
<ProgramScreen>: <ProgramScreen>:
name: "program" name: "program"
on_enter: self.config_loader = root.load_config() on_enter: self.config_loader = root.load_config()
canvas.before: md_bg_color: app.theme_cls.primary_color
Color:
rgba: (10,10,10,0.1)
Rectangle:
size: self.size
pos: self.pos
FloatLayout: FloatLayout:
Label: Label:
text: "Configuration" text: "Configuration"

View File

@@ -1,5 +1,5 @@
from typing import List from typing import List
from kivy.uix.screenmanager import Screen from kivymd.uix.screen import MDScreen
from kivy.lang import Builder from kivy.lang import Builder
from lib.decoder import Decoder from lib.decoder import Decoder
from lib.instructions import Instructions from lib.instructions import Instructions
@@ -13,7 +13,7 @@ from kivy.clock import Clock
name_map = ["a", "b", "c", "t"] name_map = ["a", "b", "c", "t"]
class ProgramScreen(Screen): class ProgramScreen(MDScreen):
def __init__(self, com: ComSuperClass, **kw): def __init__(self, com: ComSuperClass, **kw):
self._com = com self._com = com
self._instructions = Instructions(com) self._instructions = Instructions(com)

View File

@@ -1,2 +1,3 @@
kivy[base] kivy[base]
kivymd
pyserial pyserial