Lines Matching refs:self
135 def __init__(self, table): argument
136 self.table = table
137 self.map = {}
139 self.map[entry[0]] = entry[1]
141 def lookup(self, name): argument
143 color = self.map[name]
147 self.map[name] = color
148 self.table.append((name, color))
167 def __init__(self, master, target): argument
168 Frame.__init__(self, master)
169 self.scale = None
170 self.target = target
171 self.label = Label(self, text="Ticks per pixel")
172 self.label.pack(side=LEFT)
173 self.resolution = 100
174 self.setmax(10000)
176 def scaleset(self, value): argument
177 self.target.scaleset(int(value))
179 def set(self, value): argument
180 self.scale.set(value)
182 def setmax(self, value): argument
187 if (self.scale != None):
188 self.scale.pack_forget()
189 self.scale.destroy()
190 self.scale = Scale(self, command=self.scaleset,
192 resolution=self.resolution)
193 self.scale.pack(fill="both", expand=1)
194 self.scale.set(self.target.scaleget())
197 def __init__(self, master): argument
198 Frame.__init__(self, master)
199 self.label = Label(self, bd=1, relief=SUNKEN, anchor=W)
200 self.label.pack(fill="both", expand=1)
201 self.clear()
203 def set(self, str): argument
204 self.label.config(text=str)
206 def clear(self): argument
207 self.label.config(text="")
209 def startup(self, str): argument
210 self.set(str)
214 def __init__(self, master, name, color): argument
215 Frame.__init__(self, master)
220 self.name = name
221 self.color = StringVar()
222 self.color_default = color
223 self.color_current = color
224 self.color.set(color)
225 self.enabled = IntVar()
226 self.enabled_default = enabled
227 self.enabled_current = enabled
228 self.enabled.set(enabled)
229 self.draw()
231 def draw(self): argument
232 self.label = Label(self, text=self.name, anchor=W)
233 self.sample = Canvas(self, width=24, height=24,
235 self.rect = self.sample.create_rectangle(0, 0, 24, 24,
236 fill=self.color.get())
237 self.list = OptionMenu(self, self.color, command=self.setcolor,
239 self.checkbox = Checkbutton(self, text="enabled",
240 variable=self.enabled)
241 self.label.grid(row=0, column=0, sticky=E+W)
242 self.sample.grid(row=0, column=1)
243 self.list.grid(row=0, column=2, sticky=E+W)
244 self.checkbox.grid(row=0, column=3)
245 self.columnconfigure(0, weight=1)
246 self.columnconfigure(2, minsize=150)
248 def setcolor(self, color): argument
249 self.color.set(color)
250 self.sample.itemconfigure(self.rect, fill=color)
252 def apply(self): argument
255 if (self.color_current != self.color.get()):
257 if (self.enabled_current != self.enabled.get()):
259 self.color_current = self.color.get()
260 self.enabled_current = self.enabled.get()
262 if (self.enabled_current):
263 graph.setcolor(self.name, self.color_current)
265 graph.hide(self.name)
268 graph.setcolor(self.name, self.color_current)
270 def revert(self): argument
271 self.setcolor(self.color_default)
272 self.enabled.set(self.enabled_default)
275 def __init__(self, table, name): argument
276 Toplevel.__init__(self)
277 self.resizable(0, 0)
278 self.title(name)
279 self.items = LabelFrame(self, text="Item Type")
280 self.buttons = Frame(self)
281 self.drawbuttons()
282 self.items.grid(row=0, column=0, sticky=E+W)
283 self.columnconfigure(0, weight=1)
284 self.buttons.grid(row=1, column=0, sticky=E+W)
285 self.types = []
286 self.irow = 0
290 self.additem(type[0], color)
291 self.bind("<Control-w>", self.destroycb)
293 def destroycb(self, event): argument
294 self.destroy()
296 def additem(self, name, color): argument
297 item = ColorConf(self.items, name, color)
298 self.types.append(item)
299 item.grid(row=self.irow, column=0, sticky=E+W)
300 self.irow += 1
302 def drawbuttons(self): argument
303 self.apply = Button(self.buttons, text="Apply",
304 command=self.apress)
305 self.default = Button(self.buttons, text="Revert",
306 command=self.rpress)
307 self.apply.grid(row=0, column=0, sticky=E+W)
308 self.default.grid(row=0, column=1, sticky=E+W)
309 self.buttons.columnconfigure(0, weight=1)
310 self.buttons.columnconfigure(1, weight=1)
312 def apress(self): argument
313 for item in self.types:
316 def rpress(self): argument
317 for item in self.types:
321 def __init__(self, master, source): argument
322 Frame.__init__(self, master)
327 self.source = source
328 self.name = source.name
329 self.enabled = IntVar()
330 self.enabled_default = enabled
331 self.enabled_current = enabled
332 self.enabled.set(enabled)
333 self.draw()
335 def draw(self): argument
336 self.label = Label(self, text=self.name, anchor=W)
337 self.checkbox = Checkbutton(self, text="enabled",
338 variable=self.enabled)
339 self.label.grid(row=0, column=0, sticky=E+W)
340 self.checkbox.grid(row=0, column=1)
341 self.columnconfigure(0, weight=1)
343 def changed(self): argument
344 if (self.enabled_current != self.enabled.get()):
348 def apply(self): argument
349 self.enabled_current = self.enabled.get()
351 def revert(self): argument
352 self.enabled.set(self.enabled_default)
354 def check(self): argument
355 self.enabled.set(1)
357 def uncheck(self): argument
358 self.enabled.set(0)
361 def __init__(self): argument
362 Toplevel.__init__(self)
363 self.resizable(0, 0)
364 self.title("Source Configuration")
365 self.items = []
366 self.iframe = Frame(self)
367 self.iframe.grid(row=0, column=0, sticky=E+W)
368 f = LabelFrame(self.iframe, bd=4, text="Sources")
369 self.items.append(f)
370 self.buttons = Frame(self)
371 self.items[0].grid(row=0, column=0, sticky=E+W)
372 self.columnconfigure(0, weight=1)
373 self.sconfig = []
374 self.irow = 0
375 self.icol = 0
377 self.addsource(source)
378 self.drawbuttons()
379 self.buttons.grid(row=1, column=0, sticky=W)
380 self.bind("<Control-w>", self.destroycb)
382 def destroycb(self, event): argument
383 self.destroy()
385 def addsource(self, source): argument
386 if (self.irow > 30):
387 self.icol += 1
388 self.irow = 0
389 c = self.icol
390 f = LabelFrame(self.iframe, bd=4, text="Sources")
392 self.items.append(f)
393 item = SourceConf(self.items[self.icol], source)
394 self.sconfig.append(item)
395 item.grid(row=self.irow, column=0, sticky=E+W)
396 self.irow += 1
398 def drawbuttons(self): argument
399 self.apply = Button(self.buttons, text="Apply",
400 command=self.apress)
401 self.default = Button(self.buttons, text="Revert",
402 command=self.rpress)
403 self.checkall = Button(self.buttons, text="Check All",
404 command=self.cpress)
405 self.uncheckall = Button(self.buttons, text="Uncheck All",
406 command=self.upress)
407 self.checkall.grid(row=0, column=0, sticky=W)
408 self.uncheckall.grid(row=0, column=1, sticky=W)
409 self.apply.grid(row=0, column=2, sticky=W)
410 self.default.grid(row=0, column=3, sticky=W)
411 self.buttons.columnconfigure(0, weight=1)
412 self.buttons.columnconfigure(1, weight=1)
413 self.buttons.columnconfigure(2, weight=1)
414 self.buttons.columnconfigure(3, weight=1)
416 def apress(self): argument
419 for item in self.sconfig:
432 for item in self.sconfig:
435 def rpress(self): argument
436 for item in self.sconfig:
439 def cpress(self): argument
440 for item in self.sconfig:
443 def upress(self): argument
444 for item in self.sconfig:
452 def __init__(self, source): argument
453 self.source = source
454 Toplevel.__init__(self)
455 self.resizable(0, 0)
456 self.title(source.name + " statistics")
457 self.evframe = LabelFrame(self,
459 self.evframe.grid(row=0, column=0, sticky=E+W)
461 for event in self.source.events:
481 Label(self.evframe, text=name, bd=1,
484 Label(self.evframe, text=str(c), bd=1,
487 Label(self.evframe, text=ticks2sec(d),
494 Label(self.evframe, text=ticks2sec(d),
498 self.bind("<Control-w>", self.destroycb)
500 def destroycb(self, event): argument
501 self.destroy()
505 def __init__(self, event, source): argument
506 self.source = source
507 Menu.__init__(self, tearoff=0, takefocus=0)
508 self.add_command(label="hide", command=self.hide)
509 self.add_command(label="hide group", command=self.hidegroup)
510 self.add_command(label="stats", command=self.stats)
511 self.tk_popup(event.x_root-3, event.y_root+3)
513 def hide(self): argument
514 graph.sourcehide(self.source)
516 def hidegroup(self): argument
519 if (source.group == self.source.group):
523 def show(self): argument
524 graph.sourceshow(self.source)
526 def stats(self): argument
527 SourceStats(self.source)
530 def __init__(self, event, canvas): argument
531 Toplevel.__init__(self)
532 self.resizable(0, 0)
533 self.title("Event")
534 self.event = event
535 self.buttons = Frame(self)
536 self.buttons.grid(row=0, column=0, sticky=E+W)
537 self.frame = Frame(self)
538 self.frame.grid(row=1, column=0, sticky=N+S+E+W)
539 self.canvas = canvas
540 self.drawlabels()
541 self.drawbuttons()
543 self.bind("<Destroy>", self.destroycb)
544 self.bind("<Control-w>", self.destroycb)
546 def destroycb(self, event): argument
547 self.unbind("<Destroy>")
548 if (self.event != None):
549 self.event.displayunref(self.canvas)
550 self.event = None
551 self.destroy()
553 def clearlabels(self): argument
554 for label in self.frame.grid_slaves():
557 def drawlabels(self): argument
559 labels = self.event.labels()
567 l = Label(self.frame, text=name, bd=1, width=15,
573 r = Label(self.frame, text=value, bd=1,
578 r.bind("<Button-1>", self.linkpress)
580 self.frame.columnconfigure(1, minsize=80)
582 def drawbuttons(self): argument
583 self.back = Button(self.buttons, text="<", command=self.bpress)
584 self.forw = Button(self.buttons, text=">", command=self.fpress)
585 self.new = Button(self.buttons, text="new", command=self.npress)
586 self.back.grid(row=0, column=0, sticky=E+W)
587 self.forw.grid(row=0, column=1, sticky=E+W)
588 self.new.grid(row=0, column=2, sticky=E+W)
589 self.buttons.columnconfigure(2, weight=1)
591 def newevent(self, event): argument
592 self.event.displayunref(self.canvas)
593 self.clearlabels()
594 self.event = event
595 self.event.displayref(self.canvas)
596 self.drawlabels()
598 def npress(self): argument
599 EventView(self.event, self.canvas)
601 def bpress(self): argument
602 prev = self.event.prev()
609 self.newevent(prev)
611 def fpress(self): argument
612 next = self.event.next()
619 self.newevent(next)
621 def linkpress(self, wevent): argument
622 event = self.event.getlinked()
624 self.newevent(event)
627 def __init__(self, source, name, cpu, timestamp, attrs): argument
628 self.source = source
629 self.name = name
630 self.cpu = cpu
631 self.timestamp = int(timestamp)
632 self.attrs = attrs
633 self.idx = None
634 self.item = None
635 self.dispcnt = 0
636 self.duration = 0
637 self.recno = lineno
639 def status(self): argument
640 statstr = self.name + " " + self.source.name
641 statstr += " on: cpu" + str(self.cpu)
642 statstr += " at: " + str(self.timestamp)
644 for i in range(0, len(self.attrs)):
645 attr = self.attrs[i]
647 if (i != len(self.attrs) - 1):
651 def labels(self): argument
652 return [("Source", self.source.name),
653 ("Event", self.name),
654 ("CPU", self.cpu),
655 ("Timestamp", self.timestamp),
656 ("KTR Line ", self.recno)
657 ] + self.attrs
659 def mouseenter(self, canvas): argument
660 self.displayref(canvas)
661 self.status()
663 def mouseexit(self, canvas): argument
664 self.displayunref(canvas)
667 def mousepress(self, canvas): argument
668 EventView(self, canvas)
670 def draw(self, canvas, xpos, ypos, item): argument
671 self.item = item
673 canvas.items[item] = self
675 def move(self, canvas, x, y): argument
676 if (self.item == None):
678 canvas.move(self.item, x, y);
680 def next(self): argument
681 return self.source.eventat(self.idx + 1)
683 def nexttype(self, type): argument
684 next = self.next()
689 def prev(self): argument
690 return self.source.eventat(self.idx - 1)
692 def displayref(self, canvas): argument
693 if (self.dispcnt == 0):
694 canvas.itemconfigure(self.item, width=2)
695 self.dispcnt += 1
697 def displayunref(self, canvas): argument
698 self.dispcnt -= 1
699 if (self.dispcnt == 0):
700 canvas.itemconfigure(self.item, width=0)
703 def getlinked(self): argument
704 for attr in self.attrs:
708 return source.findevent(self.timestamp)
713 def __init__(self, source, name, cpu, timestamp, attrs): argument
714 Event.__init__(self, source, name, cpu, timestamp, attrs)
716 def draw(self, canvas, xpos, ypos): argument
717 color = colormap.lookup(self.name)
721 tags=("event", self.type, self.name, self.source.tag))
722 Event.draw(self, canvas, xpos, ypos, l)
728 def __init__(self, source, name, cpu, timestamp, attrs): argument
729 Event.__init__(self, source, name, cpu, timestamp, attrs)
731 def draw(self, canvas, xpos, ypos): argument
732 next = self.nexttype("state")
735 self.duration = duration = next.timestamp - self.timestamp
736 self.attrs.insert(0, ("duration", ticks2sec(duration)))
737 color = colormap.lookup(self.name)
741 print(self.cpu, self.timestamp)
746 tags=("event", self.type, self.name, self.source.tag))
747 Event.draw(self, canvas, xpos, ypos, l)
753 def __init__(self, source, count, cpu, timestamp, attrs): argument
755 self.count = count
756 Event.__init__(self, source, "count", cpu, timestamp, attrs)
758 def draw(self, canvas, xpos, ypos): argument
759 next = self.nexttype("count")
763 self.duration = duration = next.timestamp - self.timestamp
767 print(self.cpu, self.timestamp)
769 self.attrs.insert(0, ("count", self.count))
770 self.attrs.insert(1, ("duration", ticks2sec(duration)))
772 yhight = self.source.yscale() * self.count
775 tags=("event", self.type, self.name, self.source.tag))
776 Event.draw(self, canvas, xpos, ypos, l)
781 def __init__(self, source, cpu, timestamp, last=0): argument
786 StateEvent.__init__(self, source, "pad", cpu, timestamp, [])
787 def draw(self, canvas, xpos, ypos): argument
788 next = self.next()
791 duration = next.timestamp - self.timestamp
793 Event.draw(self, canvas, xpos, ypos, None)
801 def __init__(self, group, id): argument
802 self.name = id
803 self.events = []
804 self.cpuitems = []
805 self.group = group
806 self.y = 0
807 self.item = None
808 self.hidden = 0
809 self.tag = group + id
811 def __cmp__(self, other): argument
814 if (self.group == other.group):
815 return cmp(self.name, other.name)
816 return cmp(self.group, other.group)
821 def fixup(self): argument
822 self.events.reverse()
824 def addevent(self, event): argument
825 self.events.append(event)
827 def addlastevent(self, event): argument
828 self.events.insert(0, event)
830 def draw(self, canvas, ypos): argument
833 cpu = self.events[1].cpu
834 for i in range(0, len(self.events)):
835 self.events[i].idx = i
836 for event in self.events:
838 self.drawcpu(canvas, cpu, cpux, xpos, ypos)
842 self.drawcpu(canvas, cpu, cpux, xpos, ypos)
844 def drawname(self, canvas, ypos): argument
845 self.y = ypos
846 ypos = ypos - (self.ysize() / 2)
847 self.item = canvas.create_text(X_BORDER, ypos, anchor="w",
848 text=self.name)
849 return (self.item)
851 def drawcpu(self, canvas, cpu, fromx, tox, ypos): argument
856 ypos - self.ysize() - canvas.bdheight,
858 tags=("cpubg", cpu, self.tag), state="hidden")
859 self.cpuitems.append(l)
861 def move(self, canvas, xpos, ypos): argument
862 canvas.move(self.tag, xpos, ypos)
864 def movename(self, canvas, xpos, ypos): argument
865 self.y += ypos
866 canvas.move(self.item, xpos, ypos)
868 def ysize(self): argument
871 def eventat(self, i): argument
872 if (i >= len(self.events) or i < 0):
874 event = self.events[i]
877 def findevent(self, timestamp): argument
878 for event in self.events:
889 def __init__(self, group, id): argument
894 EventSource.__init__(self, group, id)
896 def fixup(self): argument
897 for event in self.events:
901 if (count > Counter.groups[self.group]):
902 Counter.groups[self.group] = count
903 EventSource.fixup(self)
905 def ymax(self): argument
906 return (Counter.groups[self.group])
908 def ysize(self): argument
911 def yscale(self): argument
912 return (self.ysize() / self.ymax())
915 def __init__(self, file): argument
916 self.timestamp_f = None
917 self.timestamp_l = None
918 self.locks = {}
919 self.ticks = {}
920 self.load = {}
921 self.crit = {}
922 self.stathz = 0
923 self.eventcnt = 0
924 self.taghash = {}
926 self.parse(file)
927 self.fixup()
929 ticksps = self.ticksps()
930 span = self.timespan()
938 titlestr += str(self.eventcnt) + " events"
941 def parse(self, file): argument
998 if (self.checkstamp(timestamp) == 0):
1031 self.setstathz(val, cpu)
1034 e = self.makeevent(group, id, type, args)
1038 def makeevent(self, group, id, type, args): argument
1040 source = self.makeid(group, id, type)
1048 self.eventcnt += 1
1052 def setstathz(self, val, cpu): argument
1053 self.stathz = int(val)
1056 ticks = self.ticks[cpu]
1058 self.ticks[cpu] = 0
1059 self.ticks[cpu] += 1
1061 def checkstamp(self, timestamp): argument
1063 if (self.timestamp_f == None):
1064 self.timestamp_f = timestamp;
1065 if (self.timestamp_l != None and
1066 timestamp -2048> self.timestamp_l):
1068 self.timestamp_l = timestamp;
1071 def makeid(self, group, id, type): argument
1073 if (tag in self.taghash):
1074 return self.taghash[tag]
1080 self.taghash[tag] = source
1083 def findid(self, id): argument
1089 def timespan(self): argument
1090 return (self.timestamp_f - self.timestamp_l);
1092 def ticksps(self): argument
1099 if (self.stathz != 0):
1100 return (self.timespan() / self.ticks[0]) * int(self.stathz)
1107 def fixup(self): argument
1109 e = PadEvent(source, -1, self.timestamp_l)
1111 e = PadEvent(source, -1, self.timestamp_f, last=1)
1117 def __init__(self, master, display): argument
1118 self.display = display
1119 self.parent = master
1120 self.bdheight = master.bdheight
1121 self.items = {}
1122 self.ysize = 0
1123 self.lines = []
1124 Canvas.__init__(self, master, width=120,
1128 def moveline(self, cur_y, y): argument
1129 for line in self.lines:
1130 (x0, y0, x1, y1) = self.coords(line)
1133 self.move(line, 0, y)
1136 def draw(self): argument
1139 self.configure(scrollregion=(0, 0,
1140 self["width"], self.display.ysize()))
1142 l = self.create_line(0, ypos, self["width"], ypos,
1144 self.lines.append(l)
1145 ypos += self.bdheight
1147 t = source.drawname(self, ypos)
1148 self.items[t] = source
1149 ypos += self.bdheight
1150 self.ysize = ypos
1151 self.create_line(0, ypos, self["width"], ypos,
1153 self.bind("<Button-1>", self.master.mousepress);
1154 self.bind("<Button-3>", self.master.mousepressright);
1155 self.bind("<ButtonRelease-1>", self.master.mouserelease);
1156 self.bind("<B1-Motion>", self.master.mousemotion);
1158 def updatescroll(self): argument
1159 self.configure(scrollregion=(0, 0,
1160 self["width"], self.display.ysize()))
1164 def __init__(self, master): argument
1165 self.ratio = 1
1166 self.parent = master
1167 self.bdheight = master.bdheight
1168 self.items = {}
1169 self.lines = []
1170 Canvas.__init__(self, master, width=800, height=500, bg='grey',
1173 def prepare(self): argument
1179 self.ratio = (ktrfile.timespan() - 1) / 2**31 + 1
1181 def draw(self): argument
1183 xsize = self.xsize()
1186 l = self.create_line(0, ypos, xsize, ypos,
1188 self.lines.append(l)
1189 ypos += self.bdheight
1191 source.draw(self, ypos)
1192 ypos += self.bdheight
1193 self.tag_raise("point", "state")
1194 self.tag_lower("cpubg", ALL)
1195 self.create_line(0, ypos, xsize, ypos,
1197 self.tag_bind("event", "<Enter>", self.mouseenter)
1198 self.tag_bind("event", "<Leave>", self.mouseexit)
1199 self.bind("<Button-1>", self.mousepress)
1200 self.bind("<Button-3>", self.master.mousepressright);
1201 self.bind("<Button-4>", self.wheelup)
1202 self.bind("<Button-5>", self.wheeldown)
1203 self.bind("<ButtonRelease-1>", self.master.mouserelease);
1204 self.bind("<B1-Motion>", self.master.mousemotion);
1206 def moveline(self, cur_y, y): argument
1207 for line in self.lines:
1208 (x0, y0, x1, y1) = self.coords(line)
1211 self.move(line, 0, y)
1214 def mouseenter(self, event): argument
1215 item, = self.find_withtag(CURRENT)
1216 self.items[item].mouseenter(self)
1218 def mouseexit(self, event): argument
1219 item, = self.find_withtag(CURRENT)
1220 self.items[item].mouseexit(self)
1222 def mousepress(self, event): argument
1224 items = self.find_withtag(CURRENT)
1226 self.master.mousepress(event)
1230 tags = self.gettags(item)
1233 self.items[item].mousepress(self)
1236 self.master.mousepress(event)
1238 def wheeldown(self, event): argument
1239 self.parent.display_yview("scroll", 1, "units")
1241 def wheelup(self, event): argument
1242 self.parent.display_yview("scroll", -1, "units")
1244 def xsize(self): argument
1245 return ((ktrfile.timespan() / self.ratio) + (X_BORDER * 2))
1247 def ysize(self): argument
1252 ysize += self.parent.sourcesize(source)
1255 def scaleset(self, ratio): argument
1258 oldratio = self.ratio
1259 xstart, xend = self.xview()
1262 self.ratio = ratio
1263 self.updatescroll()
1264 self.scale(ALL, 0, 0, float(oldratio) / ratio, 1)
1266 xstart, xend = self.xview()
1268 self.xview_moveto(midpoint - xsize)
1270 def updatescroll(self): argument
1271 self.configure(scrollregion=(0, 0, self.xsize(), self.ysize()))
1273 def scaleget(self): argument
1274 return self.ratio
1276 def getcolor(self, tag): argument
1277 return self.itemcget(tag, "fill")
1279 def getstate(self, tag): argument
1280 return self.itemcget(tag, "state")
1282 def setcolor(self, tag, color): argument
1283 self.itemconfigure(tag, state="normal", fill=color)
1285 def hide(self, tag): argument
1286 self.itemconfigure(tag, state="hidden")
1289 def __init__(self, master): argument
1290 Frame.__init__(self, master, bd=2, relief=RAISED)
1291 self.conf = Menubutton(self, text="Configure")
1292 self.confmenu = Menu(self.conf, tearoff=0)
1293 self.confmenu.add_command(label="Event Colors",
1294 command=self.econf)
1295 self.confmenu.add_command(label="CPU Colors",
1296 command=self.cconf)
1297 self.confmenu.add_command(label="Source Configure",
1298 command=self.sconf)
1299 self.conf["menu"] = self.confmenu
1300 self.conf.pack(side=LEFT)
1302 def econf(self): argument
1305 def cconf(self): argument
1308 def sconf(self): argument
1312 def __init__(self, master): argument
1313 Frame.__init__(self, master)
1314 self.menu = None
1315 self.names = None
1316 self.display = None
1317 self.scale = None
1318 self.status = None
1319 self.bdheight = Y_BORDER
1320 self.clicksource = None
1321 self.lastsource = None
1322 self.pack(expand=1, fill="both")
1323 self.buildwidgets()
1324 self.layout()
1325 self.bind_all("<Control-q>", self.quitcb)
1327 def quitcb(self, event): argument
1328 self.quit()
1330 def buildwidgets(self): argument
1332 self.menu = GraphMenu(self)
1333 self.display = SchedDisplay(self)
1334 self.names = SchedNames(self, self.display)
1335 self.scale = Scaler(self, self.display)
1336 status = self.status = Status(self)
1337 self.scrollY = Scrollbar(self, orient="vertical",
1338 command=self.display_yview)
1339 self.display.scrollX = Scrollbar(self, orient="horizontal",
1340 command=self.display.xview)
1341 self.display["xscrollcommand"] = self.display.scrollX.set
1342 self.display["yscrollcommand"] = self.scrollY.set
1343 self.names["yscrollcommand"] = self.scrollY.set
1345 def layout(self): argument
1346 self.columnconfigure(1, weight=1)
1347 self.rowconfigure(1, weight=1)
1348 self.menu.grid(row=0, column=0, columnspan=3, sticky=E+W)
1349 self.names.grid(row=1, column=0, sticky=N+S)
1350 self.display.grid(row=1, column=1, sticky=W+E+N+S)
1351 self.scrollY.grid(row=1, column=2, sticky=N+S)
1352 self.display.scrollX.grid(row=2, column=0, columnspan=2,
1354 self.scale.grid(row=3, column=0, columnspan=3, sticky=E+W)
1355 self.status.grid(row=4, column=0, columnspan=3, sticky=E+W)
1357 def draw(self): argument
1358 self.master.update()
1359 self.display.prepare()
1360 self.names.draw()
1361 self.display.draw()
1362 self.status.startup("")
1366 scalemax = ktrfile.timespan() / int(self.display["width"])
1368 self.constwidth = width - int(self.display["width"])
1369 self.scale.setmax(scalemax)
1370 self.scale.set(scalemax)
1371 self.display.xview_moveto(0)
1372 self.bind("<Configure>", self.resize)
1374 def mousepress(self, event): argument
1375 self.clicksource = self.sourceat(event.y)
1377 def mousepressright(self, event): argument
1378 source = self.sourceat(event.y)
1383 def mouserelease(self, event): argument
1384 if (self.clicksource == None):
1386 newsource = self.sourceat(event.y)
1387 if (self.clicksource != newsource):
1388 self.sourceswap(self.clicksource, newsource)
1389 self.clicksource = None
1390 self.lastsource = None
1392 def mousemotion(self, event): argument
1393 if (self.clicksource == None):
1395 newsource = self.sourceat(event.y)
1403 self.clicksource = None
1404 self.lastsource = None
1406 if (newsource == self.lastsource):
1408 self.lastsource = newsource
1409 if (newsource != self.clicksource):
1410 self.sourceswap(self.clicksource, newsource)
1413 def sourcestart(self, source): argument
1414 return source.y - self.bdheight - source.ysize()
1416 def sourceend(self, source): argument
1417 return source.y + self.bdheight
1419 def sourcesize(self, source): argument
1420 return (self.bdheight * 2) + source.ysize()
1422 def sourceswap(self, source1, source2): argument
1429 if (self.sourceend(source1) != self.sourcestart(source2)):
1432 y1 = self.sourcestart(source1)
1433 y2 = self.sourcestart(source2)
1434 y1targ = y1 + self.sourcesize(source2)
1442 self.names.moveline(y2, diff);
1443 self.display.moveline(y2, diff)
1444 source1.move(self.display, 0, y1targ - y1)
1445 source2.move(self.display, 0, y2targ - y2)
1446 source1.movename(self.names, 0, y1targ - y1)
1447 source2.movename(self.names, 0, y2targ - y2)
1449 def sourcepicky(self, source): argument
1451 return self.sourcestart(source)
1463 newy = self.sourcestart(prev) + self.sourcesize(prev)
1466 def sourceshow(self, source): argument
1469 newy = self.sourcepicky(source)
1470 off = newy - self.sourcestart(source)
1471 self.sourceshiftall(newy-1, self.sourcesize(source))
1472 self.sourceshift(source, off)
1480 def sourceshowlist(self, srclist): argument
1486 startsize.append((self.sourcepicky(source),
1487 self.sourcesize(source)))
1490 self.status.startup("Updating display...");
1494 nstart = self.sourcestart(source)
1500 self.sourceshift(source, size)
1505 off = (newy + size) - self.sourcestart(source)
1506 self.sourceshift(source, off)
1510 self.updatescroll()
1511 self.status.set("")
1518 def sourcehidelist(self, srclist): argument
1523 self.status.startup("Updating display...");
1531 startsize.append((self.sourcestart(source),
1532 self.sourcesize(source)))
1533 self.sourceshift(source, off)
1544 stop = self.display.ysize()
1547 nstart = self.sourcestart(source)
1552 self.sourceshift(source, -size)
1553 self.updatescroll()
1554 self.status.set("")
1556 def sourcehide(self, source): argument
1561 start = self.sourcestart(source)
1562 self.sourceshift(source, off)
1563 self.sourceshiftall(start, -self.sourcesize(source))
1566 def sourceshift(self, source, off): argument
1567 start = self.sourcestart(source)
1568 source.move(self.display, 0, off)
1569 source.movename(self.names, 0, off)
1570 self.names.moveline(start, off);
1571 self.display.moveline(start, off)
1576 self.names.update_idletasks()
1577 self.display.update_idletasks()
1579 def sourceshiftall(self, start, off): argument
1580 self.status.startup("Updating display...");
1582 nstart = self.sourcestart(source)
1585 self.sourceshift(source, off)
1586 self.updatescroll()
1587 self.status.set("")
1589 def sourceat(self, ypos): argument
1590 (start, end) = self.names.yview()
1591 starty = start * float(self.names.ysize)
1596 yend = self.sourceend(source)
1597 ystart = self.sourcestart(source)
1602 def display_yview(self, *args): argument
1603 self.names.yview(*args)
1604 self.display.yview(*args)
1606 def resize(self, *args): argument
1608 scalemax = ktrfile.timespan() / (width - self.constwidth)
1609 self.scale.setmax(scalemax)
1611 def updatescroll(self): argument
1612 self.names.updatescroll()
1613 self.display.updatescroll()
1615 def setcolor(self, tag, color): argument
1616 self.display.setcolor(tag, color)
1618 def hide(self, tag): argument
1619 self.display.hide(tag)
1621 def getcolor(self, tag): argument
1622 return self.display.getcolor(tag)
1624 def getstate(self, tag): argument
1625 return self.display.getstate(tag)