added logger and set up settings screen
This commit is contained in:
@@ -31,12 +31,10 @@ class TopGamesUpdater:
|
|||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
self.__output += self.letter
|
self.__output += self.letter
|
||||||
|
print(self.__output)
|
||||||
self.__return_value.append(self.__output)
|
self.__return_value.append(self.__output)
|
||||||
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.__go = 0
|
self.__go = 0
|
||||||
|
|
||||||
return self.__return_value
|
return self.__return_value
|
||||||
|
|
||||||
|
|
||||||
TopGamesUpdater().updater()
|
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import bin.lib.csv_parsers
|
||||||
|
|
||||||
|
|
||||||
|
cvr = bin.lib.csv_parsers.CsvRead()
|
||||||
|
|
||||||
|
|
||||||
|
class OSAssigner:
|
||||||
|
def __init__(self):
|
||||||
|
self.__budget = 0
|
||||||
|
self.__import = []
|
||||||
|
self.__extracted = ""
|
||||||
|
self.__price = []
|
||||||
|
|
||||||
|
def os_chooser(self, budget, os_choice, os_price_file, availability=False):
|
||||||
|
self.__budget = budget
|
||||||
|
self.__import = cvr.importing(os_price_file)
|
||||||
|
for self.item in self.__import:
|
||||||
|
self.__price.append(self.item.pop(1))
|
||||||
|
|
||||||
|
if os_choice == "Windows 10 Home" or "Windows 11 Home" and availability is False:
|
||||||
|
self.__budget -= self.__price.pop(0)
|
||||||
|
elif os_choice == "Windows 10 Pro" or "Windows 11 Pro" and availability is False:
|
||||||
|
self.__budget -= self.__price.pop(1)
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return self.__budget
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
This module configures PCs but relies heavily on external modules that are included with the package.
|
This module configures PCs but relies heavily on external modules that are included with the package.
|
||||||
"""
|
"""
|
||||||
import bin.lib.csv_parsers
|
import bin.lib.csv_parsers
|
||||||
|
import bin.config.os
|
||||||
|
import bin.config.case
|
||||||
|
|
||||||
|
|
||||||
cvr = bin.lib.csv_parsers.CsvRead()
|
cvr = bin.lib.csv_parsers.CsvRead()
|
||||||
@@ -11,6 +13,11 @@ cvw = bin.lib.csv_parsers.CsvWrite()
|
|||||||
class ConfigCreator:
|
class ConfigCreator:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.__info_import = []
|
self.__info_import = []
|
||||||
|
self.__budget = 0
|
||||||
|
self.__os_choice = ""
|
||||||
|
self.__os_path = ""
|
||||||
|
|
||||||
def start_config(self, path):
|
def start_config(self, path):
|
||||||
self.__info_import = cvr.importing(path)
|
self.__info_import = cvr.importing(path)
|
||||||
|
self.__budget = bin.config.os.OSAssigner().os_chooser(self.__budget, self.__os_choice, self.__os_path)
|
||||||
|
self.__budget = bin.config.case
|
||||||
|
|||||||
6
config/settings.ini
Normal file
6
config/settings.ini
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[Info]
|
||||||
|
version = 0.1
|
||||||
|
subVersion = -dev1
|
||||||
|
|
||||||
|
[Dev Settings]
|
||||||
|
log_level = DEBUG
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
ConfigureScreen:
|
||||||
|
name: "Settings"
|
||||||
|
GridLayout:
|
||||||
|
cols: 1
|
||||||
|
Button:
|
||||||
|
text: "back"
|
||||||
|
on_release:
|
||||||
|
app.root.current = "HomeScreen"
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
# This is the main runtime of the simplePCBuilding-PC-Configurator
|
# This is the main runtime of the simplePCBuilding-PC-Configurator
|
||||||
# IMPORTS
|
# IMPORTS
|
||||||
import time
|
import datetime
|
||||||
|
import configparser
|
||||||
|
import logging
|
||||||
from kivy.uix.screenmanager import ScreenManager
|
from kivy.uix.screenmanager import ScreenManager
|
||||||
from kivy.uix.popup import Popup
|
from kivy.uix.popup import Popup
|
||||||
from kivy.lang import Builder
|
from kivy.lang import Builder
|
||||||
@@ -9,7 +11,26 @@ from kivymd.app import MDApp
|
|||||||
from kivymd.uix.screen import MDScreen
|
from kivymd.uix.screen import MDScreen
|
||||||
from kivy.clock import Clock
|
from kivy.clock import Clock
|
||||||
|
|
||||||
version = "alpha 1.0"
|
config = configparser.ConfigParser()
|
||||||
|
config.read('./config/settings.ini')
|
||||||
|
|
||||||
|
version_app = f"{config['Info']['version']}{config['Info']['subVersion']}"
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# LOGGER SETUP
|
||||||
|
##################
|
||||||
|
logging.basicConfig(level=logging.DEBUG, filename="./log/main_log.log", filemode="w")
|
||||||
|
logs = f"./log/{datetime.datetime.now()}-log-main.log"
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
handler = logging.FileHandler(logs)
|
||||||
|
formatter = logging.Formatter("%(levelname)s - %(asctime)s - %(name)s: %(message)s -- %(lineno)d")
|
||||||
|
handler.setFormatter(formatter)
|
||||||
|
logger.addHandler(handler)
|
||||||
|
|
||||||
|
logger.setLevel(config['Dev Settings']['log_level'])
|
||||||
|
logger.info(f"Logger initialized, app is running Version: {version_app}")
|
||||||
|
################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
###########
|
###########
|
||||||
@@ -45,15 +66,18 @@ class PCConfigurator(MDApp):
|
|||||||
screen_manager.add_widget(Builder.load_file("./gui_main/splashscreen.kv"))
|
screen_manager.add_widget(Builder.load_file("./gui_main/splashscreen.kv"))
|
||||||
screen_manager.add_widget(Builder.load_file("./gui_main/main-gui.kv"))
|
screen_manager.add_widget(Builder.load_file("./gui_main/main-gui.kv"))
|
||||||
screen_manager.add_widget(Builder.load_file("./gui_main/configurator.kv"))
|
screen_manager.add_widget(Builder.load_file("./gui_main/configurator.kv"))
|
||||||
|
screen_manager.add_widget(Builder.load_file("./gui_main/settings.kv"))
|
||||||
return screen_manager
|
return screen_manager
|
||||||
|
|
||||||
def on_start(self):
|
def on_start(self):
|
||||||
|
logger.info("App mainframe started, executing checks")
|
||||||
Clock.schedule_once(self.launch_app, 1)
|
Clock.schedule_once(self.launch_app, 1)
|
||||||
|
|
||||||
def launch_app(self, dt):
|
def launch_app(self, dt):
|
||||||
|
# Here the launch script will be launched and the screen will automatically be changed to the home screen
|
||||||
screen_manager.current = "HomeScreen"
|
screen_manager.current = "HomeScreen"
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
logger.info("Launching App...")
|
||||||
PCConfigurator().run()
|
PCConfigurator().run()
|
||||||
|
|||||||
Reference in New Issue
Block a user