Browse Source

added auto_scroll to tmc_parser

master
Clemens Richter 9 years ago
parent
commit
6ec7ab5603
  1. 16
      grc/multirds_tmc_parser.xml
  2. 11
      python/tmc_parser.py

16
grc/multirds_tmc_parser.xml

@ -9,7 +9,7 @@
#if not $label()
#set $label = '"%s"'%$id
#end if
$(parser) = multirds.tmc_parser($workdir, $log, $debug, $writeDB,$maxheight)
$(parser) = multirds.tmc_parser($workdir, $log, $debug, $writeDB,$maxheight,$auto_scroll)
$(win) = $(parser).getqtwidget()
$(gui_hint()($win))
</make>
@ -66,6 +66,20 @@ $(gui_hint()($win))
<key>False</key>
</option>
</param>
<param>
<name>auto_scroll</name>
<key>auto_scroll</key>
<value>True</value>
<type>bool</type>
<option>
<name>Enable</name>
<key>True</key>
</option>
<option>
<name>Disable</name>
<key>False</key>
</option>
</param>
<param>
<name>write Database</name>
<key>writeDB</key>

11
python/tmc_parser.py

@ -33,7 +33,7 @@ class tmc_parser(gr.sync_block):
"""
docstring for block tmc_parser
"""
def __init__(self, workdir,log,debug,writeDB,maxheight):
def __init__(self, workdir,log,debug,writeDB,maxheight,auto_scroll):
gr.sync_block.__init__(self,
name="tmc_parser",
in_sig=None,
@ -42,7 +42,7 @@ class tmc_parser(gr.sync_block):
self.debug=debug
self.workdir=workdir
self.writeDB=writeDB
self.qtwidget=tmc_parser_Widget(self,maxheight)
self.qtwidget=tmc_parser_Widget(self,maxheight,auto_scroll)
self.message_port_register_in(pmt.intern('in'))
self.set_msg_handler(pmt.intern('in'), self.handle_msg)
self.tmc_meta={}
@ -251,6 +251,10 @@ class tmc_parser_Widget(QtGui.QWidget):
if self.parser.tmc_messages.matchFilter(tmc_msg,filters):
self.logOutput.append(Qt.QString.fromUtf8(tmc_msg.log_string()))
self.logOutput.append(Qt.QString.fromUtf8(tmc_msg.multi_str()))
if self.auto_scroll:
scroll_max=self.logOutput.verticalScrollBar().maximum()
self.logOutput.verticalScrollBar().setValue(scroll_max)
#code.interact(local=locals())
def updateui(self):
print("updating ui")
def filterChanged(self):
@ -260,11 +264,12 @@ class tmc_parser_Widget(QtGui.QWidget):
filters=[{"type":"location", "str":lf},{"type":"event", "str":ef}]
self.logOutput.append(Qt.QString.fromUtf8(self.parser.tmc_messages.getLogString(filters)))
print("filter changed")
def __init__(self, parser,maxheight):
def __init__(self, parser,maxheight,auto_scroll):
QtGui.QWidget.__init__(self)
layout = Qt.QVBoxLayout()
self.setLayout(layout)
self.parser=parser
self.auto_scroll=auto_scroll
self.tmc_message_label=QtGui.QLabel("TMC messages:")
self.event_filter=QtGui.QLineEdit()#QPlainTextEdit ?
self.location_filter=QtGui.QLineEdit(u"Baden-Württemberg")

Loading…
Cancel
Save