foo and bar and tried to change dump window size
This commit is contained in:
parent
39ae53f598
commit
6486a586e0
|
@ -6,14 +6,14 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>811</width>
|
<width>640</width>
|
||||||
<height>606</height>
|
<height>480</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<family>Monospace</family>
|
<family>Monospace</family>
|
||||||
<pointsize>14</pointsize>
|
<pointsize>12</pointsize>
|
||||||
<italic>true</italic>
|
<italic>true</italic>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
|
@ -28,8 +28,8 @@
|
||||||
<widget class="QGraphicsView" name="graphics_view">
|
<widget class="QGraphicsView" name="graphics_view">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>785</width>
|
<width>640</width>
|
||||||
<height>580</height>
|
<height>480</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="palette">
|
<property name="palette">
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# Form implementation generated from reading ui file 'dump_grabber.ui'
|
# Form implementation generated from reading ui file 'dump_grabber.ui'
|
||||||
#
|
#
|
||||||
# Created: Wed Dec 3 17:45:11 2014
|
# Created: Wed Dec 3 19:47:52 2014
|
||||||
# by: PyQt4 UI code generator 4.10.4
|
# by: PyQt4 UI code generator 4.10.4
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
@ -26,10 +26,10 @@ except AttributeError:
|
||||||
class Ui_MainWindow(object):
|
class Ui_MainWindow(object):
|
||||||
def setupUi(self, MainWindow):
|
def setupUi(self, MainWindow):
|
||||||
MainWindow.setObjectName(_fromUtf8("MainWindow"))
|
MainWindow.setObjectName(_fromUtf8("MainWindow"))
|
||||||
MainWindow.resize(811, 606)
|
MainWindow.resize(640, 480)
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily(_fromUtf8("Monospace"))
|
font.setFamily(_fromUtf8("Monospace"))
|
||||||
font.setPointSize(14)
|
font.setPointSize(12)
|
||||||
font.setItalic(True)
|
font.setItalic(True)
|
||||||
MainWindow.setFont(font)
|
MainWindow.setFont(font)
|
||||||
self.centralwidget = QtGui.QWidget(MainWindow)
|
self.centralwidget = QtGui.QWidget(MainWindow)
|
||||||
|
@ -39,7 +39,7 @@ class Ui_MainWindow(object):
|
||||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
self.horizontalLayout = QtGui.QHBoxLayout()
|
||||||
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
|
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
|
||||||
self.graphics_view = QtGui.QGraphicsView(self.centralwidget)
|
self.graphics_view = QtGui.QGraphicsView(self.centralwidget)
|
||||||
self.graphics_view.setMinimumSize(QtCore.QSize(785, 580))
|
self.graphics_view.setMinimumSize(QtCore.QSize(640, 480))
|
||||||
palette = QtGui.QPalette()
|
palette = QtGui.QPalette()
|
||||||
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
|
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
|
||||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||||
|
|
|
@ -58,13 +58,13 @@ class ExclusiveTextStorage(object):
|
||||||
self.column_width = column_width
|
self.column_width = column_width
|
||||||
self.line_height = line_height
|
self.line_height = line_height
|
||||||
self.graphics_scene = scene
|
self.graphics_scene = scene
|
||||||
self.num_lines, self.offset = divmod(576, self.line_height)
|
self.num_lines, self.offset = divmod(480, self.line_height)
|
||||||
self.data = deque()
|
self.data = deque()
|
||||||
|
|
||||||
def init_columns(self):
|
def init_columns(self):
|
||||||
color = self.colors[0]
|
color = self.colors[0]
|
||||||
for line_index in range(self.num_lines):
|
for line_index in range(self.num_lines):
|
||||||
text_item = self.graphics_scene.addSimpleText("", self.default_font)
|
text_item = self.graphics_scene.addSimpleText("fooooo", self.default_font)
|
||||||
text_item.setBrush(color)
|
text_item.setBrush(color)
|
||||||
text_item.setPos(0, line_index * self.line_height)
|
text_item.setPos(0, line_index * self.line_height)
|
||||||
self.lines.append(text_item)
|
self.lines.append(text_item)
|
||||||
|
@ -89,8 +89,7 @@ class ExclusiveTextStorage(object):
|
||||||
self.data.append((column, text))
|
self.data.append((column, text))
|
||||||
|
|
||||||
|
|
||||||
class MainWindow(QtGui.QMainWindow, Ui_MainWindow,
|
class MainWindow(QtGui.QMainWindow, Ui_MainWindow, PsyQtChaoscClientBase):
|
||||||
MjpegStreamingConsumerInterface, PsyQtChaoscClientBase):
|
|
||||||
|
|
||||||
"""This app receives per actor osc messages and provides an mjpeg stream
|
"""This app receives per actor osc messages and provides an mjpeg stream
|
||||||
with colored text representation arranged in columns"""
|
with colored text representation arranged in columns"""
|
||||||
|
@ -99,9 +98,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow,
|
||||||
self.args = args
|
self.args = args
|
||||||
super(MainWindow, self).__init__()
|
super(MainWindow, self).__init__()
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
self.http_server = MjpegStreamingServer(
|
|
||||||
(args.http_host, args.http_port), self)
|
|
||||||
self.http_server.listen(port=args.http_port)
|
|
||||||
self.graphics_view.setHorizontalScrollBarPolicy(
|
self.graphics_view.setHorizontalScrollBarPolicy(
|
||||||
QtCore.Qt.ScrollBarAlwaysOff)
|
QtCore.Qt.ScrollBarAlwaysOff)
|
||||||
self.graphics_view.setVerticalScrollBarPolicy(
|
self.graphics_view.setVerticalScrollBarPolicy(
|
||||||
|
@ -109,33 +106,32 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow,
|
||||||
self.graphics_view.setRenderHint(QtGui.QPainter.Antialiasing, True)
|
self.graphics_view.setRenderHint(QtGui.QPainter.Antialiasing, True)
|
||||||
self.graphics_view.setFrameStyle(QtGui.QFrame.NoFrame)
|
self.graphics_view.setFrameStyle(QtGui.QFrame.NoFrame)
|
||||||
self.graphics_scene = QtGui.QGraphicsScene(self)
|
self.graphics_scene = QtGui.QGraphicsScene(self)
|
||||||
self.graphics_scene.setSceneRect(0, 0, 775, 580)
|
self.graphics_scene.setSceneRect(0, 0, 640, 480)
|
||||||
self.graphics_view.setScene(self.graphics_scene)
|
self.graphics_view.setScene(self.graphics_scene)
|
||||||
self.default_font = QtGui.QFont("Monospace", 14)
|
self.default_font = QtGui.QFont("Monospace", 12)
|
||||||
self.default_font.setStyleHint(QtGui.QFont.Monospace)
|
self.default_font.setStyleHint(QtGui.QFont.Monospace)
|
||||||
self.default_font.setBold(True)
|
self.default_font.setBold(True)
|
||||||
self.graphics_scene.setFont(self.default_font)
|
self.graphics_scene.setFont(self.default_font)
|
||||||
self.font_metrics = QtGui.QFontMetrics(self.default_font)
|
self.font_metrics = QtGui.QFontMetrics(self.default_font)
|
||||||
self.line_height = self.font_metrics.height()
|
self.line_height = self.font_metrics.height()
|
||||||
columns = 3
|
columns = 3
|
||||||
self.column_width = 775 / columns
|
self.column_width = 640 / columns
|
||||||
self.text_storage = ExclusiveTextStorage(columns, self.default_font,
|
self.text_storage = ExclusiveTextStorage(columns, self.default_font,
|
||||||
self.column_width,
|
self.column_width,
|
||||||
self.line_height,
|
self.line_height,
|
||||||
self.graphics_scene)
|
self.graphics_scene)
|
||||||
self.text_storage.init_columns()
|
self.text_storage.init_columns()
|
||||||
self.regex = re.compile("^/(uwe|merle|bjoern)/(.*?)$")
|
self.regex = re.compile("^/(uwe|merle|bjoern)/(.*?)$")
|
||||||
|
self.osc_sock.readyRead.connect(self.got_message)
|
||||||
|
self.timer = QtCore.QTimer()
|
||||||
|
self.timer.timeout.connect(self.render_image)
|
||||||
|
self.timer.start(100)
|
||||||
|
|
||||||
def pubdir(self):
|
def pubdir(self):
|
||||||
return os.path.dirname(os.path.abspath(__file__))
|
return os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
def closeEvent(self, event):
|
def closeEvent(self, event):
|
||||||
msg = OSCMessage("/unsubscribe")
|
self.unsubscribe()
|
||||||
msg.appendTypedArg("localhost", "s")
|
|
||||||
msg.appendTypedArg(self.args.client_port, "i")
|
|
||||||
msg.appendTypedArg(self.args.authenticate, "s")
|
|
||||||
self.osc_sock.writeDatagram(
|
|
||||||
QByteArray(msg.encode_osc()), QHostAddress("127.0.0.1"), 7110)
|
|
||||||
|
|
||||||
def handle_osc_error(self, error):
|
def handle_osc_error(self, error):
|
||||||
logger.info("osc socket error %d", error)
|
logger.info("osc socket error %d", error)
|
||||||
|
@ -144,24 +140,31 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow,
|
||||||
self.text_storage.add_text(column, text)
|
self.text_storage.add_text(column, text)
|
||||||
|
|
||||||
def render_image(self):
|
def render_image(self):
|
||||||
|
#print "render_iamge"
|
||||||
self.text_storage.finish()
|
self.text_storage.finish()
|
||||||
image = QPixmap(768, 576)
|
#image = QPixmap(768, 576)
|
||||||
image.fill(QtCore.Qt.black)
|
#image.fill(QtCore.Qt.black)
|
||||||
painter = QPainter(image)
|
#painter = QPainter(image)
|
||||||
painter.setRenderHints(QPainter.RenderHint(
|
#painter.setRenderHints(QPainter.RenderHint(
|
||||||
QPainter.Antialiasing | QPainter.TextAntialiasing), True)
|
# QPainter.Antialiasing | QPainter.TextAntialiasing), True)
|
||||||
painter.setFont(self.default_font)
|
#painter.setFont(self.default_font)
|
||||||
self.graphics_view.render(
|
#self.graphics_view.render(
|
||||||
painter, target=QtCore.QRectF(0, 0, 768, 576),
|
# painter, target=QtCore.QRectF(0, 0, 768, 576),
|
||||||
source=QtCore.QRect(0, 0, 768, 576))
|
# source=QtCore.QRect(0, 0, 768, 576))
|
||||||
painter.end()
|
#painter.end()
|
||||||
buf = QBuffer()
|
#buf = QBuffer()
|
||||||
buf.open(QIODevice.WriteOnly)
|
#buf.open(QIODevice.WriteOnly)
|
||||||
image.save(buf, "JPG", 100)
|
#image.save(buf, "JPG", 100)
|
||||||
image_data = buf.data()
|
#image_data = buf.data()
|
||||||
return image_data
|
#return image_data
|
||||||
|
|
||||||
def got_message(self):
|
def got_message(self):
|
||||||
|
def convert(value):
|
||||||
|
if isinstance(value, float):
|
||||||
|
return "%.1f" % value
|
||||||
|
else:
|
||||||
|
return str(value)
|
||||||
|
|
||||||
while self.osc_sock.hasPendingDatagrams():
|
while self.osc_sock.hasPendingDatagrams():
|
||||||
data, address, port = self.osc_sock.readDatagram(
|
data, address, port = self.osc_sock.readDatagram(
|
||||||
self.osc_sock.pendingDatagramSize())
|
self.osc_sock.pendingDatagramSize())
|
||||||
|
@ -176,13 +179,13 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow,
|
||||||
else:
|
else:
|
||||||
if actor == "merle":
|
if actor == "merle":
|
||||||
self.add_text(0, "%s = %s" % (
|
self.add_text(0, "%s = %s" % (
|
||||||
text, ", ".join([str(i) for i in args])))
|
text, ", ".join([convert(i) for i in args])))
|
||||||
elif actor == "uwe":
|
elif actor == "uwe":
|
||||||
self.add_text(1, "%s = %s" % (
|
self.add_text(1, "%s = %s" % (
|
||||||
text, ", ".join([str(i) for i in args])))
|
text, ", ".join([convert(i) for i in args])))
|
||||||
elif actor == "bjoern":
|
elif actor == "bjoern":
|
||||||
self.add_text(2, "%s = %s" % (
|
self.add_text(2, "%s = %s" % (
|
||||||
text, ", ".join([str(i) for i in args])))
|
text, ", ".join([convert(i) for i in args])))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -198,12 +201,13 @@ def main():
|
||||||
arg_parser.add_subscriber_group()
|
arg_parser.add_subscriber_group()
|
||||||
args = arg_parser.finalize()
|
args = arg_parser.finalize()
|
||||||
|
|
||||||
args.http_host, args.http_port = resolve_host(
|
#args.http_host, args.http_port = resolve_host(
|
||||||
args.http_host, args.http_port, args.address_family)
|
# args.http_host, args.http_port, args.address_family)
|
||||||
args.chaosc_host, args.chaosc_port = resolve_host(
|
#args.chaosc_host, args.chaosc_port = resolve_host(
|
||||||
args.chaosc_host, args.chaosc_port, args.address_family)
|
# args.chaosc_host, args.chaosc_port, args.address_family)
|
||||||
|
|
||||||
window = MainWindow(args)
|
window = MainWindow(args)
|
||||||
|
window.setWindowFlags(QtCore.Qt.FramelessWindowHint)
|
||||||
window.show()
|
window.show()
|
||||||
sys.excepthook = window.sigint_handler
|
sys.excepthook = window.sigint_handler
|
||||||
signal.signal(signal.SIGTERM, window.sigterm_handler)
|
signal.signal(signal.SIGTERM, window.sigterm_handler)
|
||||||
|
|
|
@ -118,7 +118,7 @@ class EkgPlotWidget(QMainWindow):
|
||||||
self.max_actors = len(actor_names)
|
self.max_actors = len(actor_names)
|
||||||
self.actor_height = self.max_value / self.max_actors
|
self.actor_height = self.max_value / self.max_actors
|
||||||
self.fps = 12.5
|
self.fps = 12.5
|
||||||
self.num_data = 640
|
self.num_data = 100
|
||||||
self.plot_widget.showGrid(False, False)
|
self.plot_widget.showGrid(False, False)
|
||||||
self.plot_widget.setYRange(0, 255)
|
self.plot_widget.setYRange(0, 255)
|
||||||
self.plot_widget.setXRange(0, self.num_data)
|
self.plot_widget.setXRange(0, self.num_data)
|
||||||
|
@ -196,7 +196,7 @@ class EkgPlotWidget(QMainWindow):
|
||||||
actor_name = res.group(1)
|
actor_name = res.group(1)
|
||||||
actor_obj = self.actors[actor_name]
|
actor_obj = self.actors[actor_name]
|
||||||
actor_obj.add_value(args[0])
|
actor_obj.add_value(args[0])
|
||||||
# logger.info("actor: %r, %r", actor_name, args)
|
logger.info("actor: %r, %r", actor_name, args)
|
||||||
|
|
||||||
def render_image(self):
|
def render_image(self):
|
||||||
for actor_obj in self.active_actors:
|
for actor_obj in self.active_actors:
|
||||||
|
@ -212,6 +212,7 @@ class EkgPlotWidget(QMainWindow):
|
||||||
def got_message(self):
|
def got_message(self):
|
||||||
while self.osc_sock.hasPendingDatagrams():
|
while self.osc_sock.hasPendingDatagrams():
|
||||||
data, address, port = self.osc_sock.readDatagram(self.osc_sock.pendingDatagramSize())
|
data, address, port = self.osc_sock.readDatagram(self.osc_sock.pendingDatagramSize())
|
||||||
|
print data,address,port
|
||||||
try:
|
try:
|
||||||
osc_address, typetags, args = decode_osc(data, 0, len(data))
|
osc_address, typetags, args = decode_osc(data, 0, len(data))
|
||||||
self.update(osc_address, args)
|
self.update(osc_address, args)
|
||||||
|
@ -234,6 +235,7 @@ def main():
|
||||||
args.chaosc_host, args.chaosc_port = resolve_host(args.chaosc_host, args.chaosc_port, args.address_family)
|
args.chaosc_host, args.chaosc_port = resolve_host(args.chaosc_host, args.chaosc_port, args.address_family)
|
||||||
|
|
||||||
window = EkgPlotWidget(args)
|
window = EkgPlotWidget(args)
|
||||||
|
window.setWindowFlags(QtCore.Qt.FramelessWindowHint)
|
||||||
logger.info("foooooooo")
|
logger.info("foooooooo")
|
||||||
window.setWindowTitle("EKGPlotterMain")
|
window.setWindowTitle("EKGPlotterMain")
|
||||||
window.show()
|
window.show()
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
dump_grabber -H 192.168.1.23 -P 7110 -s -o 192.168.1.34 -p 6001 -L -4
|
||||||
|
#dump_grabber -H chaosc -P 7110 -s -o 192.168.1.34 -p 6001 -L -4
|
||||||
|
|
||||||
|
|
||||||
|
#vlc --no-audio --video-on-top --no-video-title-show --no-osd \
|
||||||
|
# --repeat --qt-notification 0 --no-video-deco --autoscale \
|
||||||
|
# http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
ekgplotter -o 192.168.1.34 -p 6002 -L
|
||||||
|
|
||||||
|
#vlc --no-audio --video-on-top --no-video-title-show --no-osd \
|
||||||
|
# --repeat --qt-notification 0 --no-video-deco --autoscale \
|
||||||
|
# http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
vlc --no-audio --video-on-top --no-video-title-show --no-osd \
|
||||||
|
--repeat --qt-notification 0 --no-video-deco --autoscale \
|
||||||
|
http://walterebert.com/playground/video/hls/sintel-trailer.m3u8
|
|
@ -84,7 +84,8 @@ class PsyQtChaoscClientBase(PsyQtClientBase):
|
||||||
def subscribe(self):
|
def subscribe(self):
|
||||||
logger.info("subscribe")
|
logger.info("subscribe")
|
||||||
msg = OSCMessage("/subscribe")
|
msg = OSCMessage("/subscribe")
|
||||||
msg.appendTypedArg("localhost", "s")
|
logger.info(self.args.client_host)
|
||||||
|
msg.appendTypedArg(self.args.client_host, "s")
|
||||||
msg.appendTypedArg(self.args.client_port, "i")
|
msg.appendTypedArg(self.args.client_port, "i")
|
||||||
msg.appendTypedArg(self.args.authenticate, "s")
|
msg.appendTypedArg(self.args.authenticate, "s")
|
||||||
if self.args.subscriber_label is not None:
|
if self.args.subscriber_label is not None:
|
||||||
|
@ -94,7 +95,7 @@ class PsyQtChaoscClientBase(PsyQtClientBase):
|
||||||
def unsubscribe(self):
|
def unsubscribe(self):
|
||||||
logger.info("unsubscribe")
|
logger.info("unsubscribe")
|
||||||
msg = OSCMessage("/unsubscribe")
|
msg = OSCMessage("/unsubscribe")
|
||||||
msg.appendTypedArg("localhost", "s")
|
msg.appendTypedArg(self.args.client_host, "s")
|
||||||
msg.appendTypedArg(self.args.client_port, "i")
|
msg.appendTypedArg(self.args.client_port, "i")
|
||||||
msg.appendTypedArg(self.args.authenticate, "s")
|
msg.appendTypedArg(self.args.authenticate, "s")
|
||||||
self.osc_sock.writeDatagram(QByteArray(msg.encode_osc()), QHostAddress(self.args.chaosc_host), self.args.chaosc_port)
|
self.osc_sock.writeDatagram(QByteArray(msg.encode_osc()), QHostAddress(self.args.chaosc_host), self.args.chaosc_port)
|
||||||
|
|
Loading…
Reference in New Issue