Skip to content

Commit

Permalink
Fixes nasa#72, upgrade PyQt4 to PyQt5
Browse files Browse the repository at this point in the history
Incorporated dmknutsen fixes from nasa#83. Also fixes nasa#71
  • Loading branch information
lbleier-GSFC committed May 7, 2020
1 parent ac9251f commit 8a7df18
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions Subsystems/tlmGUI/EventMessage.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ def __init__(self, aid):
self.setupUi(self)
self.appId = aid

self.eventTypes = {
1: "DEBUG",
2: "INFORMATION",
3: "ERROR",
4: "CRITICAL"
}

def initEMTlmReceiver(self, subscr):
self.setWindowTitle(f'{pageTitle} for: {subscr}')
self.thread = EMTlmReceiver(subscr, self.appId)
Expand All @@ -101,26 +108,14 @@ def processPendingDatagrams(self, datagram):
# Get App Name, Event ID, Type and Event Text!
#
appName = datagram[16:36].decode('utf-8', 'ignore')
EventID = int.from_bytes(datagram[36:38], byteorder='little')
EventType = int.from_bytes(datagram[38:40], byteorder='little')
eventID = int.from_bytes(datagram[36:38], byteorder='little')
eventType = int.from_bytes(datagram[38:40], byteorder='little')
eventText = datagram[48:].decode('utf-8', 'ignore')
EventID = str(EventID)
EventType = str(EventType)
appName = appName.split("\0")[0]
eventText = eventText.split("\0")[0]
eventTypeStr = self.eventTypes.get(eventType, "Invalid Event Type")

if (EventType == "1"):
EventType = "DEBUG"
elif (EventType == "2"):
EventType = "INFORMATION"
elif (EventType == "3"):
EventType = "ERROR"
elif (EventType == "4"):
EventType = "CRITICAL"
else:
EventType = "Invalid Event Type"

eventString = f"EVENT --> {appName} - {EventType} Event ID: {EventID}: {eventText}"
eventString = f"EVENT --> {appName}-{eventTypeStr} Event ID: {eventID} : {eventText}"
self.eventOutput.appendPlainText(eventString)

## Reimplements closeEvent
Expand Down

0 comments on commit 8a7df18

Please sign in to comment.