Files
@ 654c41ccf265
Branch filter:
Location: light9/bin/lightsim - annotation
654c41ccf265
3.6 KiB
text/plain
more draft UI for paint page
Ignore-this: 38d7781ae0c870578eee64cc17ec7eb8
Ignore-this: 38d7781ae0c870578eee64cc17ec7eb8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | b5efddd80dad 9d1f323fb3d3 9d1f323fb3d3 9d1f323fb3d3 f69ba5ac17c5 60b49f6c2027 60b49f6c2027 60b49f6c2027 60b49f6c2027 9d1f323fb3d3 60b49f6c2027 9d1f323fb3d3 9d1f323fb3d3 60b49f6c2027 f69ba5ac17c5 60b49f6c2027 60b49f6c2027 60b49f6c2027 60b49f6c2027 60b49f6c2027 60b49f6c2027 60b49f6c2027 9d1f323fb3d3 9d1f323fb3d3 9d1f323fb3d3 9d1f323fb3d3 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 60b49f6c2027 941cfe1e1691 941cfe1e1691 941cfe1e1691 941cfe1e1691 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 2d9c85c98be6 941cfe1e1691 941cfe1e1691 941cfe1e1691 941cfe1e1691 9d1f323fb3d3 941cfe1e1691 941cfe1e1691 941cfe1e1691 941cfe1e1691 941cfe1e1691 f69ba5ac17c5 f69ba5ac17c5 9d1f323fb3d3 60b49f6c2027 941cfe1e1691 941cfe1e1691 9d1f323fb3d3 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 941cfe1e1691 941cfe1e1691 941cfe1e1691 941cfe1e1691 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 941cfe1e1691 f69ba5ac17c5 f69ba5ac17c5 941cfe1e1691 f69ba5ac17c5 60b49f6c2027 f69ba5ac17c5 f69ba5ac17c5 9d1f323fb3d3 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 60b49f6c2027 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 60b49f6c2027 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 f69ba5ac17c5 941cfe1e1691 60b49f6c2027 60b49f6c2027 60b49f6c2027 60b49f6c2027 941cfe1e1691 f69ba5ac17c5 60b49f6c2027 60b49f6c2027 46d319974176 f69ba5ac17c5 f69ba5ac17c5 60b49f6c2027 60b49f6c2027 60b49f6c2027 | #!bin/python
from __future__ import division
import run_local
import sys, logging
sys.path.append("lib")
import qt4reactor
qt4reactor.install()
from twisted.internet import reactor
from twisted.internet.task import LoopingCall
from twisted.web.xmlrpc import Proxy
from louie import dispatcher
from PyQt4.QtGui import QWidget, QLabel, QVBoxLayout, QHBoxLayout, QMainWindow
from OpenGL.GL import *
from OpenGL.GLU import *
from light9 import networking, Patch, showconfig, dmxclient, updatefreq, prof
from light9.namespaces import L9
from lightsim.openglsim import Surface
log = logging.getLogger()
logging.basicConfig(format="%(asctime)s %(levelname)-5s %(name)s %(filename)s:%(lineno)d: %(message)s")
log.setLevel(logging.DEBUG)
def filenamesForChan(graph, chan):
for lyr in graph.objects(chan, L9['previewLayer']):
for imgPath in graph.objects(lyr, L9['path']):
yield imgPath
_lastLevels = None
def poll(graph, serv, pollFreq, oglSurface):
pollFreq.update()
dispatcher.send("status", key="pollFreq", value=str(pollFreq))
d = serv.callRemote("currentlevels", dmxclient._id)
def received(dmxLevels):
global _lastLevels
if dmxLevels == _lastLevels:
return
_lastLevels = dmxLevels
level = {} # filename : level
for i, lev in enumerate(dmxLevels):
if lev == 0:
continue
try:
chan = Patch.get_channel_uri(Patch.get_channel_name(i + 1))
except KeyError:
continue
for imgPath in filenamesForChan(graph, chan):
level[str(imgPath)] = lev
oglSurface.newLevels(levels=level)
d.addCallback(received)
return d
class StatusKeys(QWidget):
"""listens for dispatcher signal 'status' and displays the key/value args"""
def __init__(self, parent):
QWidget.__init__(self)
self.layout = QVBoxLayout()
self.setLayout(self.layout)
self.row = {} # key name : (Frame, value Label)
dispatcher.connect(self.status, "status")
def status(self, key, value):
if key not in self.row:
row = QWidget()
self.layout.addWidget(row)
cols = QHBoxLayout()
row.setLayout(cols)
lab1 = QLabel(key)
lab2 = QLabel(value)
cols.addWidget(lab1)
cols.addWidget(lab2)
self.row[key] = lab2
else:
lab = self.row[key]
lab.setText(value)
class Window(QMainWindow):
def __init__(self, filenames):
QMainWindow.__init__(self, None)
self.setWindowTitle(dmxclient._id)
w = QWidget()
self.setCentralWidget(w)
mainLayout = QVBoxLayout()
w.setLayout(mainLayout)
self.glWidget = Surface(self, filenames, imgRescaleTo=128*2)
mainLayout.addWidget(self.glWidget)
status = StatusKeys(mainLayout)
mainLayout.addWidget(status)
def requiredImages(graph):
"""filenames that we'll need to show, based on a config structure
like this:
ch:frontLeft a :Channel;
:previewLayer [ :path "lightsim/skyline/front-left.png" ] .
"""
filenames = []
for lyr in graph.objects(None, L9['previewLayer']):
for p in graph.objects(lyr, L9['path']):
filenames.append(str(p))
return filenames
if __name__ == '__main__':
app = reactor.qApp
graph = showconfig.getGraph()
window = Window(requiredImages(graph))
window.show()
serv = Proxy(networking.dmxServer.url)
pollFreq = updatefreq.Updatefreq()
LoopingCall(poll, graph, serv, pollFreq, window.glWidget).start(.05)
reactor.run()
|