From 09615c1b35bc08881d9e4980a582c8dc147e92d3 Mon Sep 17 00:00:00 2001 From: Diamond Rivero Date: Tue, 9 Jul 2024 22:33:28 +0800 Subject: [PATCH] redesign UI with fixes --- poetry.lock | 56 +++---- sysig.py | 425 +++++++++++++++++++++++++--------------------------- 2 files changed, 236 insertions(+), 245 deletions(-) diff --git a/poetry.lock b/poetry.lock index 8e63b46..7ece622 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,30 +1,30 @@ -# This file is automatically @generated by Poetry 1.8.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "dearpygui" -version = "1.11.0" +version = "1.11.1" description = "DearPyGui: A simple Python GUI Toolkit" optional = false python-versions = ">=3.7" files = [ - {file = "dearpygui-1.11.0-cp310-cp310-macosx_10_6_x86_64.whl", hash = "sha256:badb459bb6b27d4c9ecf3ac54f0c20b3a1ed5a6aeb674d3fc31f63840f0d7522"}, - {file = "dearpygui-1.11.0-cp310-cp310-macosx_13_0_arm64.whl", hash = "sha256:054ae6abf62ee98f8acc90087da967caccb5169815ea99f401b279c037c4f1b1"}, - {file = "dearpygui-1.11.0-cp310-cp310-manylinux1_x86_64.whl", hash = "sha256:32aa58c2036ce396960a62afaf1907e8eb8c08246af8d8c3a373e3c91a9f3bd2"}, - {file = "dearpygui-1.11.0-cp310-cp310-win_amd64.whl", hash = "sha256:258433d6f9cbeb8043f9226814963b0ca273ff8419475a7c5858c8518a0c6940"}, - {file = "dearpygui-1.11.0-cp311-cp311-macosx_10_6_x86_64.whl", hash = "sha256:57050f5910feec3d953ec7af52318de5b629a7150bef506f665c0b7529a3327f"}, - {file = "dearpygui-1.11.0-cp311-cp311-macosx_13_0_arm64.whl", hash = "sha256:4000bc53de198955d6bca6a30ef1f06dfeea592aa0c1481c8c37b58bd10c2196"}, - {file = "dearpygui-1.11.0-cp311-cp311-manylinux1_x86_64.whl", hash = "sha256:b54f92096e522b7ea84ddd3af3f7070418289258739f673c998e9c567610f118"}, - {file = "dearpygui-1.11.0-cp311-cp311-win_amd64.whl", hash = "sha256:22e082b8cbce43bc79c426b8d767c24cc54cda622783bf8f1374d957e0c11e8f"}, - {file = "dearpygui-1.11.0-cp312-cp312-macosx_10_6_x86_64.whl", hash = "sha256:4b2373e71d71aeffb3c57db59c88ec77cefec5744f0eb8a4b49ddd5327099954"}, - {file = "dearpygui-1.11.0-cp312-cp312-macosx_13_0_arm64.whl", hash = "sha256:4f594991b5d5ec5cf99f14a313206d6fa9b0d0690962dff5832ac8c22b37fece"}, - {file = "dearpygui-1.11.0-cp312-cp312-manylinux1_x86_64.whl", hash = "sha256:c6d566c7d9f836b2f345c787cd23852e74ad6cd0ea71a8e624a094a212cb1570"}, - {file = "dearpygui-1.11.0-cp312-cp312-win_amd64.whl", hash = "sha256:7e998e0c6d904f756692f2df58a1f0d0962af81663a0363e3ad7c3dc93ff38f6"}, - {file = "dearpygui-1.11.0-cp38-cp38-macosx_10_6_x86_64.whl", hash = "sha256:50b724eb4a46581137ada9a23a575e65e3b2d7a68518b83e5f4c3316eee7465c"}, - {file = "dearpygui-1.11.0-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:5f78bd922a856118e3974bb12ed86a23a1ba4d2d51db0a792c1d0f598b30bcec"}, - {file = "dearpygui-1.11.0-cp38-cp38-win_amd64.whl", hash = "sha256:32fdb6acdf488d54c4e2f76451265cd32a29e2e8394a24c1cc906102d788592c"}, - {file = "dearpygui-1.11.0-cp39-cp39-macosx_10_6_x86_64.whl", hash = "sha256:3f9d576097f95af36692be9282de5e272568ea5b68141e66613082991def8ed6"}, - {file = "dearpygui-1.11.0-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:27e3560b5c1276eae912e8862cbdeb3d92564b92cb4444717afec3fe4cc1ae76"}, - {file = "dearpygui-1.11.0-cp39-cp39-win_amd64.whl", hash = "sha256:d8eb2857c121703e4385c969c96d3255a3054780e6e45897284c2b40ab53eb58"}, + {file = "dearpygui-1.11.1-cp310-cp310-macosx_10_6_x86_64.whl", hash = "sha256:b668f28aab63d8ad0b2768add4e689bedb7480e8c3390edcce7a0f5d296fd61f"}, + {file = "dearpygui-1.11.1-cp310-cp310-macosx_13_0_arm64.whl", hash = "sha256:39d099b1ca97fd7d36934a5187fc4cd868d4772e504290a70fc95eda03c5125d"}, + {file = "dearpygui-1.11.1-cp310-cp310-manylinux1_x86_64.whl", hash = "sha256:3ba12334d993b653df2d07fe34c93c4ec65e54c022066ba245cd596a18b43a68"}, + {file = "dearpygui-1.11.1-cp310-cp310-win_amd64.whl", hash = "sha256:6cf4c44db1f016ff3eab367f7bde7f169bad5f2f90b974c202808112a69a2b15"}, + {file = "dearpygui-1.11.1-cp311-cp311-macosx_10_6_x86_64.whl", hash = "sha256:cc15cd13c1aeae2847ed9c4b2201169add3efdedf564eb706f5b5896ddaa5d8a"}, + {file = "dearpygui-1.11.1-cp311-cp311-macosx_13_0_arm64.whl", hash = "sha256:9eb7d581863d39543b213252041ed25856acbfa58c57291e6acb6ccbf0c2727b"}, + {file = "dearpygui-1.11.1-cp311-cp311-manylinux1_x86_64.whl", hash = "sha256:564ff3af657f7becd059b6611e162cc9cd8148befaf8aadb10e4fb76d57df3ef"}, + {file = "dearpygui-1.11.1-cp311-cp311-win_amd64.whl", hash = "sha256:ac6e9bde61dcb3cc253da59e70fe2b743d3c3b5791d415eaa8d307f4517048ca"}, + {file = "dearpygui-1.11.1-cp312-cp312-macosx_10_6_x86_64.whl", hash = "sha256:ccf576117ed2159cd66b419458d060923c9dcebe7fe57c65b4f4c4889287845d"}, + {file = "dearpygui-1.11.1-cp312-cp312-macosx_13_0_arm64.whl", hash = "sha256:1d632e1acdaa986a8c32b57112b84685b92d9a41f18580e14d463d7ed7a52673"}, + {file = "dearpygui-1.11.1-cp312-cp312-manylinux1_x86_64.whl", hash = "sha256:ca4f7ba667f64ee682dfcb3399d9d43df6821b2d962b96b4fa4535de5776f538"}, + {file = "dearpygui-1.11.1-cp312-cp312-win_amd64.whl", hash = "sha256:8ce9881a629de72e05ca8b1ce7cefcdd77b624eb7eba6f7d6629848d84a797f6"}, + {file = "dearpygui-1.11.1-cp38-cp38-macosx_10_6_x86_64.whl", hash = "sha256:39011ccb3a3ecfe3ebccfd8c4211c2c1446abd2865cbe4ccb67dc50a7a812bfb"}, + {file = "dearpygui-1.11.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:e1dde63d20ac062530debee001ad649190a7e09622762601454c4191799f13b8"}, + {file = "dearpygui-1.11.1-cp38-cp38-win_amd64.whl", hash = "sha256:23ce7ce8e5ba24d31bd6468cc43b56f8f257ace4dce3bc5fe449c546c340893a"}, + {file = "dearpygui-1.11.1-cp39-cp39-macosx_10_6_x86_64.whl", hash = "sha256:d22285f9a5f1377d87effd1f27020eec3ae0386f7c15a4893809909b82c62b1b"}, + {file = "dearpygui-1.11.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:f632bd94772e00313d0956bb9f9822c3ebcb7aa93f135f09e2fa187f3b06cea8"}, + {file = "dearpygui-1.11.1-cp39-cp39-win_amd64.whl", hash = "sha256:0c7c4849bc674e825750be69ee480450c3589c7d159955032776aaef5e7fda58"}, ] [[package]] @@ -39,13 +39,13 @@ files = [ [[package]] name = "humanize" -version = "4.9.0" +version = "4.10.0" description = "Python humanize utilities" optional = false python-versions = ">=3.8" files = [ - {file = "humanize-4.9.0-py3-none-any.whl", hash = "sha256:ce284a76d5b1377fd8836733b983bfb0b76f1aa1c090de2566fcf008d7f6ab16"}, - {file = "humanize-4.9.0.tar.gz", hash = "sha256:582a265c931c683a7e9b8ed9559089dea7edcf6cc95be39a3cbc2c5d5ac2bcfa"}, + {file = "humanize-4.10.0-py3-none-any.whl", hash = "sha256:39e7ccb96923e732b5c2e27aeaa3b10a8dfeeba3eb965ba7b74a3eb0e30040a6"}, + {file = "humanize-4.10.0.tar.gz", hash = "sha256:06b6eb0293e4b85e8d385397c5868926820db32b9b654b932f57fa41c23c9978"}, ] [package.extras] @@ -102,18 +102,18 @@ files = [ [[package]] name = "setuptools" -version = "69.1.1" +version = "69.5.1" description = "Easily download, build, install, upgrade, and uninstall Python packages" optional = false python-versions = ">=3.8" files = [ - {file = "setuptools-69.1.1-py3-none-any.whl", hash = "sha256:02fa291a0471b3a18b2b2481ed902af520c69e8ae0919c13da936542754b4c56"}, - {file = "setuptools-69.1.1.tar.gz", hash = "sha256:5c0806c7d9af348e6dd3777b4f4dbb42c7ad85b190104837488eab9a7c945cf8"}, + {file = "setuptools-69.5.1-py3-none-any.whl", hash = "sha256:c636ac361bc47580504644275c9ad802c50415c7522212252c033bd15f301f32"}, + {file = "setuptools-69.5.1.tar.gz", hash = "sha256:6c1fccdac05a97e598fb0ae3bbed5904ccb317337a51139dcd51453611bbb987"}, ] [package.extras] -docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"] -testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "packaging (>=23.2)", "pip (>=19.1)", "pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-home (>=0.5)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff (>=0.2.1)", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] +docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"] +testing = ["build[virtualenv]", "filelock (>=3.4.0)", "importlib-metadata", "ini2toml[lite] (>=0.9)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "mypy (==1.9)", "packaging (>=23.2)", "pip (>=19.1)", "pytest (>=6,!=8.1.1)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-home (>=0.5)", "pytest-mypy", "pytest-perf", "pytest-ruff (>=0.2.1)", "pytest-timeout", "pytest-xdist (>=3)", "tomli", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] testing-integration = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "packaging (>=23.2)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] [metadata] diff --git a/sysig.py b/sysig.py index 47bc474..84033f7 100644 --- a/sysig.py +++ b/sysig.py @@ -1,121 +1,115 @@ -""" - SYSIG - System Information Gatherer +import dearpygui.dearpygui as dpg - Simple GUI tool to gather system information in your computer -""" +from cpuinfo import get_cpu_info -from datetime import datetime +import humanize +import psutil -import time -import platform -import socket import threading +import socket +import platform import subprocess -import dearpygui.dearpygui as dpg -from cpuinfo import get_cpu_info -import GPUtil -import psutil -import humanize +import os +from datetime import datetime +if platform.system() == 'Windows': + import winreg -# Check for AMD support and conditionally import pyadl AMD_SUPPORTED = False +NVIDIA_SUPPORTED = False try: import pyadl - _ = pyadl.ADLManager.getInstance().getDevices() - AMD_SUPPORTED = True + import GPUtil + if len(pyadl.ADLManager.getInstance().getDevices()) > 0: + AMD_SUPPORTED = True + + if len(GPUtil.getGPUs()) > 0: + NVIDIA_SUPPORTED = True except ImportError: pass -except Exception as amd_error: - # Only print the AMD error if no NVIDIA GPUs are detected - if not GPUtil.getGPUs(): - print(f"Unexpected error while checking for AMD support: {amd_error}") -# Check for Windows and conditionally import winreg -if platform.system() == 'Windows': - import winreg -else: - winreg = None +WINDOW_WIDTH = 640 +WINDOW_HEIGHT = 480 +COLOR = (0, 255, 54) +ICON = os.getcwd() + "/resource/icon.ico" -gci = get_cpu_info() -WIN_WIDTH = 800 -WIN_HEIGHT = 400 +GCI = get_cpu_info() dpg.create_context() +dpg.create_viewport( + title="SYSIG", + small_icon=ICON, + large_icon=ICON, + width=WINDOW_WIDTH, + max_width=WINDOW_WIDTH, + height=WINDOW_HEIGHT, + max_height=WINDOW_HEIGHT, + clear_color=(18, 18, 18) +) +dpg.setup_dearpygui() -gpu_temp_texts = {} # Store NVIDIA GPU temp text IDs -amd_gpu_temp_texts = {} # Store AMD GPU temp text IDs -gpu_progress_bars = {} # Store NVIDIA GPU progress bar IDs - -# Get CPU Total Utilization -def get_cpu_util(): - """Get CPU Total Utilization""" - - while True: - cpu_val = psutil.cpu_percent(interval=1, percpu=False) - dpg.set_value(cpu_progress_bar, 1.0 / 100.0 * cpu_val) - dpg.configure_item(cpu_progress_bar, overlay=f"{cpu_val}%") - - -# entry +# Main window with dpg.window( - label=f"Computer Name: {platform.node()}", - no_close=True, - no_resize=True, - no_move=True, - width=WIN_WIDTH - 18, - height=WIN_HEIGHT -) as main_window: - with dpg.collapsing_header(label="Processor"): - with dpg.group(horizontal=True): - dpg.add_text(f"{gci['brand_raw']} @", bullet=True) - dpg.add_text(f"{gci['hz_actual_friendly']}") - with dpg.group(horizontal=True): - dpg.add_text("CPU Utilization(Total):", bullet=True) - threading.Thread(target=get_cpu_util, args=(), daemon=True).start() - cpu_progress_bar = dpg.add_progress_bar(default_value=0.0, overlay="0.0%", width=200) - dpg.add_text(f"{gci['count']} Total Core/s", bullet=True) - dpg.add_text(f"{gci['arch']} Architecture", bullet=True) - with dpg.tree_node(label="Cache/s"): + no_title_bar=True, + no_move=True, + width=WINDOW_WIDTH, + height=WINDOW_HEIGHT, + pos=(0, 0), + ): + dpg.add_text("System Information Gatherer", pos=(int(WINDOW_WIDTH / 2.9), 12), color=COLOR) + + dpg.add_button( + label="Processor Information", + width=256, + height=32, + pos=(int(WINDOW_WIDTH / 3.5), 48), + callback=lambda: dpg.configure_item("Processor_modal_ID", show=True), + ) + + with dpg.window( + label="Processor Information", + modal=True, + show=False, + tag="Processor_modal_ID", + autosize=True, + ): + + dpg.add_text(f"Processor Name: {GCI['brand_raw']} @ {GCI['hz_actual_friendly']}", bullet=True) + dpg.add_text(f"Processor Count: {GCI['count']}", bullet=True) + dpg.add_text(f"Architecture: {GCI['arch']}", bullet=True) + + with dpg.tree_node(label="Processor Caches"): try: - l1_i = humanize.naturalsize(gci['l1_instruction_cache_size'], gnu=True) - dpg.add_text(f"L1 Instruction Cache Size: {l1_i}") - except KeyError: - dpg.add_text("L1 Instruction Cache Size: Can't determine") + l1_data = humanize.naturalsize(GCI['l1_instruction_cache_size'], gnu=True) + dpg.add_text(f"L1 Instruction Cache Size: {l1_data}", bullet=True) + except KeyError: dpg.add_text("L1 Instruction Cache Size: Can't determine", bullet=True) try: - l1_d = humanize.naturalsize(gci['l1_data_cache_size'], gnu=True) - dpg.add_text(f"L1 Data Cache Size: {l1_d}") - except KeyError: - dpg.add_text("L1 Data Cache Size: Can't determine") + l1_instruction = humanize.naturalsize(GCI['l1_data_cache_size'], gnu=True) + dpg.add_text(f"L1 Data Cache Size: {l1_instruction}", bullet=True) + except KeyError: dpg.add_text("L1 Data Cache Size: Can't determine", bullet=True) try: - l2 = humanize.naturalsize(gci['l2_cache_size'], gnu=True) - dpg.add_text(f"L2 Cache Size: {l2}") - except KeyError: - dpg.add_text("L2 Cache Size: Can't determine") + l2 = humanize.naturalsize(GCI['l2_cache_size'], gnu=True) + dpg.add_text(f"L2 Cache Size: {l2}", bullet=True) + except KeyError: dpg.add_text("L2 Cache Size: Can't determine", bullet=True) - try: - l3 = humanize.naturalsize(gci['l3_cache_size'], gnu=True) - dpg.add_text(f"L3 Cache Size: {l3}") - except KeyError: - dpg.add_text("L3 Cache Size: Can't determine") + try: + l3 = humanize.naturalsize(GCI['l3_cache_size'], gnu=True) + dpg.add_text(f"L3 Cache Size: {l3}", bullet=True) + except KeyError: dpg.add_text("L3 Cache Size: Can't determine", bullet=True) with dpg.tree_node(label="Flags"): with dpg.table( - header_row=False, - resizable=True, - policy=dpg.mvTable_SizingStretchProp, + header_row=False, + policy=dpg.mvTable_SizingStretchProp, row_background=True, - borders_outerV=True, - borders_innerV=True, - borders_outerH=True, borders_innerH=True, - delay_search=True + borders_innerV=True, ): - COL = 11 - FLAG = 0 - flags = gci['flags'] + COL = 8 + flag = 0 + flags = GCI['flags'] for _ in range(COL): dpg.add_table_column() @@ -125,125 +119,72 @@ def get_cpu_util(): for row in range(rows): with dpg.table_row(): for col in range(COL): - FLAG = row * COL + col - if FLAG >= len(flags): + flag = row * COL + col + if flag >= len(flags): dpg.add_text("---") else: - dpg.add_text(f"{flags[FLAG]}") - - with dpg.collapsing_header(label="Graphics"): - gpu_temp_placeholder = dpg.add_group(horizontal=False) - gpu_list = [] - - def handle_nvidia_gpus(): - """handle NVIDIA GPUs""" - gpus = GPUtil.getGPUs() - for gpu in gpus: - if gpu.id not in gpu_temp_texts: - dpg.add_text( - f"Graphics Name: {gpu.name}", - bullet=True, - parent=gpu_temp_placeholder - ) - with dpg.group(horizontal=True, parent=gpu_temp_placeholder): - dpg.add_text("GPU Utilization:", bullet=True) - gpu_progress_bar = dpg.add_progress_bar( - default_value=0.0, - overlay="0.0%", - width=200 - ) - gpu_progress_bars[gpu.id] = gpu_progress_bar - - gpu_temp_text_id = dpg.add_text( - f"Temperature: {gpu.temperature}°C", - bullet=True, - parent=gpu_temp_placeholder - ) - gpu_temp_texts[gpu.id] = gpu_temp_text_id - else: - dpg.set_value( - gpu_temp_texts[gpu.id], - f"Temperature: {gpu.temperature}°C" - ) - - def handle_amd_gpus(): - """handle AMD GPUs""" - if not AMD_SUPPORTED: - return - - amd_manager = pyadl.ADLManager.getInstance() - devices = amd_manager.getDevices() - for device in devices: - temperature_data = device.getCurrentTemperature() - if temperature_data is not None: - if device.adapterName not in amd_gpu_temp_texts: - dpg.add_text( - f"AMD GPU {device.adapterName}", - bullet=True, - parent=gpu_temp_placeholder - ) - amd_gpu_temp_text_id = dpg.add_text( - f"Temperature: {temperature_data}°C", - bullet=True, - parent=gpu_temp_placeholder - ) - amd_gpu_temp_texts[device.adapterName] = amd_gpu_temp_text_id - else: - dpg.set_value( - amd_gpu_temp_texts[device.adapterName], - f"Temperature: {temperature_data}°C" - ) - - def update_gpu_temperature(): - """Get GPU Temperature and Util Updates""" - while True: - try: - handle_nvidia_gpus() - except ImportError as import_error: - dpg.add_text( - f"Error importing GPUtil: {import_error}", - bullet=True, - parent=gpu_temp_placeholder - ) - except Exception as general_exception: - dpg.add_text( - f"Error fetching NVIDIA GPU information: {general_exception}", - bullet=True, - parent=gpu_temp_placeholder - ) - - try: - handle_amd_gpus() - except Exception as general_exception: - dpg.add_text( - f"Error fetching AMD GPU temperature: {general_exception}", - bullet=True, - parent=gpu_temp_placeholder - ) - - time.sleep(1) - - # Get GPU Utilization - def get_gpu_util(): - """Get GPU Utilization""" - while True: - try: - gpus = GPUtil.getGPUs() - for gpu in gpus: - gpu_val = gpu.load * 100 - dpg.set_value(gpu_progress_bars[gpu.id], 1.0 / 100.0 * gpu_val) - dpg.configure_item(gpu_progress_bars[gpu.id], overlay=f"{gpu_val:.2f}%") - except (ImportError, Exception) as general_exception: - print(f"An error occurred: {general_exception}") - time.sleep(1) - - with dpg.collapsing_header(label="Memory"): + dpg.add_text(f"{flags[flag]}") + + with dpg.group(horizontal=True): + dpg.add_text("CPU Utilization(Total): ", bullet=True) + def cpu_util(): + while 1: + val = psutil.cpu_percent(interval=1, percpu=False) + dpg.set_value("util_progress", (1.0 / 100.0) * val) + dpg.configure_item("util_progress", overlay=f"{val}%") + threading.Thread(target=cpu_util, args=(), daemon=True).start() + dpg.add_progress_bar(tag="util_progress", overlay="0.0%", height=16,) + + dpg.add_button( + label="Graphics Information", + width=256, + height=32, + pos=(int(WINDOW_WIDTH / 3.5), 96), + callback=lambda: dpg.configure_item("Graphics_modal_ID", show=True), + ) + + # GPU Temperature detection is unsupported + with dpg.window( + label="Graphics Information", + modal=True, + show=False, + tag="Graphics_modal_ID", + autosize=True, + ): + gpu_devices = [] + with dpg.group(horizontal=True): + if AMD_SUPPORTED: + devices = pyadl.ADLManager.getInstance().getDevices() + for device in devices: + gpu_devices.append(device.adapterName.decode('utf-8')) + + if NVIDIA_SUPPORTED: + devices = GPUtil.getGPUs() + for device in devices: + gpu_devices.append(device.gpu_name) + dpg.add_text(f"Graphics Card: {gpu_devices}", bullet=True) + + dpg.add_button( + label="Memory Information", + width=256, + height=32, + pos=(int(WINDOW_WIDTH / 3.5), 144), + callback=lambda: dpg.configure_item("Memory_modal_ID", show=True), + ) + + with dpg.window( + label="Memory Information", + modal=True, + show=False, + tag="Memory_modal_ID", + autosize=True, + ): mem = psutil.virtual_memory() mem_used = humanize.naturalsize(mem.used) mem_percent = mem.percent mem_avail = humanize.naturalsize(mem.available) mem_total = humanize.naturalsize(mem.total) - dpg.add_text("MAIN MEMORY", color=(0, 255, 0)) + dpg.add_text("MAIN MEMORY") dpg.add_text(f"Used Memory: {mem_used}({mem_percent}%)", bullet=True) dpg.add_text(f"Available Memory: {mem_avail}", bullet=True) dpg.add_text(f"Total Memory: {mem_total}", bullet=True) @@ -253,12 +194,26 @@ def get_gpu_util(): swap_percent = swap.percent swap_free = humanize.naturalsize(swap.free) swap_total = humanize.naturalsize(swap.total) - dpg.add_text("SWAP MEMORY", color=(0, 255, 0)) + dpg.add_text("SWAP MEMORY") dpg.add_text(f"Used Swap Memory: {swap_used}({swap_percent}%)", bullet=True) dpg.add_text(f"Free Swap Memory: {swap_free}", bullet=True) dpg.add_text(f"Total Swap Memory: {swap_total}", bullet=True) - with dpg.collapsing_header(label="Disk"): + dpg.add_button( + label="Disk Information", + width=256, + height=32, + pos=(int(WINDOW_WIDTH / 3.5), 192), + callback=lambda: dpg.configure_item("Disk_modal_ID", show=True,) + ) + + with dpg.window( + label="Disk Information", + modal=True, + show=False, + tag="Disk_modal_ID", + autosize=True, + ): with dpg.table( resizable=True, policy=dpg.mvTable_SizingStretchProp, @@ -291,7 +246,21 @@ def get_gpu_util(): dpg.add_text(f"{humanize.naturalsize(usage.free)}") dpg.add_text(f"{humanize.naturalsize(usage.total)}") - with dpg.collapsing_header(label="Network"): + dpg.add_button( + label="Network Information", + width=256, + height=32, + pos=(int(WINDOW_WIDTH / 3.5), 240), + callback=lambda: dpg.configure_item("Network_modal_ID", show=True,) + ) + + with dpg.window( + label="Network Information", + modal=True, + show=False, + tag="Network_modal_ID", + autosize=True, + ): addr_list = psutil.net_if_addrs() for name, addresses in addr_list.items(): with dpg.group(horizontal=True): @@ -304,7 +273,21 @@ def get_gpu_util(): if address.family == psutil.AF_LINK: dpg.add_text(f"MAC Address: {address.address}", bullet=True) - with dpg.collapsing_header(label="Operating System"): + dpg.add_button( + label="OS Information", + width=256, + height=32, + pos=(int(WINDOW_WIDTH / 3.5), 288), + callback=lambda: dpg.configure_item("OS_modal_ID", show=True,) + ) + + with dpg.window( + label="OS Information", + modal=True, + show=False, + tag="OS_modal_ID", + autosize=True, + ): if platform.system() == 'Windows': try: BRAND = subprocess.check_output('wmic csproduct get vendor', shell=True) @@ -352,19 +335,27 @@ def get_gpu_util(): dpg.add_text(f"Vendor: {vendor[0]}", bullet=True) dpg.add_text(f"Version: {version[0]}", bullet=True) -threading.Thread(target=update_gpu_temperature, daemon=True).start() -threading.Thread(target=get_gpu_util, daemon=True).start() + dpg.add_button( + label="About SYSIG", + width=256, + height=32, + pos=(int(WINDOW_WIDTH / 3.5), 384), + callback=lambda: dpg.configure_item("About_modal_ID", show=True,) + ) + + with dpg.window( + label="About SYSIG", + modal=True, + show=False, + tag="About_modal_ID", + autosize=True, + ): + dpg.add_text("SYSIG - System Information Gatherer") + dpg.add_text("Simple application to gather your system information in your computer.") + dpg.add_text("") + dpg.add_text("GitHub Repo: https://github.com/diamant3/SYSIG") + dpg.add_text("E-Mail: diamant3@proton.me") -dpg.create_viewport( - title="System Information Gatherer", - small_icon="res/icon.ico", - large_icon="res/icon.ico", - resizable=False, - max_width=WIN_WIDTH, - max_height=WIN_HEIGHT -) -dpg.setup_dearpygui() -dpg.set_primary_window(main_window, True) dpg.show_viewport() dpg.start_dearpygui() -dpg.destroy_context() +dpg.destroy_context() \ No newline at end of file