mirror of
https://github.com/janishutz/BiogasControllerApp.git
synced 2025-11-25 05:44:23 +00:00
Main, Program Screen basically done, UI Tweaks, backend fixes, start writing testing library
This commit is contained in:
@@ -1,30 +1,49 @@
|
||||
from kivy.uix.screenmanager import Screen
|
||||
from kivy.lang import Builder
|
||||
from gui.popups.popups import QuitPopup, SingleRowPopup, TwoActionPopup
|
||||
from gui.popups.popups import QuitPopup, TwoActionPopup
|
||||
from lib.com import Com
|
||||
|
||||
import configparser
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read('./config.ini')
|
||||
|
||||
# This is the launch screen, i.e. what you see when you start up the app
|
||||
class HomeScreen(Screen):
|
||||
def __init__(self, com: Com, **kw):
|
||||
self._com = com;
|
||||
super().__init__(**kw)
|
||||
|
||||
# Go to the main screen if we can establish connection or the check was disabled
|
||||
# in the configs
|
||||
def start(self):
|
||||
if self._com.connect(19200):
|
||||
if config[ 'Dev Settings' ][ 'disableconnectioncheck' ] != "True":
|
||||
if self._com.connect():
|
||||
self.manager.current = 'main'
|
||||
self.manager.transition.direction = 'right'
|
||||
else:
|
||||
TwoActionPopup().open('Failed to connect', 'Details', self.open_details_popup)
|
||||
print('ERROR connecting')
|
||||
else:
|
||||
self.manager.current = 'main'
|
||||
self.manager.transition.direction = 'right'
|
||||
else:
|
||||
TwoActionPopup().open('Failed to connect', 'Details', self.open_details_popup)
|
||||
print('ERROR connecting')
|
||||
|
||||
# Open popup for details as to why the connection failed
|
||||
def open_details_popup(self):
|
||||
# TODO: Finish
|
||||
print( 'Details' )
|
||||
|
||||
# Helper to open a Popup to ask user whether to quit or not
|
||||
def quit(self):
|
||||
QuitPopup(self._com).open()
|
||||
|
||||
# Switch to about screen
|
||||
def to_about(self):
|
||||
self.manager.current = 'about'
|
||||
self.manager.transition.direction = 'down'
|
||||
|
||||
|
||||
# Load the design file for this screen (.kv files)
|
||||
# The path has to be relative to root of the app, i.e. where the biogascontrollerapp.py
|
||||
# file is located
|
||||
Builder.load_file('./gui/home/home.kv')
|
||||
|
||||
Reference in New Issue
Block a user