Made data exportable to text file

This commit is contained in:
mrmarcus007
2023-01-19 20:37:55 +00:00
parent 46e07aa120
commit 0f4bece95a
3 changed files with 54 additions and 7 deletions
+1 -1
View File
@@ -1 +1 @@
{"PCname": "Legion-5", "System": "Windows 10.0.22000", "Processor": "AMD64 Family 23 Model 96 Stepping 1, AuthenticAMD", "CPUPowerLimit": "50", "CPUClock": 4.5, "BusClock": 100.0, "Gprocessor": "1650s", "GPUpowerLimit": 50.0, "GPUClock": 6685.0, "GPUMemoryclock": 6685.0, "RyzenADJI": "", "USBdevices": 4, "TotalUSBPower": 18.0} {"PCname": "Legion-5", "System": "Windows 10.0.22000", "Processor": "AMD64 Family 23 Model 96 Stepping 1, AuthenticAMD", "CPUPowerLimit": "50", "CPUClock": 4.0, "BusClock": 100.0, "Gprocessor": "1650s", "GPUpowerLimit": 50.0, "GPUClock": 1785.0, "GPUMemoryclock": 6685.0, "RyzenADJI": "", "USBdevices": 4, "TotalUSBPower": 18.0, "TotalPower": 134.0}
+34 -6
View File
@@ -17,7 +17,7 @@ def start():
def Menu(): def Menu():
os.system('cls') os.system('cls')
print(graphics.Menu) print(graphics.Menu)
print(" 1. View current configuration \n 2. Edit configuration \n 3. 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":
os.system('cls') os.system('cls')
@@ -28,6 +28,8 @@ def Menu():
os.system('cls') os.system('cls')
editor() editor()
elif choice == "3": elif choice == "3":
export()
elif choice == "4":
existstage1() existstage1()
else: else:
Menu() Menu()
@@ -38,7 +40,7 @@ def editor():
print(graphics.Warning) print(graphics.Warning)
print(" You are edting data!") print(" You are edting data!")
print("Don't use units") print("Don't use units")
CPUPowerLimit = str(input("CPU Power Limit (W): ")) CPUPowerLimit = float(input("CPU Power Limit (W): "))
CPUClock = float(input("CPU Clock (Ghz): ")) CPUClock = float(input("CPU Clock (Ghz): "))
Gprocessor = input("GPU: ") Gprocessor = input("GPU: ")
GPUpowerLimit = float(input("GPU power limit (W): ")) GPUpowerLimit = float(input("GPU power limit (W): "))
@@ -47,7 +49,8 @@ def editor():
BusClock = float(input("Bus Clock (Mhz): ")) BusClock = float(input("Bus Clock (Mhz): "))
RyzenADJI = input("Ryzen ADJI preset (if you have one, if not leave blank): ") RyzenADJI = input("Ryzen ADJI preset (if you have one, if not leave blank): ")
USBdevices = int(input("Amount of static USB devices: " )) USBdevices = int(input("Amount of static USB devices: " ))
TotalUSBpower = float(USBdevices * 4.5) TotalUSBpower = USBdevices * 4.5
TotalPower = (TotalUSBpower + GPUpowerLimit + CPUPowerLimit * 1.32)
data = { data = {
"PCname": my_system.node, "PCname": my_system.node,
"System": f"{my_system.system} {my_system.version}", "System": f"{my_system.system} {my_system.version}",
@@ -61,7 +64,8 @@ def editor():
"GPUMemoryclock": GPUMemoryClock, "GPUMemoryclock": GPUMemoryClock,
"RyzenADJI": RyzenADJI, "RyzenADJI": RyzenADJI,
"USBdevices": USBdevices, "USBdevices": USBdevices,
"TotalUSBPower": TotalUSBpower "TotalUSBPower": TotalUSBpower,
"TotalPower": TotalPower
} }
with open("Configuationtable.json", "w") as file: with open("Configuationtable.json", "w") as file:
file.write(json.dumps(data)) file.write(json.dumps(data))
@@ -81,10 +85,34 @@ def configdisplay():
print(" GPU Power Limit: ", data["GPUpowerLimit"], "W") print(" GPU Power Limit: ", data["GPUpowerLimit"], "W")
print(" GPU Clock: ", data["GPUClock"], "Mhz") print(" GPU Clock: ", data["GPUClock"], "Mhz")
print("\n Ryzen ADJI, ", data["RyzenADJI"]) print("\n Ryzen ADJI, ", data["RyzenADJI"])
print("\n USB devices", data["USBdevices"]) print("\n Static USB devices:", data["USBdevices"])
print(" Total usb power", data["TotalUSBPower"]) print(" Total USB power: ", data["TotalUSBPower"])
print("\n Totalpower: ", data["TotalPower"])
print(graphics.Rever) print(graphics.Rever)
def export():
with open("Configuationtable.json", "r") as file:
data = json.loads(file.read())
with open("config_data.txt", "w") as file:
file.write("="*40 + " last Saved Configuation/System Information " + "="*40 + "\n")
file.write(" System: " + data["System"] + "\n")
file.write(" PC Name: " + data["PCname"] + "\n")
file.write("\n Processor: " + data["Processor"] + "\n")
file.write(" Processor Power Limit: " + data["CPUPowerLimit"] + "W" + "\n")
file.write(" Processor clock: " + str(data["CPUClock"]) + "Ghz" + "\n")
file.write(" Bus clock: " + str(data["BusClock"]) + "Mhz" + "\n")
file.write("\n GPU: " + data["Gprocessor"] + "\n")
file.write(" GPU Power Limit: " + str(data["GPUpowerLimit"]) + "W" + "\n")
file.write(" GPU Clock: " + str(data["GPUClock"]) + "Mhz" + "\n")
file.write(" GPU Memory clock: " + str(data["GPUMemoryclock"]) + "Mhz" + "\n")
file.write("\n Ryzen ADJI: " + data["RyzenADJI"] + "\n")
file.write("\n Static USB devices: " + str(data["USBdevices"]) + "\n")
file.write(" Total USB power: " + str(data["TotalUSBPower"]) + "W" + "\n")
file.write(" Total Power: " + str(data["TotalPower"]) + "W" + "\n")
print(" Data exported to config")
input(" Press enter to continue")
Menu()
def existstage1(): def existstage1():
os.system('cls') os.system('cls')
print(graphics.Warning) print(graphics.Warning)
+19
View File
@@ -0,0 +1,19 @@
======================================== last Saved Configuation/System Information ========================================
System: Windows 10.0.22000
PC Name: Legion-5
Processor: AMD64 Family 23 Model 96 Stepping 1, AuthenticAMD
Processor Power Limit: 50W
Processor clock: 4.0Ghz
Bus clock: 100.0Mhz
GPU: 1650s
GPU Power Limit: 50.0W
GPU Clock: 1785.0Mhz
GPU Memory clock: 6685.0Mhz
Ryzen ADJI:
Static USB devices: 4
Total USB power: 18.0W
Total Power: 134.0W