Optimised, loading of data.

This commit is contained in:
mrmarcus007
2023-04-27 15:03:24 +01:00
parent 5ac798011d
commit 862a2e9b48
8 changed files with 56 additions and 19 deletions
+55 -19
View File
@@ -1,22 +1,57 @@
import graphics, time, os, platform, json import graphics, time, os, platform, json
System = ()
PCname = ()
CPUPowerLimit = ()
CPUClock = ()
Processor = ()
Gprocessor = ()
GPUpowerLimit = ()
GPUClock = ()
GPUMemoryClock = ()
BusClock = ()
RyzenADJI = ()
USBdevices = ()
TotalUSBpower = ()
TotalPower = ()
def start(): def start():
os.system('cls') os.system('cls')
print(graphics.Overclock) print(graphics.Overclock)
print(graphics.Rever) print(graphics.Rever)
time.sleep(2) time.sleep(2)
try: try:
load()
configdisplay() configdisplay()
time.sleep(5) input("press any key to go to the menu")
Menu() Menu()
except: except:
print("This is first time setup, please wait...") print("This is first time setup, please wait...")
time.sleep(5) time.sleep(5)
editor() editor()
def load():
global System, PCname, CPUPowerLimit, CPUClock, Processor, Gprocessor, GPUpowerLimit, GPUClock, GPUMemoryClock, BusClock, RyzenADJI, USBdevices, TotalUSBpower, TotalPower
with open("Configuationtable.json", "r") as file:
data = json.loads(file.read())
System = (data["System"])
PCname = (data["PCname"])
CPUPowerLimit = (data["CPUPowerLimit"])
CPUClock = (data["CPUClock"])
Processor = (data["Processor"])
Gprocessor = (data["Gprocessor"])
GPUpowerLimit = (data["GPUpowerLimit"])
GPUClock = (data["GPUClock"])
GPUMemoryClock = (data["GPUMemoryclock"])
BusClock = (data["BusClock"])
RyzenADJI = (data["RyzenADJI"])
USBdevices = (data["USBdevices"])
TotalUSBpower = (data["TotalUSBPower"])
TotalPower = (data["TotalPower"])
def Menu(): def Menu():
os.system('cls') os.system('cls')
print(graphics.Menu) print("="*40, "\n", graphics.Menu, "\n", graphics.Rever, "\n", "="*40)
print(" 1. View current configuration \n 2. Edit configuration \n 3. export configuration \n 4. exit program") print(" 1. View current configuration \n 2. Edit configuration \n 3. export configuration \n 4. exit program")
choice = input(" user: ") choice = input(" user: ")
if choice == "1": if choice == "1":
@@ -69,26 +104,27 @@ def editor():
} }
with open("Configuationtable.json", "w") as file: with open("Configuationtable.json", "w") as file:
file.write(json.dumps(data)) file.write(json.dumps(data))
load()
Menu() Menu()
def configdisplay(): def configdisplay():
with open("Configuationtable.json", "r") as file: os.system("cls")
data = json.loads(file.read()) print("="*5, "last Saved Configuation/System Information", "="*5, "\n")
print("="*40, "last Saved Configuation/System Information", "="*40, "\n") print(" System: ", System)
print(" System: ", data["System"]) print(" PC Name: ", PCname)
print(" PC Name: ", data["PCname"]) print("\n Processor: ", Processor)
print("\n Processor: ", data["Processor"]) print(" Processor Power Limit: ", CPUPowerLimit, "W")
print(" Processor Power Limit: ", data["CPUPowerLimit"], "W") print(" Processor clock: ", CPUClock, "Ghz")
print(" Processor clock: ", data["CPUClock"], "Ghz") print(" Bus clock: ", BusClock, "Mhz")
print(" Bus clock: ", data["BusClock"], "Mhz") print("\n GPU: ", Gprocessor)
print("\n GPU: ", data["Gprocessor"]) print(" GPU Power Limit: ", GPUpowerLimit, "W")
print(" GPU Power Limit: ", data["GPUpowerLimit"], "W") print(" GPU Clock: ", GPUClock, "Mhz")
print(" GPU Clock: ", data["GPUClock"], "Mhz") print(" GPU memory clock: ", GPUMemoryClock, "Mhz")
print("\n Ryzen ADJI, ", data["RyzenADJI"]) print("\n Ryzen ADJI, ", RyzenADJI)
print("\n Static USB devices:", data["USBdevices"]) print("\n Static USB devices:", USBdevices)
print(" Total USB power: ", data["TotalUSBPower"]) print(" Total USB power: ", TotalUSBpower)
print("\n Totalpower: ", data["TotalPower"]) print("\n Totalpower: ", TotalPower)
print(graphics.Rever) print(graphics.Rever)
def export(): def export():
with open("Configuationtable.json", "r") as file: with open("Configuationtable.json", "r") as file:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
[]