-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtable_view.py
49 lines (33 loc) · 1.25 KB
/
table_view.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
# encoding: utf-8
from Tkinter import *
from recipe_52266 import MultiListbox
from penview import *
class PVTable(Frame):
def __init__(self, parent, window):
Frame.__init__(self, parent)
self.window = window
self.mlb = MultiListbox(self, ("\n",))
window.conf.add_ox_listener(window.tk_cb(self.ox_update))
debug("lots of work ahead here")
def ox_update(self, conf):
self.mlb.pack_forget()
headers = []
for i in range(conf.nvalues + 1):
for ox in conf.open_experiments:
if i <= ox.nvalues:
headers.append("%s %d\n(%s)" % (ox.get_desc(i), ox.id, ox.get_units(i)))
self.mlb = MultiListbox(self, headers)
row = 0
while True:
data = []
for i in range(conf.nvalues + 1):
for ox in conf.open_experiments:
if i <= ox.nvalues and row < len(ox.values[i]):
data.append(ox.values[i][row])
else:
data.append("")
if not filter(lambda x: x != "", data):
break
self.mlb.insert(END, data)
row +=1
self.mlb.pack(expand=YES, fill=BOTH)