Initial Commit

This commit is contained in:
simplePCBuilding
2022-02-26 11:02:03 +01:00
commit f3b47e0f5b
35 changed files with 612 additions and 0 deletions

3
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

View File

@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

4
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/test scrapping.iml" filepath="$PROJECT_DIR$/.idea/test scrapping.iml" />
</modules>
</component>
</project>

10
.idea/test scrapping.iml generated Normal file
View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.8" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

0
bin/config/case.py Normal file
View File

0
bin/config/cooler.py Normal file
View File

0
bin/config/cpu.py Normal file
View File

0
bin/config/gpu.py Normal file
View File

0
bin/config/hdd.py Normal file
View File

0
bin/config/mbd.py Normal file
View File

0
bin/config/os.py Normal file
View File

0
bin/config/psu.py Normal file
View File

0
bin/config/ssd.py Normal file
View File

View File

@@ -0,0 +1,34 @@
"""@package docstring
This module asks the user questions so the software can configure the PC.
"""
class UserprofileCreator:
def __init__(self):
print("""First of all we need your name so we can match it with you.""")
self.i = 0
def chg_username(self):
self.i = input("please enter your name")
return self.i
def chg_budget(self):
self.i = input("Now, how big is your budget? ")
return self.i
def chg_use_case(self):
""""""
print("""Now we need some information regarding your intended use-case for this system.
o = Office-PC (you are editing documents, creating pdfs, browsing the web
c = Content Creation PC (you are editing videos, editing photos or other similarly intense workloads
g = Gaming-PC (You are playing games, maybe streaming as well?)
""")
self.i = input("Choose your use-case from above")
return self.i
def chg_os(self):
print("""simplePCBuilding offers the installation of different Operating Systems. You can choose from
following:
W10 = Windows 10
W11 = Windows 11
L = any Linux-Distro""")

65
bin/lib/csv_parsers.py Normal file
View File

