diff --git a/README.md b/README.md index 958e310..aaba3fb 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,7 @@ Simple library to see your computer's spec information. - CPU Core Count - Swap, Total, and Used RAM - OS Name -- More... \ No newline at end of file +- More... + +# Graphs +PySys is able to display information with a simple bar graph in the termaial. \ No newline at end of file diff --git a/__pycache__/gui.cpython-310.pyc b/__pycache__/gui.cpython-310.pyc new file mode 100644 index 0000000..d71dc8d Binary files /dev/null and b/__pycache__/gui.cpython-310.pyc differ diff --git a/__pycache__/pysys.cpython-310.pyc b/__pycache__/pysys.cpython-310.pyc new file mode 100644 index 0000000..93058b3 Binary files /dev/null and b/__pycache__/pysys.cpython-310.pyc differ diff --git a/gui.py b/gui.py new file mode 100644 index 0000000..79dde0a --- /dev/null +++ b/gui.py @@ -0,0 +1,73 @@ +from pysys import * + + +graph = None + +class Graphs: + def __init__(self, nameOfGraph, percentUsed): + self.nameOfGraph = str(nameOfGraph) + self.percentUsed = percentUsed + + def basicInfoGraph(self): + if self.percentUsed <= 10.0: + graph = "#|||||||||" + print(f"{self.nameOfGraph} {graph} {self.percentUsed}") + elif self.percentUsed <= 20.0 and self.percentUsed > 10.0: + graph = "##||||||||" + print(f"{self.nameOfGraph} {graph} {self.percentUsed}") + elif self.percentUsed <= 30.0 and self.percentUsed > 20.0: + graph = "###|||||||" + print(f"{self.nameOfGraph} {graph} {self.percentUsed}") + elif self.percentUsed <= 40.0 and self.percentUsed > 30.0: + graph = "####||||||" + print(f"{self.nameOfGraph} {graph} {self.percentUsed}") + elif self.percentUsed <= 50.0 and self.percentUsed > 60.0: + graph = "#####|||||" + print(f"{self.nameOfGraph} {graph} {self.percentUsed}") + elif self.percentUsed <= 60.0 and self.percentUsed > 50.0: + graph = "######||||" + print(f"{self.nameOfGraph} {graph} {self.percentUsed}") + elif self.percentUsed <= 70.0 and self.percentUsed > 60.0: + graph = "#######|||" + print(f"{self.nameOfGraph} {graph} {self.percentUsed}") + elif self.percentUsed <= 80.0 and self.percentUsed > 70.0: + graph = "########||" + print(f"{self.nameOfGraph} {graph} {self.percentUsed}") + elif self.percentUsed <= 90.0 and self.percentUsed > 80.0: + graph = "#########|" + print(f"{self.nameOfGraph} {graph} {self.percentUsed}") + else: + graph = "##########" + print(f"{self.nameOfGraph} {graph} {self.percentUsed}") + + def onlyDrawGraph(self): + if self.percentUsed <= 10.0: + graph = "#|||||||||" + print(f"{graph}") + elif self.percentUsed <= 20.0 and self.percentUsed > 10.0: + graph = "##||||||||" + print(f"{graph}") + elif self.percentUsed <= 30.0 and self.percentUsed > 20.0: + graph = "###|||||||" + print(f"{graph}") + elif self.percentUsed <= 40.0 and self.percentUsed > 30.0: + graph = "####||||||" + print(f"{graph}") + elif self.percentUsed <= 50.0 and self.percentUsed > 60.0: + graph = "#####|||||" + print(f"{graph}") + elif self.percentUsed <= 60.0 and self.percentUsed > 50.0: + graph = "######||||" + print(f"{graph}") + elif self.percentUsed <= 70.0 and self.percentUsed > 60.0: + graph = "#######|||" + print(f"{graph}") + elif self.percentUsed <= 80.0 and self.percentUsed > 70.0: + graph = "########||" + print(f"{graph}") + elif self.percentUsed <= 90.0 and self.percentUsed > 80.0: + graph = "#########|" + print(f"{graph}") + else: + graph = "##########" + print(f"{graph}") \ No newline at end of file diff --git a/pysys.py b/pysys.py index e1ce13a..49d036d 100644 --- a/pysys.py +++ b/pysys.py @@ -7,31 +7,31 @@ class CPU: # CPU Core Count def cpuCoreCount(): - print(f"Core Count: {os.cpu_count()}") + return os.cpu_count() # Processor/CPU Type def processorType(): - print(f"Processor: {platform.processor()}") + return platform.processor() # Computer Architecture def computerArchitecture(): - print(f"Architecture: {platform.architecture()}") + return platform.architecture() # Physcial CPU Cores def phyicalCoresCPU(): - print(psutil.cpu_count(True)) + return psutil.cpu_count(True) # Logical CPU Cores def logicalCoresCPU(): - print(psutil.cpu_count(False)) + return psutil.cpu_count(False) # Overall CPU Usage def CPUsage(): - print(f"CPU Usage: {psutil.cpu_percent()}%") + return psutil.cpu_percent() class OSType: def OS(): - print(f"OS: {platform.system()}") + return platform.system() class RAM: # Overall RAM Usage @@ -39,16 +39,13 @@ def RAMUsage(): ram = np.round(psutil.virtual_memory().used/1000000000, 1) totalRAM = np.round(psutil.virtual_memory().total/1000000000, 2) swap = np.round(psutil.swap_memory().used/1000000000, 1) - print(f"RAM Usage: {ram} GB / {totalRAM} GB\nSwap Memory: {swap} GB") + return ram, totalRAM, swap def swapMemory(): - swap = np.round(psutil.swap_memory().used/1000000000, 1) - print(f"Swap Memory: {swap} GB") + return np.round(psutil.swap_memory().used/1000000000, 1) def totalRAM(): - totalRAM = np.round(psutil.virtual_memory().total/1000000000, 2) - print(f"Total RAM: {totalRAM} GB") + return np.round(psutil.virtual_memory().total/1000000000, 2) def usedRAM(): - usedRAM = np.round(psutil.virtual_memory().used/1000000000, 1) - print(f"Used RAM: {usedRAM} GB") \ No newline at end of file + return np.round(psutil.virtual_memory().used/1000000000, 1) \ No newline at end of file