From 0a1e915a6c4ba23daa86d0eec735a54fbc793a60 Mon Sep 17 00:00:00 2001 From: DMInnovations Date: Mon, 11 Dec 2023 16:30:31 -0700 Subject: [PATCH] v2.0 --- README.md | 5 +- __pycache__/gui.cpython-310.pyc | Bin 0 -> 2067 bytes __pycache__/pysys.cpython-310.pyc | Bin 0 -> 2239 bytes gui.py | 73 ++++++++++++++++++++++++++++++ pysys.py | 25 +++++----- 5 files changed, 88 insertions(+), 15 deletions(-) create mode 100644 __pycache__/gui.cpython-310.pyc create mode 100644 __pycache__/pysys.cpython-310.pyc create mode 100644 gui.py 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 0000000000000000000000000000000000000000..d71dc8d2737af764f2bba311b4cfd98b940f18de GIT binary patch literal 2067 zcmb7FO-oxr6rFh=$ulvD##sB^*mjc^>_S&kM5vIuXl$|VB7{C-Cfd||btXX~DF_Pw z0GHC0Aowf%AJ1hMrN2OM)pO^)q|pYN4!n~$_nvcSCUft*jaV$gFzz1jlsn^${h-O< zFfm!iqaFeT6THgaGhyU;mI+f>2TWM|M&1y{I?LFWDWJ^q zTrkMEFb-JW^h4z>VT%yvwg@Af4$5-geeIs<73r%r!fnwkqWT<3%)0Cg{@!gaXN2*Mw{W5_#xefnF4qX}G5c=sbB=3R_t_TM^MTHi z^THlc7lLk0>#S`{u8Hu7ItRLKtqVc7EyhOFMW8#>x+rvqVthnh6uJ|wi$HfGVk7F} z(4F_!I~R!&braBCXk8rZU5LpMbxG(hwQd5sOEL9tok;zglbO!_^wZ_(@>S$Xw>Ngp zbUGb)7Rb|g1;!<9>{$cjif;_8fpK*?c*zA`-%T-T(271`?_H0et%2(OA0xN{^W%W= zNw*h@!evZdXP(`Zm3m7T-kBl8IHPB8QK{?t^I?pv@r|OYlveAT4P8o6*wi8*!Y!WW zssBXFNb}w4peV0L{;M?mpO{Z5T79)tn(?4CQIgjR(S&a{U|DijSo(5rvTU#xG|NPq zEQruhRv4_TX4zn6g)@{j23B6Ps5J5-I+R6)SJSL9uxdf!-P~6Uti67$JrN%oD*@J# zX2lTeNK6c6O@ei*SqZRCMe-&qD2{dR?@ zTLd!%w+ZeL+$Fe2aG&4-AY_QLlDZWN}9)$8$LQX%^RM_CIJD zalV@h((GE`TqZ=lf;y7xdJ)&HHAK5g@8hofwOy?G9!V`(&JsNC@ALYOCAC3nAByY_ qbGT!Tr?nM*&2Dy7N69o?+B9%n9Y)ud^U_~^iMo=aSPrwyr12ZDw6g{P literal 0 HcmV?d00001 diff --git a/__pycache__/pysys.cpython-310.pyc b/__pycache__/pysys.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..93058b3e41f9795184aef468905ecb098e683ab3 GIT binary patch literal 2239 zcma)8OK;mo5MI8iXP$MFrjPWMglXZTJ+?vNKtyPKjZHKXcz$`x& zF+23hAra2Fk+QH}jnL4%8Jc>vLi+*ZCbwQNZvAeC4skYjh;xW@iF3I}oJX9;jS&m{ z6SB#MG3fGR60<{}yhkKq@IyWfZoXil#Vu~rN|w1xtHV9+)9UgTZ`11W4)4Sjk;mWS`Yv|pzjn>qe9#`Ld%%LN5`ge z3t5%ZRJgFbD9{r83&s9?8c$N>UXs(dU<#>k8wXc(3Rd+S{fj;wBCp?z3mbi<`O{@z z*Rk<3k=oO1+BHvz3P_jhEH08D?4S*cM8wo!jVL`rA}3Fi_i$X7w*zcv(qYh2eiY3n zSrSF69YtBrs}#SxQS?hSNo$QjTZ%4-ZWCRtD`2mJG-OvGWXL6w<1^p%?fUK7TGxni z2M1ts{X$b+ZRPHb(5j7R*YbmQR4!ezGRc}kROa63L)uekrB$2W-Wv@ATc8)j7RcKm z?|?L+yhe(f^hw-3pLGoZNn?CF*!DS*b!?l46=7~G>!D+VpH0e1i_eCkR2L_<`WA^9-gqj|NQ2}Aj2mpV&ExrRwzf% zc;dS0RR7nhD5*K3EXi^)S9T>6uADM2C#mYl=ab@06Ih`oCYkcJihzVRv`eYfgUBb1 zZqi$T1ksj(mo8$LRNLq3l{C<a(X&!83%m?^-8rdEODC-1?K_04`wX@-GLu(2ta&FiZ7tNOQcT5c`EG?dx3h100e=G&p;aTC~lAfnU)wpdKkFA)wQ%d x@CE%(!Sr8`dZszEDl6u7rO<);PU*c(#+84s9$Md`WzWZr;nUl<`qwYp{{f${moNYT literal 0 HcmV?d00001 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