From b52c073abf0392a59e24cf732311374c2ddbc1c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Sch=C3=B6n?= Date: Mon, 11 Dec 2023 21:27:36 -0700 Subject: [PATCH 1/2] Added a bearing pointer to the HSI widget for projects using pyG5 as an GUI element only. Added a bearing pointer to the HSI widget for projects using pyG5 as an GUI element only. TODO: Add Bearing 2, add Bearing displays, optionally DME display --- pyG5/pyG5View.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/pyG5/pyG5View.py b/pyG5/pyG5View.py index dc22108..42edf26 100644 --- a/pyG5/pyG5View.py +++ b/pyG5/pyG5View.py @@ -188,6 +188,8 @@ def __init__(self, parent=None): ("slip", 0), ("headingBug", 0), ("vs", 30), + ("bearing1", 0), + ("bearing1avail", 0), ("vs0", 23), ("vfe", 88), ("vno", 118), @@ -1072,6 +1074,42 @@ def paintEvent(self, event): vertAvailable = self._nav1gsavailable gsDev = self._nav1gs + # bearing 1 + if self._bearing1avail: + + self.qp.rotate(90 - self._headingBug + self._bearing1) + + self.setPen(2, Qt.GlobalColor.cyan) + + # arrow + self.qp.drawPolyline( + QPolygonF( + [ + QPointF(rotatinghsiCircleRadius - 20, 0), + QPointF(rotatinghsiCircleRadius - 25, 0), + QPointF(rotatinghsiCircleRadius - 35, -17), + QPointF(rotatinghsiCircleRadius - 25, 0), + QPointF(rotatinghsiCircleRadius - 35, 17), + QPointF(rotatinghsiCircleRadius - 25, 0), + QPointF(hsiCircleRadius, 0) + ] + ) + ) + + # backside + self.qp.drawPolyline( + QPolygonF( + [ + QPointF(-rotatinghsiCircleRadius + 25, 0), + QPointF(-hsiCircleRadius, 0) + ] + ) + ) + + self.qp.rotate(-90 + self._headingBug - self._bearing1) + + + self.setPen(1, Qt.GlobalColor.black) self.qp.setBrush(QBrush(navColor)) # Draw the CDI self.qp.rotate(90 - self._headingBug + navcrs) From 570a78808ec352ed68324e8c7baf64d17bcb7076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Sch=C3=B6n?= Date: Tue, 12 Dec 2023 17:49:54 -0700 Subject: [PATCH 2/2] Update code to respect black codeformatting --- pyG5/pyG5View.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pyG5/pyG5View.py b/pyG5/pyG5View.py index 42edf26..2047ca9 100644 --- a/pyG5/pyG5View.py +++ b/pyG5/pyG5View.py @@ -1076,11 +1076,10 @@ def paintEvent(self, event): # bearing 1 if self._bearing1avail: - self.qp.rotate(90 - self._headingBug + self._bearing1) self.setPen(2, Qt.GlobalColor.cyan) - + # arrow self.qp.drawPolyline( QPolygonF( @@ -1091,7 +1090,7 @@ def paintEvent(self, event): QPointF(rotatinghsiCircleRadius - 25, 0), QPointF(rotatinghsiCircleRadius - 35, 17), QPointF(rotatinghsiCircleRadius - 25, 0), - QPointF(hsiCircleRadius, 0) + QPointF(hsiCircleRadius, 0), ] ) ) @@ -1101,14 +1100,13 @@ def paintEvent(self, event): QPolygonF( [ QPointF(-rotatinghsiCircleRadius + 25, 0), - QPointF(-hsiCircleRadius, 0) + QPointF(-hsiCircleRadius, 0), ] ) ) self.qp.rotate(-90 + self._headingBug - self._bearing1) - - + self.setPen(1, Qt.GlobalColor.black) self.qp.setBrush(QBrush(navColor)) # Draw the CDI