@@ -0,0 +1,65 @@
"""@package docstring
This is a simplification of the csv module"""
import csv
class CsvRead:
"""This is a class that reads csv files and depending on the module selected does do different things with it"""
def __init__(self):
self.__imp = ""
self.__raw = ""
self.__raw_list = ""
def importing(self, path):
"""Returns a list of the imported csv-file, requires path, either direct system path or relative path"""
self.__imp = open(path)
self.__raw = csv.reader(self.__imp, delimiter=',')
self.__raw_list = list(self.__raw)
return self.__raw_list
class CsvWrite:
"""This is a class that modifies csv files"""
def __init__(self):
self.__impl = []
self.__strpop = []
self.__removed = []
self.__removing = 0
self.__change = 0
self.__appending = 0
def rem_str(self, path, row):
"""Opens the csv-file in write mode which is specified as an argument either as direct or relative path"""
self.__impl = CsvRead.importing(path)
self.__removed = self.__impl.pop(row)
with open(path, "w") as removedata:
self.__removing = csv.writer(removedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
self.__removing.writerow(self.__removed)
def chg_str(self, path, row, pos, new_value):
"""Opens the csv-file in write mode to change a value, e.g. if a recipes is changed."""
self.__impl = CsvRead.importing(path)
self.__strpop = self.__impl.pop(row)
self.__strpop.remove(pos)
self.__strpop.insert(pos, new_value)
self.__impl.insert(row, self.__strpop)
with open(path, "w") as changedata:
self.__change = csv.writer(changedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
self.__change.writerow(self.__impl)
def app_str(self, path, value):
"""Opens the csv-file in append mode and writes given input. CsvWrite.app_str(path, value).
Path can be specified both as direct or relative. value is a list. Will return an error if type of value is
not a list."""
with open(path, "a") as appenddata:
self.__appending = csv.writer(appenddata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
self.__appending.writerow(value)
def initialize(self):
with open("../../data/ingredients/ingredients.csv", "w") as initializedata:
self.__creating = csv.writer(initializedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
self.__creating.writerow(["Setup-Success"])
with open("../../data/recipes/recipes.csv", "w") as initializedata:
self.__creating = csv.writer(initializedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
self.__creating.writerow(["Setup-Success"])

View File

@@ -0,0 +1,18 @@
"""@package docstring
This module configures PCs but relies heavily on external modules that are included with the package.
"""
class ConfigCreator:
def __init__(self):
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!
""")

0
bin/modules/updater.py Normal file
View File

View File

@@ -0,0 +1,36 @@
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import Screen, ScreenManager
from kivy.uix.popup import Popup
class MainScreen(Screen):
pass
class AddComponent(Screen):
pass
class ModifyComponent(Screen):
pass
class RemoveComponent(Screen):
pass
class RootScreen(ScreenManager):
pass
kv = Builder.load_file("../gui/gui.kv")
class ComponentManager(App):
def build(self):
return kv
if __name__ == "__main__":
ComponentManager().run()

View File

@@ -0,0 +1,55 @@
import datetime
import csv
"""@package docstring
This software / package is used to easily manage the available products. This software will automatically update
whenever there is an update for the reader available on the website.
--------
NOTE: This software changes files in the directory in which it is located and as such is not made for
inexperienced users. Please read the readme.txt file for further notice.
NOTE: This software does not feature a standard gui (Graphical User Interface) currently and as such is
based on commands. You cna find a full lists of commands on the wiki.
NOTE: The simplePCBuilding-Configurator comes with an Update service for the component list. In the event of
an Update, there is a script installed with your software that merges the new updates to the components file
with the changes you made.
NOTE: Changing the CSV-File containing the component information with any other editor other than this one,
the file might get unreadable for the software. Do always use this software here to change something.
"""
version = str("alpha 1.0")
print("""
================================================================
Welcome to the simplePCBuilding PC-Configurator-Package-Manager!
You are currently running""", version, """!
================================================================
This software is used to easily manage the available products. This software will automatically update
whenever there is an update for the reader available on the website.
--------
NOTE: This software changes files in the directory in which it is located and as such is not made for
inexperienced users. Please read the readme.txt file for further notice.
NOTE: This software does not feature a standard gui (Graphical User Interface) currently and as such is
based on commands. You cna find a full lists of commands on the wiki.
NOTE: The simplePCBuilding-Configurator comes with an Update service for the component list. In the event of
an Update, there is a script installed with your software that merges the new updates to the components file
with the changes you made.
NOTE: Changing the CSV-File containing the component information with any other editor other than this one,
might result in loss of correct operation of the software. Do always use this software here to change something.
""")
i = input("Please read above carefully and type a y to continue, a \"n\" to exit the software:")
if i == "y":
print("Starting...")
else:
print("Leaving...")

View File

@@ -0,0 +1,57 @@
RootScreen:
MainScreen:
AddComponent:
RemoveComponent:
ModifyComponent:
<MainScreen>:
name: "Main"
GridLayout:
cols:1
Label:
text: "Welcome to the simplePCBuilding\n PC-Configuration-Suite\n Component-Manager!"
font_size:30
color: (0,0,1,0.6)
FloatLayout:
GridLayout:
size_hint: 0.9, 0.9
pos_hint:{"x":0.05, "y":0.05}
cols:3
Button:
text: "New Component"
on_release:
app.root.current = "NewComp"
root.manager.transition.direction = "right"
Button:
text: "Modify Component"
on_release:
app.root.current = "ModComp"
root.manager.transition.direction = "down"
Button:
text: "Remove Component"
on_release:
app.root.current = "RemComp"
root.manager.transition.direction = "left"
<AddComponent>:
name: "NewComp"
GridLayout:
cols:1
Label:
text: "New Component"
<ModifyComponent>:
name: "ModComp"
GridLayout:
cols:1
Label:
text: "Modify Component"
<RemoveComponent>:
name: "RemComp"
GridLayout:
cols:1
Label:
text: "Remove Component"

View File

@@ -0,0 +1,90 @@
"""@package docstring
This package extracts prices from websites. Currently, the package only allows for extraction of prices from
https://digitec.ch/"""
import requests
import csv
import datetime
class PriceExtractor:
def __init__(self):
with open("../../data/prices.csv", "w") as pricedata:
self.__writing = csv.writer(pricedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
self.__writing.writerow(["version from", datetime.datetime.now()])
self.__imp = open("../../data/products.csv", "r")
self.__raw_imp = csv.reader(self.__imp, delimiter=',')
self.__raw_list = list(self.__raw_imp)
self.__productcount = len(self.__raw_list)
print("needing to update", self.__productcount, "prices")
self.__productnumber = 0
self.__website = ""
self.__ingest = ""
self.__res = ""
self.__priceIdx = 0
self.__check = 0
self.__request_done = ""
self.__raw_price = ""
self.__price = 0
self.__price_extract = 0
def readfile(self, filename):
"""Reads a new file that contains links in csv format. Arguments:
Filename. Either specify full path (e.g. /home/[username]/price_extractor/prices.csv), relative path when
inside the folder of the executable (e.g. /pricedata/prices2.csv) or inside another folder that is located in
the parent folder (e.g. ../pricedata/prices3.csv).
Returns the content of the file inside of a list.
Example: prices = PriceExtractor.readfile(/pricedata/prices2.csv) (NOTE: prices is a list in this case!)"""
with open(filename, "w") as pricedata:
self.__writing = csv.writer(pricedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
self.__writing.writerow(["version from", datetime.datetime.now()])
self.__imp = open("../../data/products.csv", "r")
self.__raw_imp = csv.reader(self.__imp, delimiter=',')
self.__raw_list = list(self.__raw_imp)
self.__productcount = len(self.__raw_list)
print("needing to update", self.__productcount, "prices")
self.__productnumber = 0
return self.__raw_list
def chg_website(self, website):
"""Change the website (exact URL to product on https://digitec.ch/ only currently). Arguments:
Website. Only put direct link to product on digitec. Will return an error if a link other than digitec is
specified, though might work if the website structure is similar.
Example: PriceExtractor.chg_website(https://www.digitec.ch/de/s1/product/asus-radeon-rx-6600-dual-8-gb-grafikkarte-16833213)"""
self.__website = website
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 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])
digitec_ext = PriceExtractor()
digitec_ext.digitec_extractor()

View File

@@ -0,0 +1,45 @@
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])

5
data/prices.csv Normal file
View File

@@ -0,0 +1,5 @@
version from,2022-02-17 09:30:53.233664
1,559.0
2,290.0
3,9.2
4,359.0
1 version from 2022-02-17 09:30:53.233664
2 1 559.0
3 2 290.0
4 3 9.2
5 4 359.0

2
data/prices/cpu_p.csv Normal file
View File

@@ -0,0 +1,2 @@
simplePCBuilding-CPU-Price-Library
ID, DIGITEC-Price,
1 simplePCBuilding-CPU-Price-Library
2 ID, DIGITEC-Price,

View File

@@ -0,0 +1,3 @@
simplePCBuilding-Cooler-Listing
ID,MANUFACTURER,COOLERTYPE,NAME,Mounting_Kit,MAXTDP,Height,WidthX,WidthY,FAN_SIZE,FAN_COUNT,
1,Noctua,Air-Tower,NH-U12S Redux,,120,,,,120,1,
1 simplePCBuilding-Cooler-Listing
2 ID,MANUFACTURER,COOLERTYPE,NAME,Mounting_Kit,MAXTDP,Height,WidthX,WidthY,FAN_SIZE,FAN_COUNT,
3 1,Noctua,Air-Tower,NH-U12S Redux,,120,,,,120,1,

View File

@@ -0,0 +1,3 @@
simplePCBuilding-CPU-data-Library
ID,DIGITEC-LINK,MANUFACTURER,SOCKET,ARCHITECTURE,SERIES,EARLIEST_COMPATIBLE_CHIPSET,TDP,FULL_NAME
1,,AMD,AM4,Zen3,Ryzen 5000,B450,65,AMD Ryzen 5 5600X
1 simplePCBuilding-CPU-data-Library
2 ID,DIGITEC-LINK,MANUFACTURER,SOCKET,ARCHITECTURE,SERIES,EARLIEST_COMPATIBLE_CHIPSET,TDP,FULL_NAME
3 1,,AMD,AM4,Zen3,Ryzen 5000,B450,65,AMD Ryzen 5 5600X

View File

View File

@@ -0,0 +1,3 @@
simplePCBuilding-Motherboard-data-Library
ID,SOCKET,CHIPSET,SIZE,RAM_SUPPORT,MaxRAMCapacity,PCIeSLOTS(x16),NVMeSLOTS,FAN_HEADERS,ARGB_HEADERS,RGB12V_Headers,WiFi,S-ATA-CONNECTORS,F_USB_3.x,F_USB_2.x,F_USB_C,EPS12V_Pins
1,AM4,Z590,ATX,DDR4-3200,128,2,2,4,2,2,y,6,2,3,0,12
1 simplePCBuilding-Motherboard-data-Library
2 ID,SOCKET,CHIPSET,SIZE,RAM_SUPPORT,MaxRAMCapacity,PCIeSLOTS(x16),NVMeSLOTS,FAN_HEADERS,ARGB_HEADERS,RGB12V_Headers,WiFi,S-ATA-CONNECTORS,F_USB_3.x,F_USB_2.x,F_USB_C,EPS12V_Pins
3 1,AM4,Z590,ATX,DDR4-3200,128,2,2,4,2,2,y,6,2,3,0,12

View File

4
data/products.csv Normal file
View File

@@ -0,0 +1,4 @@
1,https://www.digitec.ch/de/s1/product/asus-radeon-rx-6600-dual-8-gb-grafikkarte-16833213
2,https://www.digitec.ch/de/s1/product/amd-ryzen-5-5600x-am4-370-ghz-6-core-prozessor-13987919
3,https://www.digitec.ch/de/s1/product/thermal-grizzly-kryonaut-1250-wm-k-1-g-waermeleitmittel-5614395
4,https://www.digitec.ch/de/s1/product/apple-ipad-2021-9-gen-1020-64-gb-space-grey-tablet-16644686
1 1 https://www.digitec.ch/de/s1/product/asus-radeon-rx-6600-dual-8-gb-grafikkarte-16833213
2 2 https://www.digitec.ch/de/s1/product/amd-ryzen-5-5600x-am4-370-ghz-6-core-prozessor-13987919
3 3 https://www.digitec.ch/de/s1/product/thermal-grizzly-kryonaut-1250-wm-k-1-g-waermeleitmittel-5614395
4 4 https://www.digitec.ch/de/s1/product/apple-ipad-2021-9-gen-1020-64-gb-space-grey-tablet-16644686

View File

@@ -0,0 +1,13 @@
--------------
MOTHERBOARDS
--------------
Require following:
SOCKET: (Such as AM4, AM5, LGA 1200, LGA 1700)
CHIPSET: (Such as AMD-B550, AMD-X570, Intel-Z690)
SIZE: (Such as ATX, E-ATX, mATX)
RAM_SUPPORT: (Such as DDR4-3200)
PCIeSLOTS: (e.g. 2x16 1x8 1x4, 1x16 1x8)
NVMeSLOTS: (e.g. 2xM-Key 1xB+M-Key, 2xM-Key)
FAN_HEADERS: (e.g. 2)
ARGB_HEADERS
F_CONNECTORS: (LIST!!!)

45
old/price_extractor.py Normal file
View File

@@ -0,0 +1,45 @@
#IMPORTS
import requests
import csv
import datetime
with open("prices.csv", "w") as pricedata:
writing = csv.writer(pricedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
writing.writerow(["version from", datetime.datetime.now()])
#reading of Product-CSV-File; Variable definition
imp = open("products.csv","r")
raw_imp = csv.reader(imp, delimiter=',')
raw_list = list(raw_imp)
productcount = len(raw_list)
print("needing to update",productcount, "prices")
productnumber = 0
#DATA-RECIEVING
while productnumber < productcount:
ingest = raw_list.pop(0)
website = ingest.pop(1)
productnumber = int(ingest.pop(0))
print("fetching data... This step might take a couple of seconds")
res = requests.get(website)
print("recieved data from", website)
check = str(res)
if check == "<Response [404]>":
print("Ressource unavailable, skipping..")
else:
request_done = res.text
priceIdx = request_done.index('property="product:price:amount')
raw_price = request_done[priceIdx+41:priceIdx+60]
price_extract = ""
for buchstabe in raw_price:
if buchstabe == "\"":
break
else:
price_extract += buchstabe
price = float(price_extract)
print("The price is following: ", price, "CHF\n")
with open("prices.csv", "a") as pricedata:
writing = csv.writer(pricedata, delimiter=',', quoting=csv.QUOTE_MINIMAL)
writing.writerow([productnumber, price])

View File

@@ -0,0 +1,69 @@
# This is the main runtime of the simplePCBuilding-PC-Configurator
# IMPORTS
import time
version = "alpha 1.0"
print("""
--------------------------------------------------------------------
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)
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:
if i == "c":
print("starting configurator...")
go = 0
elif i == "u":
print("starting updater...")
go = 0
elif i == "p":
print("starting package manager...")
go = 0
elif i == "q":
print("killing processes....")
time.sleep(0.5)
print("Terminating...")
go = 0
else:
print("\nUnknown entry, please retry.\n ")
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
""")
i = input("Please select a module and type in the corresponding letter: ")

34
test.py Normal file
View File

@@ -0,0 +1,34 @@
class Human():
def __init__(self, price, name="n/a"):
print("human created")
self.age = 0
self.numberOfLegs = 2
self.name = name
def setName(self, name):
self.name = name
def getName(self):
return self.name
def __str__(self):
ret = " "
ret += "\n Name: "
ret += self.name
ret += "\n Age:"
ret += str(self.age)
return ret
class Lumberjack(Human):
def __init__(self):
print("Lumberjack created")
#ruft den Konstruktor der Oberklasse auf
Human.__init__(self, 300)
myL = Lumberjack()
print(myL.name)
#doxygen --> For documentation