Moved python files into a subdir; adds config file

This commit is contained in:
kdmukai
2021-06-23 21:46:41 -05:00
parent 69f002c348
commit 2fbb82bb83
39 changed files with 2090 additions and 13 deletions
+1 -1
View File
@@ -142,7 +142,7 @@ Description=Seedsigner
[Service]
User=pi
WorkingDirectory=/home/pi/seedsigner
WorkingDirectory=/home/pi/seedsigner/seedsigner
ExecStart=/usr/bin/python3 main.py
Restart=always
File diff suppressed because it is too large Load Diff
+26 -8
View File
@@ -19,13 +19,31 @@ from blue_vault_wallet import BlueVaultWallet
from sparrow_multisig_wallet import SparrowMultiSigWallet
from generic_ur2_wallet import GenericUR2Wallet
LANGUAGES = {
"en": "English",
# "es": "Español",
# "fr": "Français",
}
class Controller:
VERSION = "0.4.1a1"
def __init__(self) -> None:
def __init__(self, config) -> None:
controller = self
# settings
self.DEBUG = config.getboolean("system", "DEBUG")
self.language_code = config.get("system", "DEFAULT_LANGUAGE")
if self.language_code not in LANGUAGES:
raise Exception(f"Unsupported language code: {self.language_code}")
display_settings = {}
display_settings["background_color"] = config.get("system", "BACKGROUND_COLOR")
display_settings["text_color"] = config.get("system", "TEXT_COLOR")
# Input Buttons
self.buttons = Buttons()
@@ -48,14 +66,15 @@ class Controller:
p = Process(target=CameraProcess.start, args=(self.from_camera_queue, self.to_camera_queue))
p.start()
return
def start(self, debug = False) -> None:
if debug == False:
crash_cnt = 0
def start(self) -> None:
if self.DEBUG:
# Let Exceptions halt execution
self.show_main_menu()
else:
# Handle Unexpected crashes by restarting up to 3 times
crash_cnt = 0
while True:
try:
self.show_main_menu()
@@ -70,8 +89,7 @@ class Controller:
crash_cnt += 1
self.menu_view.draw_modal(["Crashed ..."], "", "requires hard restart")
else:
self.show_main_menu()
### Menu
### Menu View handles navigation within the menu
+8 -4
View File
@@ -1,12 +1,16 @@
import configparser
import sys
import time
sys.path.append('./views')
sys.path.append('./models')
sys.path.append('./helpers')
from controller import Controller
import time
DEBUG = True
controller = Controller()
controller.start(DEBUG)
config = configparser.ConfigParser()
config.read("settings.ini")
controller = Controller(config)
controller.start()
+7
View File
@@ -0,0 +1,7 @@
[system]
DEBUG = True
DEFAULT_LANGUAGE = en
[display]
BACKGROUND_COLOR = #666
TEXT_COLOR = #cc66cc