|
|
|
|
@ -22,26 +22,30 @@
|
|
|
|
|
from __future__ import print_function#print without newline print('.', end="") |
|
|
|
|
|
|
|
|
|
from gnuradio import gr |
|
|
|
|
import pmt,functools,csv,md5,collections,copy,sqlite3,atexit,time,re,sys |
|
|
|
|
import pmt,functools,csv,collections,copy,sqlite3,atexit,time,re,sys,hashlib |
|
|
|
|
#old imports: folium |
|
|
|
|
from datetime import datetime |
|
|
|
|
from datetime import timedelta |
|
|
|
|
import multirds.chart as chart |
|
|
|
|
|
|
|
|
|
from multirds.tmc_classes import language#supported: de, en (both partially) |
|
|
|
|
|
|
|
|
|
from PyQt4 import Qt, QtCore, QtGui |
|
|
|
|
from PyQt5 import Qt, QtCore, QtGui, QtWidgets |
|
|
|
|
import pprint,code |
|
|
|
|
pp = pprint.PrettyPrinter() |
|
|
|
|
import cProfile, pstats, StringIO #for profiling |
|
|
|
|
import cProfile, pstats #for profiling |
|
|
|
|
from io import StringIO #py3 |
|
|
|
|
pr = cProfile.Profile() |
|
|
|
|
|
|
|
|
|
#from threading import Timer#to periodically save DB |
|
|
|
|
|
|
|
|
|
from PyQt4.QtCore import QObject, pyqtSignal |
|
|
|
|
from PyQt5.QtCore import QObject, pyqtSignal |
|
|
|
|
from bitstring import BitArray |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class rds_parser_table_qt_Signals(QObject): |
|
|
|
|
DataUpdateEvent = QtCore.pyqtSignal(dict) |
|
|
|
|
def __init__(self, parent=None): |
|
|
|
|
@ -127,18 +131,18 @@ class rds_parser_table_qt(gr.sync_block):#START
|
|
|
|
|
# (time text,PI text,rtp_string text)''') |
|
|
|
|
reader = csv.reader(open(self.workdir+'RDS_ODA-AIDs_names_only.csv'), |
|
|
|
|
delimiter=',', quotechar='"') |
|
|
|
|
reader.next()#skip header |
|
|
|
|
next(reader)#skip header |
|
|
|
|
for row in reader: |
|
|
|
|
self.ODA_application_names[int(row[0])]=row[1] |
|
|
|
|
#read RT+ class name list: |
|
|
|
|
reader = csv.reader(open(self.workdir+'RTplus_classnames.csv'), |
|
|
|
|
delimiter=',', quotechar='"') |
|
|
|
|
reader.next()#skip header |
|
|
|
|
next(reader)#skip header |
|
|
|
|
self.rtp_classnames=dict((int(rows[0]),rows[1]) for rows in reader) |
|
|
|
|
#read TMC-event list |
|
|
|
|
reader = csv.reader(open(self.workdir+'event-list_with_forecast_sort.csv'), |
|
|
|
|
delimiter=',', quotechar='"') |
|
|
|
|
reader.next()#skip header |
|
|
|
|
next(reader)#skip header |
|
|
|
|
self.ecl_dict=dict((int(rows[0]),rows[1:]) for rows in reader) |
|
|
|
|
#Code,Text CEN-English,Text (German),Text (German) kein Quantifier,Text (Quantifier = 1),Text (Quantifier >1),N,Q,T,D,U,C,R ,Comment |
|
|
|
|
#N:nature (blank): information, F:forecast, S:silent |
|
|
|
|
@ -151,7 +155,7 @@ class rds_parser_table_qt(gr.sync_block):#START
|
|
|
|
|
#read update classes |
|
|
|
|
reader = csv.reader(open(self.workdir+'tmc_update_class_names.csv'), |
|
|
|
|
delimiter=',', quotechar='"') |
|
|
|
|
reader.next()#skip header, "code(C),english,german" |
|
|
|
|
next(reader)#skip header, "code(C),english,german" |
|
|
|
|
if language=="de": |
|
|
|
|
self.tmc_update_class_names=dict((int(rows[0]),rows[2]) |
|
|
|
|
for rows in reader)#german names |
|
|
|
|
@ -161,7 +165,7 @@ class rds_parser_table_qt(gr.sync_block):#START
|
|
|
|
|
#read supplementary information code list |
|
|
|
|
reader = csv.reader(open(self.workdir+'label6-supplementary-information-codes.csv'), |
|
|
|
|
delimiter=',', quotechar='"') |
|
|
|
|
reader.next()#skip header, "code,english,german" |
|
|
|
|
next(reader)#skip header, "code,english,german" |
|
|
|
|
if language=="de": |
|
|
|
|
self.label6_suppl_info=dict((int(rows[0]),rows[2]) |
|
|
|
|
for rows in reader)#german |
|
|
|
|
@ -171,7 +175,7 @@ class rds_parser_table_qt(gr.sync_block):#START
|
|
|
|
|
#read PTY list |
|
|
|
|
f=open(self.workdir+'pty-list.csv') |
|
|
|
|
reader = csv.reader(f, delimiter=',', quotechar='"') |
|
|
|
|
reader.next()#skip header |
|
|
|
|
next(reader)#skip header |
|
|
|
|
self.pty_dict=dict((int(rows[0]),unicode(rows[1],errors='ignore')) |
|
|
|
|
for rows in reader) |
|
|
|
|
f.close() |
|
|
|
|
@ -759,7 +763,7 @@ class rds_parser_table_qt(gr.sync_block):#START
|
|
|
|
|
})#this gnuradio instance doesnt seem to be able to convert from numpy.int64 to pmt |
|
|
|
|
self.message_port_pub(pmt.intern('tmc_raw'), send_pmt) |
|
|
|
|
|
|
|
|
|
#~ tmc_hash=md5.new(str([PI,tmc_x,tmc_y,tmc_z])).hexdigest() |
|
|
|
|
#~ tmc_hash=hashlib.md5(str([PI,tmc_x,tmc_y,tmc_z])).hexdigest() |
|
|
|
|
tmc_T=tmc_x>>4 #0:TMC-message 1:tuning info/service provider name |
|
|
|
|
#~ tmc_F=int((tmc_x>>3)&0x1) #identifies the message as a Single Group (F = 1) or Multi Group (F = 0) |
|
|
|
|
#~ Y15=int(tmc_y>>15) |
|
|
|
|
@ -1056,14 +1060,14 @@ class rds_parser_table_qt(gr.sync_block):#START
|
|
|
|
|
segmentcolor,text[start:end], |
|
|
|
|
textcolor,text[end:]) |
|
|
|
|
return formatted_text |
|
|
|
|
class rds_parser_table_qt_Widget(QtGui.QWidget): |
|
|
|
|
class rds_parser_table_qt_Widget(QtWidgets.QWidget): |
|
|
|
|
def __init__(self, signals,label,tableobj): |
|
|
|
|
#print("gui initializing")self.tableobj.RDS_data["D3A2"] |
|
|
|
|
self.signals = signals |
|
|
|
|
self.tableobj=tableobj |
|
|
|
|
self.signals.DataUpdateEvent.connect(self.display_data) |
|
|
|
|
""" Creates the QT Range widget """ |
|
|
|
|
QtGui.QWidget.__init__(self) |
|
|
|
|
QtWidgets.QWidget.__init__(self) |
|
|
|
|
layout = Qt.QVBoxLayout() |
|
|
|
|
#self.label = Qt.QLabel(label) |
|
|
|
|
#layout.addWidget(self.label)#title of table disabled to save space |
|
|
|
|
@ -1157,7 +1161,7 @@ class rds_parser_table_qt_Widget(QtGui.QWidget):
|
|
|
|
|
right_button.clicked.connect(functools.partial(self.setAudio2, row=rowPosition,audio_channel=2)) |
|
|
|
|
button_layout.addWidget(right_button) |
|
|
|
|
|
|
|
|
|
cellWidget = QtGui.QWidget() |
|
|
|
|
cellWidget = QtWidgets.QWidget() |
|
|
|
|
cellWidget.setLayout(button_layout) |
|
|
|
|
button_col=3 |
|
|
|
|
self.table.setCellWidget(rowPosition,button_col,cellWidget) |
|
|
|
|
|