-
Notifications
You must be signed in to change notification settings - Fork 0
/
layoutrunner.py
65 lines (38 loc) · 1.22 KB
/
layoutrunner.py
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
"""
The layoutrunner can be used to run a layout and see it without running the kernel
"""
from red.mainwindow import MainWindow
from red.services.display import Display
from PySide import QtGui
import zmq , threading, sys
from red.config import config
config.add_section("GUI")
config.set("GUI","cursor", 'true')
app = QtGui.QApplication(sys.argv)
socketName = "inproc://display"
class InThreasd(threading.Thread):
def __init__(self):
super(InThreasd,self).__init__()
context = zmq.Context()
real_context = zmq.Context.instance();
self.socket = real_context.socket(zmq.PAIR)
self.socket.bind(socketName)
self.last = ""
def run (self):
print("Type name of layout (Enter refreshes)")
while True:
try:
inp = raw_input()
except:
break
if inp == "":
inp = self.last
self.socket.send_json({"head":"set_layout","data":inp})
self.last = inp
listener = InThreasd()
display = Display(name=socketName)
window = MainWindow.instance()
window.show()
display.start()
listener.start()
sys.exit(app.exec_())