|
|
|
@ -253,60 +253,63 @@ class tmc_parser(gr.sync_block): |
|
|
|
print("symbol not decoded: "+"?%02X?"%ord(char)+"in string:"+return_string) |
|
|
|
print("symbol not decoded: "+"?%02X?"%ord(char)+"in string:"+return_string) |
|
|
|
pass |
|
|
|
pass |
|
|
|
return return_string |
|
|
|
return return_string |
|
|
|
|
|
|
|
def print_dbg(message,end="\n"): |
|
|
|
|
|
|
|
dbg=False |
|
|
|
|
|
|
|
if dbg: |
|
|
|
|
|
|
|
print(message,end=end) |
|
|
|
class tmc_parser_Widget(QtGui.QWidget): |
|
|
|
class tmc_parser_Widget(QtGui.QWidget): |
|
|
|
|
|
|
|
|
|
|
|
def print_tmc_msg(self,tmc_msg): |
|
|
|
def print_tmc_msg(self,tmc_msg): |
|
|
|
print("print:",end="") |
|
|
|
|
|
|
|
self.logMutex.acquire(1) |
|
|
|
self.logMutex.acquire(1) |
|
|
|
print("got mutex,",end="") |
|
|
|
print_dbg("print:got mutex,",end="") |
|
|
|
sb=self.logOutput.verticalScrollBar() |
|
|
|
sb=self.logOutput.verticalScrollBar() |
|
|
|
print(".",end="") |
|
|
|
print_dbg(".",end="") |
|
|
|
oldmax=sb.maximum() |
|
|
|
oldmax=sb.maximum() |
|
|
|
print(".",end="") |
|
|
|
print_dbg(".",end="") |
|
|
|
auto_scroll= abs(oldmax-sb.value())<60#auto_scroll if scrollbar was at max |
|
|
|
auto_scroll= abs(oldmax-sb.value())<60#auto_scroll if scrollbar was at max |
|
|
|
print(".",end="") |
|
|
|
print_dbg(".",end="") |
|
|
|
#print("%i %i %r"%(sb.maximum(),sb.value(),auto_scroll)) |
|
|
|
|
|
|
|
ef=unicode(self.event_filter.text().toUtf8(), encoding="UTF-8").lower() |
|
|
|
ef=unicode(self.event_filter.text().toUtf8(), encoding="UTF-8").lower() |
|
|
|
lf=unicode(self.location_filter.text().toUtf8(), encoding="UTF-8").lower() |
|
|
|
lf=unicode(self.location_filter.text().toUtf8(), encoding="UTF-8").lower() |
|
|
|
filters=[{"type":"location", "str":lf},{"type":"event", "str":ef}] |
|
|
|
filters=[{"type":"location", "str":lf},{"type":"event", "str":ef}] |
|
|
|
if tmc_dict.matchFilter(tmc_msg,filters): |
|
|
|
if tmc_dict.matchFilter(tmc_msg,self.showInvalid,filters): |
|
|
|
print("a",end="") |
|
|
|
print_dbg("a",end="") |
|
|
|
self.logOutput.append(Qt.QString.fromUtf8(tmc_msg.log_string())) |
|
|
|
self.logOutput.append(Qt.QString.fromUtf8(tmc_msg.log_string())) |
|
|
|
print("a",end="") |
|
|
|
print_dbg("a",end="") |
|
|
|
self.logOutput.append(Qt.QString.fromUtf8(tmc_msg.multi_str())) |
|
|
|
self.logOutput.append(Qt.QString.fromUtf8(tmc_msg.multi_str())) |
|
|
|
print("a",end="") |
|
|
|
print_dbg("a",end="") |
|
|
|
#print("new message") |
|
|
|
|
|
|
|
if auto_scroll: |
|
|
|
if auto_scroll: |
|
|
|
#sb=self.logOutput.verticalScrollBar() #disabled 2017-04-28 might be cause of double free |
|
|
|
#sb=self.logOutput.verticalScrollBar() #disabled 2017-04-28 might be cause of double free |
|
|
|
new_max=sb.maximum() |
|
|
|
new_max=sb.maximum() |
|
|
|
print("s",end="") |
|
|
|
print_dbg("s",end="") |
|
|
|
sb.setValue(new_max) |
|
|
|
sb.setValue(new_max) |
|
|
|
print("s",end="") |
|
|
|
print_dbg("s",end="") |
|
|
|
print("\tdone") |
|
|
|
|
|
|
|
# code.interact(local=locals()) |
|
|
|
|
|
|
|
#print("scrolling %i %i %r"%(oldmax,new_max,sb.value())) |
|
|
|
|
|
|
|
#code.interact(local=locals()) |
|
|
|
|
|
|
|
self.logMutex.release(1) |
|
|
|
self.logMutex.release(1) |
|
|
|
|
|
|
|
print_dbg("\tdone") |
|
|
|
|
|
|
|
|
|
|
|
def filterChanged(self): |
|
|
|
def filterChanged(self): |
|
|
|
print("filterChanged:",end="") |
|
|
|
|
|
|
|
self.logMutex.acquire(1) |
|
|
|
self.logMutex.acquire(1) |
|
|
|
print("got mutex,",end="") |
|
|
|
#code.interact(local=locals()) |
|
|
|
|
|
|
|
print_dbg("filterChanged:got mutex,",end="") |
|
|
|
ef="" |
|
|
|
ef="" |
|
|
|
lf="" |
|
|
|
lf="" |
|
|
|
try: |
|
|
|
try: |
|
|
|
ef=unicode(self.event_filter.text().toUtf8(), encoding="UTF-8").lower() |
|
|
|
ef=unicode(self.event_filter.text().toUtf8(), encoding="UTF-8").lower() |
|
|
|
lf=unicode(self.location_filter.text().toUtf8(), encoding="UTF-8").lower() |
|
|
|
lf=unicode(self.location_filter.text().toUtf8(), encoding="UTF-8").lower() |
|
|
|
except Exception as e: |
|
|
|
except Exception as e: |
|
|
|
print(e) |
|
|
|
print_dbg(e) |
|
|
|
print("error getting filter strings") |
|
|
|
print_dbg("error getting filter strings") |
|
|
|
code.interact(local=locals()) |
|
|
|
code.interact(local=locals()) |
|
|
|
print("read filters,",end="") |
|
|
|
print_dbg("read filters,",end="") |
|
|
|
self.logOutput.clear() |
|
|
|
self.logOutput.clear() |
|
|
|
print("cleared,",end="") |
|
|
|
print_dbg("cleared,",end="") |
|
|
|
filters=[{"type":"location", "str":lf},{"type":"event", "str":ef}] |
|
|
|
filters=[{"type":"location", "str":lf},{"type":"event", "str":ef}] |
|
|
|
self.logOutput.append(Qt.QString.fromUtf8(self.parser.tmc_messages.getLogString(filters))) |
|
|
|
#print("getting logstring with filters:%s, showInvalid:%i"%(filters,self.showInvalid)) |
|
|
|
print("appended,",end="") |
|
|
|
self.logOutput.append(Qt.QString.fromUtf8(self.parser.tmc_messages.getLogString(self.showInvalid,filters))) |
|
|
|
|
|
|
|
print_dbg("appended,",end="") |
|
|
|
self.logMutex.release(1) |
|
|
|
self.logMutex.release(1) |
|
|
|
print("done") |
|
|
|
print_dbg("done") |
|
|
|
|
|
|
|
def update_showInvalid(self): |
|
|
|
|
|
|
|
self.showInvalid=self.GUI_showInvalid.isChecked() |
|
|
|
def __init__(self, parser,maxheight): |
|
|
|
def __init__(self, parser,maxheight): |
|
|
|
QtGui.QWidget.__init__(self) |
|
|
|
QtGui.QWidget.__init__(self) |
|
|
|
layout = Qt.QVBoxLayout() |
|
|
|
layout = Qt.QVBoxLayout() |
|
|
|
@ -318,13 +321,18 @@ class tmc_parser_Widget(QtGui.QWidget): |
|
|
|
self.location_filter=QtGui.QLineEdit(u"Baden-Württemberg") |
|
|
|
self.location_filter=QtGui.QLineEdit(u"Baden-Württemberg") |
|
|
|
self.event_filter.returnPressed.connect(self.filterChanged) |
|
|
|
self.event_filter.returnPressed.connect(self.filterChanged) |
|
|
|
self.location_filter.returnPressed.connect(self.filterChanged) |
|
|
|
self.location_filter.returnPressed.connect(self.filterChanged) |
|
|
|
|
|
|
|
self.showInvalid=False |
|
|
|
|
|
|
|
self.GUI_showInvalid=QtGui.QCheckBox() |
|
|
|
|
|
|
|
self.GUI_showInvalid.setChecked(self.showInvalid) |
|
|
|
|
|
|
|
#self.showInvalid.stateChanged.connect(lambda:self.btnstate(self.b1)) |
|
|
|
|
|
|
|
self.GUI_showInvalid.stateChanged.connect(self.update_showInvalid) |
|
|
|
filter_layout = Qt.QHBoxLayout() |
|
|
|
filter_layout = Qt.QHBoxLayout() |
|
|
|
filter_layout.addWidget(QtGui.QLabel("event filter:")) |
|
|
|
filter_layout.addWidget(QtGui.QLabel("event filter:")) |
|
|
|
filter_layout.addWidget(self.event_filter) |
|
|
|
filter_layout.addWidget(self.event_filter) |
|
|
|
filter_layout.addWidget(QtGui.QLabel("location filter:")) |
|
|
|
filter_layout.addWidget(QtGui.QLabel("location filter:")) |
|
|
|
filter_layout.addWidget(self.location_filter) |
|
|
|
filter_layout.addWidget(self.location_filter) |
|
|
|
|
|
|
|
filter_layout.addWidget(QtGui.QLabel("showInvalid:")) |
|
|
|
|
|
|
|
filter_layout.addWidget(self.GUI_showInvalid) |
|
|
|
layout.addLayout(filter_layout) |
|
|
|
layout.addLayout(filter_layout) |
|
|
|
layout.addWidget(self.tmc_message_label) |
|
|
|
layout.addWidget(self.tmc_message_label) |
|
|
|
self.logOutput = Qt.QTextEdit() |
|
|
|
self.logOutput = Qt.QTextEdit() |
|
|
|
|