From 23ca4ba9a28c5b124c8ce0228d89734478d7c119 Mon Sep 17 00:00:00 2001 From: saji Date: Wed, 5 Jul 2023 21:16:22 -0500 Subject: [PATCH] qt logger --- py/poetry.lock | 88 ++++++++++++++++++++++++++++------------------- py/pyproject.toml | 2 +- py/pytelem/gui.py | 24 ++++++++++++- 3 files changed, 77 insertions(+), 37 deletions(-) diff --git a/py/poetry.lock b/py/poetry.lock index 4194e9a..57734d7 100644 --- a/py/poetry.lock +++ b/py/poetry.lock @@ -2309,60 +2309,78 @@ files = [ [[package]] name = "pyside6" -version = "6.5.1.1" +version = "6.5.0" description = "Python bindings for the Qt cross-platform application and UI framework" optional = false python-versions = "<3.12,>=3.7" files = [ - {file = "PySide6-6.5.1.1-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:dc2d249ea2486526d1bb74e6cf96e2b49f2089cf069ab289a168aa48b5c251d5"}, - {file = "PySide6-6.5.1.1-cp37-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:b7b6588527eb1ca45afb8918f109d827f7d248beaec14e7acdaea18883680aee"}, - {file = "PySide6-6.5.1.1-cp37-abi3-win_amd64.whl", hash = "sha256:1517dd56f7235a98f3e1fcc983d3c8cf3d539b33164815c6e06442a297d2ab0d"}, - {file = "PySide6-6.5.1.1-pp39-pypy39_pp73-macosx_10_9_universal2.whl", hash = "sha256:a55403254ff7421bea5b8e2196fded24e4a0357d3b1f10d5f01ffc3ae937c71a"}, - {file = "PySide6-6.5.1.1-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:25c83843de0aa562631620721e4599eed55bc96747ed869caa631ecf92070951"}, - {file = "PySide6-6.5.1.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:645c1a99c37a0ce045b23fb35faacf54d98442cc16f621fe1dad2a1d2880e5e3"}, + {file = "PySide6-6.5.0-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:cb059a0f3d4b763451a1e8dec440784dff1728e9ace6cb81c541cc1354c5f3dc"}, + {file = "PySide6-6.5.0-cp37-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:5102c57841b15facb0aeca1f23d689ebc528a609bf5fb907f1ef2747f6415001"}, + {file = "PySide6-6.5.0-cp37-abi3-win_amd64.whl", hash = "sha256:13e8e96aa7a89840575505f50b9635e6450bf413ff46288d1085b3a9f8b225c1"}, + {file = "PySide6-6.5.0-pp39-pypy39_pp73-macosx_10_9_universal2.whl", hash = "sha256:f30e1d0319ea4d2ddac654c58377079a40f38c4cac7b6fd631902f91190c1fc8"}, + {file = "PySide6-6.5.0-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:c1c7244a4e83b3a4ea965f4a85776ebc64fa3c9b4af77ad70b22e64ccec3d451"}, + {file = "PySide6-6.5.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:7242fe09aaeb3399152fa1c6c25098b93df945620a4bd81a37de0ecb2f64fd5d"}, ] [package.dependencies] -PySide6-Addons = "6.5.1.1" -PySide6-Essentials = "6.5.1.1" -shiboken6 = "6.5.1.1" +PySide6-Addons = "6.5.0" +PySide6-Essentials = "6.5.0" +shiboken6 = "6.5.0" [[package]] name = "pyside6-addons" -version = "6.5.1.1" +version = "6.5.0" description = "Python bindings for the Qt cross-platform application and UI framework (Addons)" optional = false python-versions = "<3.12,>=3.7" files = [ - {file = "PySide6_Addons-6.5.1.1-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:aadda3376a81dbead867380f7ae81d2fe0fb1ffd482bfc10212be8b0d06c2c4c"}, - {file = "PySide6_Addons-6.5.1.1-cp37-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:cf18c88274d6c9c29cccbecb11c72b1f0b0bb077dc044f9b40354f13d0c1c52e"}, - {file = "PySide6_Addons-6.5.1.1-cp37-abi3-win_amd64.whl", hash = "sha256:d6370dfd03329cdcc91288d64bd1e26a5fc1908958b8a81fea5010a5849db441"}, - {file = "PySide6_Addons-6.5.1.1-pp39-pypy39_pp73-macosx_10_9_universal2.whl", hash = "sha256:e3ab22776e620d9467ffb2d76be06d5a3b8b3859d77e2e73f65f2b29018645e7"}, - {file = "PySide6_Addons-6.5.1.1-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:4e1bc141a7aa9488dc77c9b29ad412e417e601cc8e23050517f7c6c8634feb46"}, - {file = "PySide6_Addons-6.5.1.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:441f8797d6b01c9dd9b848d0e156b2b5042d71d9266d0a6ded48c9b1cd337821"}, + {file = "PySide6_Addons-6.5.0-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:d29e84d0b54c5fdeb6cc405d537788a648da975cc58e37f0df3a17cd11a67f1d"}, + {file = "PySide6_Addons-6.5.0-cp37-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:29551ca63a1cbc0fcd17fa9e477282857e2c66c3a55fdb9754b75519d5adf89a"}, + {file = "PySide6_Addons-6.5.0-cp37-abi3-win_amd64.whl", hash = "sha256:db7a6117c3f944b4827204ed7f346030fc10c602521f278310a78021567df28f"}, + {file = "PySide6_Addons-6.5.0-pp39-pypy39_pp73-macosx_10_9_universal2.whl", hash = "sha256:fd5bc46cfffac7afa2f76c3dc6cb6f567a0ad1276d8177797c1bc152aec50f35"}, + {file = "PySide6_Addons-6.5.0-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:9ed197a05f1c279d1589d8535040fe5e21b92fa19933e38de962050cb58f6c05"}, + {file = "PySide6_Addons-6.5.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:1a9545df3e77c656a3708eaa3584d98ff41720c7dadf344d5126d66e83d0ab5a"}, ] [package.dependencies] -PySide6-Essentials = "6.5.1.1" -shiboken6 = "6.5.1.1" +PySide6-Essentials = "6.5.0" +shiboken6 = "6.5.0" [[package]] name = "pyside6-essentials" -version = "6.5.1.1" +version = "6.5.0" description = "Python bindings for the Qt cross-platform application and UI framework (Essentials)" optional = false python-versions = "<3.12,>=3.7" files = [ - {file = "PySide6_Essentials-6.5.1.1-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:c0cc3b1e7ca0e6b7a0cb8190a8538242972df43c1f9014cc0cd066d4ed7fc83a"}, - {file = "PySide6_Essentials-6.5.1.1-cp37-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:bfd8900b1bf6a595b7d63539817bc825941f737486a093d519514c5b67af789f"}, - {file = "PySide6_Essentials-6.5.1.1-cp37-abi3-win_amd64.whl", hash = "sha256:1346e6a4e97d97f54e6c0805150c6dead4cc0e7914d77167f836eb36b83acb5c"}, - {file = "PySide6_Essentials-6.5.1.1-pp39-pypy39_pp73-macosx_10_9_universal2.whl", hash = "sha256:0111386918064fa84a498ed7a6e93ec4155fe96e8d4f9c9e3ac54a5b65ddfadf"}, - {file = "PySide6_Essentials-6.5.1.1-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:6264b00099a9bed0020460033e2a4369513e0e69f7abe3f436c3c6390164bcea"}, - {file = "PySide6_Essentials-6.5.1.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:620cefb6c954d59f941f06acecfe5cdf42bf470f2f3e6b9d023f49f93d740080"}, + {file = "PySide6_Essentials-6.5.0-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:4517e27fc540d9e645ea12dea82c8b29c042d66aaef46960a125cccdf0079800"}, + {file = "PySide6_Essentials-6.5.0-cp37-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:f00d4f10758cdc3f49f94465ead788ad294dac7d9cc5e1cc0610e97c2bdfc8d7"}, + {file = "PySide6_Essentials-6.5.0-cp37-abi3-win_amd64.whl", hash = "sha256:bc2e0a9dafe383ab965e98b6ddf73f709da3736197dea8eab265fd3e524db993"}, + {file = "PySide6_Essentials-6.5.0-pp39-pypy39_pp73-macosx_10_9_universal2.whl", hash = "sha256:58a88a099171c55a7e41e519208c9ca93661d277bb73c5897a2e3f2cbe5248b7"}, + {file = "PySide6_Essentials-6.5.0-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:0287ec94ee1923d430bb20836bc649a5c76a59281245de469d7f759cc73c5ea7"}, + {file = "PySide6_Essentials-6.5.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:987c2ec04c35481c841de9b25931d2d074eb7d2e591aa5628041b2ca2df96d0e"}, ] [package.dependencies] -shiboken6 = "6.5.1.1" +shiboken6 = "6.5.0" + +[[package]] +name = "pyside6-qtads" +version = "4.0.3" +description = "PySide6 bindings to Qt Advanced Docking System" +optional = false +python-versions = ">=3.7" +files = [ + {file = "PySide6-QtAds-4.0.3.tar.gz", hash = "sha256:ed499ae5bdf6a0628f464fbb222a5958b27c86db8a8aa4871e7b7e03cd55f37f"}, + {file = "PySide6_QtAds-4.0.3-cp37-abi3-macosx_10_15_x86_64.whl", hash = "sha256:964c68f6a0bdc89a60e3fdbef81008b71ad66c12fefb0e591154ed98825b9afb"}, + {file = "PySide6_QtAds-4.0.3-cp37-abi3-macosx_11_0_arm64.whl", hash = "sha256:6b1f1a772f5ee102822a475b3f1526182bf654401c3ef1e0a02e7c6c96a40a97"}, + {file = "PySide6_QtAds-4.0.3-cp37-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:431ba3a4de3536e1565a4e2e995bb2c69836edccaf8699b746bd3e40321fa03e"}, + {file = "PySide6_QtAds-4.0.3-cp37-abi3-win_amd64.whl", hash = "sha256:862de7130ee97aeb184dc7b3056ea7bdf76f788e2d8528dc549d187ad76ee335"}, +] + +[package.dependencies] +PySide6-Essentials = "6.5.0" +shiboken6 = "6.5.0" [[package]] name = "pytest" @@ -2709,17 +2727,17 @@ win32 = ["pywin32"] [[package]] name = "shiboken6" -version = "6.5.1.1" +version = "6.5.0" description = "Python/C++ bindings helper module" optional = false python-versions = "<3.12,>=3.7" files = [ - {file = "shiboken6-6.5.1.1-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:59fc1797df38c9e8c89cc43d5996a4c0331d0258087fa9d6466b03822aba6ff2"}, - {file = "shiboken6-6.5.1.1-cp37-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:4338a8eb00e8d6f5b27edf85ab689ada905a4490c73ed3f23ff3b3c5f72a563e"}, - {file = "shiboken6-6.5.1.1-cp37-abi3-win_amd64.whl", hash = "sha256:aa6289cdbaa12f364f1c45d60d9d483c3842ee9cf6e9acdc3efd21cd460c2eb5"}, - {file = "shiboken6-6.5.1.1-pp39-pypy39_pp73-macosx_10_9_universal2.whl", hash = "sha256:db029b9d895052c1f42b1f929af3a5f6e688a88c5862aed24d5094086b034ab2"}, - {file = "shiboken6-6.5.1.1-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:1c7ba82093d66ace5c7a07ed9c7b4ea57a311ddbfecbe44aff7ed023efc8a380"}, - {file = "shiboken6-6.5.1.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:34cacba2954bff632476fbead190868c6f068a6dd9e5c8fd7d2ed4f8f5cfade4"}, + {file = "shiboken6-6.5.0-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:2d7fe6534a51ec9c96b82fc6275cf75e85ab29276a9778aed756465f81adf0c1"}, + {file = "shiboken6-6.5.0-cp37-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:46ff977f96c9d45dba3c3a313628356fd40e4423bb65bf2d9870b73396fad8be"}, + {file = "shiboken6-6.5.0-cp37-abi3-win_amd64.whl", hash = "sha256:aee9708517821aaef547c83d689bf524d6f217d47232cb313d9af9e630215eed"}, + {file = "shiboken6-6.5.0-pp39-pypy39_pp73-macosx_10_9_universal2.whl", hash = "sha256:6e2874ea013d4cea7819935977bffa4c634ebcaabcb5287798df9f0c2f10c4c0"}, + {file = "shiboken6-6.5.0-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:72888ebc5ef7295df27197c0af726bd6731e2a883b346e448e2c740b3e34bc2f"}, + {file = "shiboken6-6.5.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:1bba668221a5cf40186cea93ced018cf788d7476d50968a3f073ebbe41ce712d"}, ] [[package]] @@ -3037,4 +3055,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = ">=3.11,<3.12" -content-hash = "eb4003063c9e319bd79fcac28b8499faa5ed89e8aad3f4d94299a42970fca6ad" +content-hash = "ad7ece45afb2eb316adc740b10dba9e2f7fe874993ad38962515455e311a675c" diff --git a/py/pyproject.toml b/py/pyproject.toml index 027a48d..4ceb90d 100644 --- a/py/pyproject.toml +++ b/py/pyproject.toml @@ -12,7 +12,7 @@ orjson = "^3.8.14" imgui-bundle = "^0.8.5" numpy = "^1.24.3" aiohttp = "^3.8.4" -pyside6 = "^6.5.1" +pyside6 = "^6.5.0" pydantic = "^1.10.9" pyyaml = "^6.0" jinja2 = "^3.1.2" diff --git a/py/pytelem/gui.py b/py/pytelem/gui.py index 153adb2..1e983a7 100644 --- a/py/pytelem/gui.py +++ b/py/pytelem/gui.py @@ -1,8 +1,9 @@ import sys +import logging import pyqtgraph.parametertree from PySide6 import QtWidgets, QtCore -from PySide6.QtCore import QDir, Qt +from PySide6.QtCore import QDir, Qt, QObject from PySide6.QtWidgets import ( QApplication, QWidget, @@ -13,6 +14,27 @@ from PySide6.QtWidgets import ( from bms import BMSOverview +class QtLogger(logging.Handler, QObject): + appendLog = QtCore.Signal(str) + + def __init__(self, parent): + super().__init__() + QtCore.QObject.__init__(self) + self.widget = QtWidgets.QPlainTextEdit(parent) + self.widget.setReadOnly(True) + self.appendLog.connect(self.widget.appendPlainText) + + def emit(self, record): + msg = self.format(record) + self.appendLog.emit(msg) + + +class DataStore: + """Stores all packets and timestamps for display and logging. + Queries the upstreams for the packets as they come in as well as historical""" + + def __init__(self, remote): + pass class MainApp(QMainWindow): def __init__(self):