diff --git a/pyG5/pyG5Network.py b/pyG5/pyG5Network.py index 90e7fd3..f1e7ff2 100644 --- a/pyG5/pyG5Network.py +++ b/pyG5/pyG5Network.py @@ -49,6 +49,22 @@ def __init__(self, parent=None): # list the datarefs to request self.datarefs = [ # ( dataref, frequency, unit, description, num decimals to display in formatted output ) + ( + "sim/cockpit/radios/nav1_dme_dist_m", + 30, + "kt", + "dme Range anv1", + 0, + "_nav1dme", + ), + ( + "sim/cockpit/radios/nav2_dme_dist_m", + 30, + "kt", + "dme Range nav2", + 0, + "_nav2dme", + ), ( "sim/cockpit2/radios/indicators/nav1_bearing_deg_mag", 30, diff --git a/pyG5/pyG5View.py b/pyG5/pyG5View.py index ace5b1d..ac9cca9 100644 --- a/pyG5/pyG5View.py +++ b/pyG5/pyG5View.py @@ -167,6 +167,8 @@ def __init__(self, parent=None): ("nav2dft", 0), ("nav1bearing", 0), ("nav2bearing", 0), + ("nav1dme", 0), + ("nav2dme", 0), ("gpsdft", 0), ("gpsgsavailable", 0), ("gpsvnavavailable", 0), @@ -1305,7 +1307,11 @@ def paintEvent(self, event): ) # draw the dist box - if int(self._hsiSource) == 2: + if ( + int(self._hsiSource) == 2 + or (int(self._hsiSource) == 1 and int(self._nav2fromto) != 0) + or (int(self._hsiSource) == 0 and int(self._nav1fromto) != 0) + ): font.setPixelSize(12) font.setBold(False) self.qp.setFont(font) @@ -1325,12 +1331,18 @@ def paintEvent(self, event): font.setBold(True) self.qp.setFont(font) self.setPen(1, navColor) + if int(self._hsiSource) == 2: + dist = self._gpsdmedist + elif int(self._hsiSource) == 1: + dist = self._nav2dme + else: + dist = self._nav1dme distRect = QRectF(g5Width - 105, 12, 105, 45 - 12) self.qp.drawText( distRect, Qt.AlignmentFlag.AlignCenter, - "{}".format(round(self._gpsdmedist, 1)), + "{}".format(round(dist, 1)), ) # set default font size @@ -1596,7 +1608,7 @@ def paintEvent(self, event): "{}".format(self.getNavTypeString(self._nav1type, "")), ) - if int(self._nav2fromto) != 0: + if int(self._nav2fromto) != 0 and vertAvailable == 0: # set color to grey self.setPen(2, Qt.GlobalColor.gray)