small changes to texter and ekgplotter

This commit is contained in:
Stefan Kögl 2014-05-02 13:53:42 +02:00
parent ca1d492198
commit 28cc9798e7
4 changed files with 74 additions and 12 deletions

View File

@ -52,6 +52,69 @@ except ImportError as e:
from chaosc.osc_lib import OSCMessage, decode_osc
class Generator(object):
def __init__(self):
self.count = 0
self.max_count = 200
self.min_puls = 75
self.max_pulse = 160
self.pulse = 83
def run(self):
data_points = 0
min_puls = 70
max_pulse = 130
pulse = random.randint(min_puls, max_pulse)
steps, sleep_time = get_steps(pulse, sleep_time)
count = 0
delta = 1
result = list()
print "pulse", pulse
print "sleep_time", sleep_time
print "steps", steps
while 1:
value = random.randint(0, steps)
if count < int(steps / 100. * 20):
value = random.randint(0,20)
elif count < int(steps / 100. * 30):
value = random.randint(20, 30)
elif count < int(steps / 100. * 40):
value = random.randint(30,100)
elif count < int(steps / 2.):
value = random.randint(100,200)
elif count == int(steps / 2.):
value = 255
elif count < int(steps / 100. * 60):
value = random.randint(100, 200)
elif count < int(steps / 100. * 70):
value = random.randint(50, 100)
elif count < int(steps / 100. * 80):
value = random.randint(20, 50)
elif count <= steps:
value = random.randint(0,20)
elif count >= steps:
count = 0
#if data_points % (5 * steps) == 0:
#print "new steps", steps, delta
#steps += delta
#if steps <= min_steps:
#delta = 1
#elif steps >= max_steps:
#print "change step sign", steps, delta
#delta = -1
time.sleep(sleep_time)
count += 1
#data_points += 1
serial_sock.write(struct.pack("B", value))
class OSCThread(threading.Thread):
def __init__(self, args):
super(OSCThread, self).__init__()
@ -266,7 +329,7 @@ class MyHandler(BaseHTTPRequestHandler):
self.thread = thread = OSCThread(self.server.args)
thread.daemon = True
thread.start()
actor_names = ["bjoern", "uwe", "merle"]
actor_names = ["merle", "uwe", "bjoern" ]
num_data = 100
colors = ["r", "g", "b"]
qtapp = QtGui.QApplication([])
@ -339,7 +402,6 @@ def main():
arg_parser.add_subscriber_group()
args = arg_parser.finalize()
http_host, http_port = resolve_host(args.http_host, args.http_port, args.address_family)
server = JustAHTTPServer((http_host, http_port), MyHandler)

View File

@ -559,7 +559,7 @@ class MainWindow(KMainWindow, Ui_MainWindow):
public_rect = self.live_text.geometry()
global_rect = QtCore.QRect(self.mapToGlobal(public_rect.topLeft()), self.mapToGlobal(public_rect.bottomRight()))
self.ffserver = subprocess.Popen("ffserver -f /etc/ffserver.conf", shell=True, close_fds=True)
self.ffmpeg = subprocess.Popen("ffmpeg -f x11grab -s 768x576 -r 30 -i :0.0+%d,%d -vcodec mjpeg -pix_fmt yuvj444p -r 30 -aspect 4:3 http://localhost:8090/webcam.ffm" % (global_rect.x()+5, global_rect.y()+5), shell=True, close_fds=True)
self.ffmpeg = subprocess.Popen("ffmpeg -f x11grab -show_region 1 -s 768x576 -r 30 -i :0.0+%d,%d -vcodec mjpeg -pix_fmt yuvj444p -r 30 -aspect 4:3 http://localhost:8090/webcam.ffm" % (global_rect.x()+3, global_rect.y()+3), shell=True, close_fds=True)
self.is_streaming = True
def focusChanged(self, old, new):

View File

@ -90,13 +90,13 @@
<property name="minimumSize">
<size>
<width>775</width>
<height>578</height>
<height>582</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>775</width>
<height>578</height>
<height>582</height>
</size>
</property>
<property name="palette">
@ -248,13 +248,13 @@
<property name="minimumSize">
<size>
<width>300</width>
<height>577</height>
<height>582</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>769</width>
<height>577</height>
<width>775</width>
<height>582</height>
</size>
</property>
<property name="palette">

View File

@ -57,8 +57,8 @@ class Ui_MainWindow(object):
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.live_text = KRichTextWidget(self.centralwidget)
self.live_text.setMinimumSize(QtCore.QSize(775, 578))
self.live_text.setMaximumSize(QtCore.QSize(775, 578))
self.live_text.setMinimumSize(QtCore.QSize(775, 582))
self.live_text.setMaximumSize(QtCore.QSize(775, 582))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)
@ -111,8 +111,8 @@ class Ui_MainWindow(object):
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.preview_text.sizePolicy().hasHeightForWidth())
self.preview_text.setSizePolicy(sizePolicy)
self.preview_text.setMinimumSize(QtCore.QSize(300, 577))
self.preview_text.setMaximumSize(QtCore.QSize(769, 577))
self.preview_text.setMinimumSize(QtCore.QSize(300, 582))
self.preview_text.setMaximumSize(QtCore.QSize(769, 582))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
brush.setStyle(QtCore.Qt.SolidPattern)