Initial GUI-Development progress - 2022-02-26-16:42
This commit is contained in:
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -5,14 +5,4 @@ This module configures PCs but relies heavily on external modules that are inclu
|
|||||||
|
|
||||||
class ConfigCreator:
|
class ConfigCreator:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
print("""
|
print("")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Welcome to the PC-Configurator!
|
|
||||||
--------------------------------
|
|
||||||
|
|
||||||
We still need a couple of informations so we can make sure you get the best configuration possible!
|
|
||||||
|
|
||||||
No more questions? Let's start!
|
|
||||||
""")
|
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
import bin.lib.csv_parsers
|
|
||||||
import requests
|
|
||||||
import datetime
|
|
||||||
|
|
||||||
cvr = bin.lib.csv_parsers.CsvRead()
|
|
||||||
cvw = bin.lib.csv_parsers.CsvWrite()
|
|
||||||
|
|
||||||
class PriceExtractor:
|
|
||||||
def __init__(self):
|
|
||||||
|
|
||||||
def update_all_prices(self, folder):
|
|
||||||
self.digitec_extractor()
|
|
||||||
|
|
||||||
|
|
||||||
def digitec_extractor(self):
|
|
||||||
"""Run through the entire list of links specified in the csv file that was selected either when loading the
|
|
||||||
function or when specified through the method \"readfile\". NOTE: This method does not require any additional
|
|
||||||
arguments and also does run through the entire file!"""
|
|
||||||
while
|
|
||||||
|
|
||||||
while self.__productnumber < self.__productcount:
|
|
||||||
self.__ingest = self.__raw_list.pop(0)
|
|
||||||
self.__website = self.__ingest.pop(1)
|
|
||||||
self.__productnumber = int(self.__ingest.pop(0))
|
|
||||||
print("fetching data... This step might take a couple of seconds")
|
|
||||||
self.__res = requests.get(self.__website)
|
|
||||||
print("recieved data from", self.__website)
|
|
||||||
self.__check = str(self.__res)
|
|
||||||
if self.__check == "<Response [404]>":
|
|
||||||
print("Ressource unavailable, skipping..")
|
|
||||||
else:
|
|
||||||
self.__request_done = self.__res.text
|
|
||||||
self.__priceIdx = self.__request_done.index('property="product:price:amount')
|
|
||||||
self.__raw_price = self.__request_done[self.__priceIdx + 41:self.__priceIdx + 60]
|
|
||||||
self.__price_extract = ""
|
|
||||||
for buchstabe in self.__raw_price:
|
|
||||||
if buchstabe == "\"":
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
self.__price_extract += buchstabe
|
|
||||||
self.__price = float(self.__price_extract)
|
|
||||||
print("The price is following: ", self.__price, "CHF\n")
|
|
||||||
with open("../../data/prices.csv", "a") as pricedata:
|
|
||||||
writing = csv.writer(pricedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
|
|
||||||
writing.writerow([self.__productnumber, self.__price])
|
|
||||||
0
data/config.csv
Normal file
0
data/config.csv
Normal file
|
|
@@ -1,5 +1,5 @@
|
|||||||
version from,2022-02-17 09:30:53.233664
|
version from,2022-02-26 11:06:52.832345
|
||||||
1,559.0
|
1,495.0
|
||||||
2,290.0
|
2,290.0
|
||||||
3,9.2
|
3,9.3
|
||||||
4,359.0
|
4,359.0
|
||||||
|
|||||||
|
32
dev_tools/hotreloader.py
Normal file
32
dev_tools/hotreloader.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
from kivy.lang import Builder
|
||||||
|
|
||||||
|
from kivymd.app import MDApp
|
||||||
|
|
||||||
|
KV = '''
|
||||||
|
#:import KivyLexer kivy.extras.highlight.KivyLexer
|
||||||
|
#:import HotReloadViewer kivymd.utils.hot_reload_viewer.HotReloadViewer
|
||||||
|
|
||||||
|
|
||||||
|
BoxLayout:
|
||||||
|
HotReloadViewer:
|
||||||
|
size_hint_x: .3
|
||||||
|
path: app.path_to_kv_file
|
||||||
|
errors: True
|
||||||
|
errors_text_color: 1, 1, 0, 1
|
||||||
|
errors_background_color: app.theme_cls.bg_dark
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
class Example(MDApp):
|
||||||
|
path_to_kv_file = "../gui_main/configurator.kv"
|
||||||
|
|
||||||
|
def build(self):
|
||||||
|
self.theme_cls.theme_style = "Dark"
|
||||||
|
return Builder.load_string(KV)
|
||||||
|
|
||||||
|
def update_kv_file(self, text):
|
||||||
|
with open(self.path_to_kv_file, "w") as kv_file:
|
||||||
|
kv_file.write(text)
|
||||||
|
|
||||||
|
|
||||||
|
Example().run()
|
||||||
16
gui_main/configurator.kv
Normal file
16
gui_main/configurator.kv
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
MDScreen:
|
||||||
|
name: "Config"
|
||||||
|
md_bg_color: (0,0,1,0.5)
|
||||||
|
MDFloatLayout:
|
||||||
|
cols:1
|
||||||
|
MDFlatButton:
|
||||||
|
text: "Back"
|
||||||
|
pos_hint: {"x": 0.15, "y": 0.1}
|
||||||
|
font_size: 20
|
||||||
|
md_bg_color: (0, 0, 0, 1)
|
||||||
|
size_hint: 0.1, 0.05
|
||||||
|
on_release:
|
||||||
|
app.root.current = "HomeScreen"
|
||||||
|
root.manager.transition.direction = "left"
|
||||||
|
MDFlatButton:
|
||||||
|
text: "Test"
|
||||||
31
gui_main/main-gui.kv
Normal file
31
gui_main/main-gui.kv
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
Home:
|
||||||
|
name: "HomeScreen"
|
||||||
|
radius: [25, 25, 25, 25]
|
||||||
|
md_bg_color: app.theme_cls.accent_color
|
||||||
|
GridLayout:
|
||||||
|
cols: 1
|
||||||
|
Label:
|
||||||
|
text: "PC-Configurator"
|
||||||
|
font_size: 50
|
||||||
|
color: (50, 50, 255, 1)
|
||||||
|
bold: True
|
||||||
|
italic: True
|
||||||
|
FloatLayout:
|
||||||
|
GridLayout:
|
||||||
|
cols: 3
|
||||||
|
size_hint: 0.94, 0.8
|
||||||
|
pos_hint: {"x":0.03, "y":0.1}
|
||||||
|
Button:
|
||||||
|
text: "Configure"
|
||||||
|
background_color: (0.1, 0.1, 1, 0.5)
|
||||||
|
on_release:
|
||||||
|
app.root.current = "Config"
|
||||||
|
root.manager.transition.direction = "right"
|
||||||
|
Button:
|
||||||
|
text: "Settings"
|
||||||
|
background_color: (0.1, 0.1, 1, 0.5)
|
||||||
|
on_release:
|
||||||
|
root.test()
|
||||||
|
Button:
|
||||||
|
text: "Quit"
|
||||||
|
background_color: (0.1, 0.1, 1, 0.5)
|
||||||
24
gui_main/splashscreen.kv
Normal file
24
gui_main/splashscreen.kv
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
MDScreen:
|
||||||
|
name: "Splash"
|
||||||
|
on_enter: self.ids.progress.start()
|
||||||
|
md_bg_color: app.theme_cls.accent_color
|
||||||
|
GridLayout:
|
||||||
|
cols: 1
|
||||||
|
Label:
|
||||||
|
text: "PC-Configurator"
|
||||||
|
bold: True
|
||||||
|
italic: True
|
||||||
|
font_size: 40
|
||||||
|
color: app.theme_cls.primary_color
|
||||||
|
FloatLayout:
|
||||||
|
BoxLayout:
|
||||||
|
pos_hint: {"center_y": .3, "center_x": .5}
|
||||||
|
padding: "10dp"
|
||||||
|
size_hint_x: .7
|
||||||
|
|
||||||
|
MDProgressBar:
|
||||||
|
id: progress
|
||||||
|
orientation: "horizontal"
|
||||||
|
type: "indeterminate"
|
||||||
|
running_duration: 1
|
||||||
|
catching_duration: 1
|
||||||
@@ -1,69 +1,62 @@
|
|||||||
# 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 time
|
||||||
|
from kivy.uix.screenmanager import Screen, ScreenManager
|
||||||
|
from kivy.uix.popup import Popup
|
||||||
|
from kivy.app import App
|
||||||
|
from kivy.lang import Builder
|
||||||
|
from kivy.clock import mainthread
|
||||||
|
from kivymd.app import MDApp
|
||||||
|
from kivymd.uix.screen import MDScreen
|
||||||
|
from kivy.clock import Clock
|
||||||
|
|
||||||
version = "alpha 1.0"
|
version = "alpha 1.0"
|
||||||
print("""
|
print(f"Launching the simplePCBuilding-PC-Configurator Version {version}!...\nthis might take some time...")
|
||||||
--------------------------------------------------------------------
|
|
||||||
WELCOME TO THE simplePCBuilding PC CONFIGURATOR
|
|
||||||
YOU ARE CURRENTLY RUNNING VERSION""", version, """
|
|
||||||
---------------------------------------------------------------------""")
|
|
||||||
time.sleep(1)
|
|
||||||
print("""
|
|
||||||
|
|
||||||
Please note that this software is developed and distributed by simplePCBuilding
|
|
||||||
and as such you are not allowed to sell and / or distribute this software on
|
|
||||||
your own. If you want to share this project with others, please refer to our
|
|
||||||
guidelines and do only provide the official download-link.
|
|
||||||
|
|
||||||
""")
|
###########
|
||||||
time.sleep(1)
|
# SCREENS
|
||||||
print("""This software is split up into different modules you can use.
|
###########
|
||||||
Select the appropriate one:
|
|
||||||
MODULE LIST:
|
|
||||||
- Configurator (c)
|
|
||||||
- Updater (u)
|
|
||||||
- Package manager (p)
|
|
||||||
- Quit (q)
|
|
||||||
|
|
||||||
To select a module, please type the correct letter (found in brackets behind
|
|
||||||
the module name in the above list) in through your keyboard
|
|
||||||
""")
|
|
||||||
i = input("please choose the module you want to use: ")
|
|
||||||
go = 1
|
|
||||||
|
|
||||||
while go == 1:
|
class Splash(MDScreen):
|
||||||
if i == "c":
|
pass
|
||||||
print("starting configurator...")
|
|
||||||
go = 0
|
|
||||||
|
|
||||||
elif i == "u":
|
|
||||||
print("starting updater...")
|
|
||||||
go = 0
|
|
||||||
|
|
||||||
elif i == "p":
|
class Home(MDScreen):
|
||||||
print("starting package manager...")
|
def test(self):
|
||||||
go = 0
|
print("class")
|
||||||
|
|
||||||
elif i == "q":
|
|
||||||
print("killing processes....")
|
|
||||||
time.sleep(0.5)
|
|
||||||
print("Terminating...")
|
|
||||||
go = 0
|
|
||||||
|
|
||||||
else:
|
class ConfigureScreen(MDScreen):
|
||||||
print("\nUnknown entry, please retry.\n ")
|
pass
|
||||||
time.sleep(0.5)
|
|
||||||
print("""This software is split up into different modules you can use.
|
|
||||||
Select the appropriate one:
|
|
||||||
MODULE LIST:
|
|
||||||
- Configurator (c)
|
|
||||||
- Updater (u)
|
|
||||||
- Package manager (p)
|
|
||||||
- Quit (q)
|
|
||||||
|
|
||||||
To select a module, please type the correct letter (found in brackets behind
|
|
||||||
the module name in the above list) in through your keyboard
|
#################
|
||||||
""")
|
# SCREEN-MANAGER
|
||||||
i = input("Please select a module and type in the corresponding letter: ")
|
#################
|
||||||
|
|
||||||
|
|
||||||
|
class PCConfigurator(MDApp):
|
||||||
|
global screen_manager
|
||||||
|
screen_manager = ScreenManager()
|
||||||
|
def build(self):
|
||||||
|
self.title = "simplePCBuilding-PC-Configurator"
|
||||||
|
self.theme_cls.primary_palette = "Blue"
|
||||||
|
self.theme_cls.accent_palette = "BlueGray"
|
||||||
|
# self.icon = "./BiogasControllerAppLogo.png"
|
||||||
|
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/configurator.kv"))
|
||||||
|
|
||||||
|
return screen_manager
|
||||||
|
|
||||||
|
def on_start(self):
|
||||||
|
Clock.schedule_once(self.launch_app, 1)
|
||||||
|
|
||||||
|
def launch_app(self, dt):
|
||||||
|
screen_manager.current = "HomeScreen"
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
PCConfigurator().run()
|
||||||
|
|||||||
Reference in New Issue
Block a user