Beispiel #1
0
def main(window_title=None, quit_on_eof=False):
	from trusas0.packing import default_unpacker, AsyncIter

	import sys
	import signal
	signal.signal(signal.SIGINT, signal.SIG_DFL)
	app = QApplication([])
	input = AsyncIter(default_unpacker())
	window = QMainWindow()
	plot = SignalPlot(parent=window)
	window.setCentralWidget(plot)
	if window_title:
		window.setWindowTitle(window_title)

	# TODO: Take from argument/environment
	base_ts = time.time()

	def consume():
		try:
			for header, obj in input:
				ts = header['ts']-base_ts
				plot.add_datum(ts, obj)
			plot.refresh()
		except EOFError:
			timer.stop()
			if quit_on_eof: app.quit()

	update_rate = 30
	timer = QTimer(); timer.timeout.connect(consume)
	timer.start(1/float(update_rate)*1000)
	
	window.show()
	app.exec_()
Beispiel #2
0
def main():
	unpacker = default_unpacker()
	packer = default_packer()

	for header, event in unpacker:
		mapped = map_from_android(event)
		if mapped is None: continue
		packer.send(mapped, header=header)
Beispiel #3
0
def main():
    unpacker = default_unpacker()
    packer = default_packer()

    for header, event in unpacker:
        mapped = map_from_android(event)
        if mapped is None: continue
        packer.send(mapped, header=header)