Skip to content

Commit

Permalink
v2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MitchellShibilski-Unkel committed Dec 11, 2023
1 parent 04723a9 commit 0a1e915
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 15 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ Simple library to see your computer's spec information.
- CPU Core Count
- Swap, Total, and Used RAM
- OS Name
- More...
- More...

# Graphs
PySys is able to display information with a simple bar graph in the termaial.
Binary file added __pycache__/gui.cpython-310.pyc
Binary file not shown.
Binary file added __pycache__/pysys.cpython-310.pyc
Binary file not shown.
73 changes: 73 additions & 0 deletions gui.py
Original file line number Diff line number Diff line change
@@ -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}")
25 changes: 11 additions & 14 deletions pysys.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,45 @@
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
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")
return np.round(psutil.virtual_memory().used/1000000000, 1)

0 comments on commit 0a1e915

Please sign in to comment.