Lines Matching full:self

138 	def __init__(self, table):  argument
139 self.table = table
140 self.map = {}
142 self.map[entry[0]] = entry[1]
144 def lookup(self, name): argument
146 color = self.map[name]
150 self.map[name] = color
151 self.table.append((name, color))
170 def __init__(self, master, target): argument
171 Frame.__init__(self, master)
172 self.scale = None
173 self.target = target
174 self.label = Label(self, text="Ticks per pixel")
175 self.label.pack(side=LEFT)
176 self.resolution = 100
177 self.setmax(10000)
179 def scaleset(self, value): argument
180 self.target.scaleset(int(value))
182 def set(self, value): argument
183 self.scale.set(value)
185 def setmax(self, value): argument
190 if (self.scale != None):
191 self.scale.pack_forget()
192 self.scale.destroy()
193 self.scale = Scale(self, command=self.scaleset,
195 resolution=self.resolution)
196 self.scale.pack(fill="both", expand=1)
197 self.scale.set(self.target.scaleget())
200 def __init__(self, master): argument
201 Frame.__init__(self, master)
202 self.label = Label(self, bd=1, relief=SUNKEN, anchor=W)
203 self.label.pack(fill="both", expand=1)
204 self.clear()
206 def set(self, str): argument
207 self.label.config(text=str)
209 def clear(self): argument
210 self.label.config(text="")
212 def startup(self, str): argument
213 self.set(str)
217 def __init__(self, master, name, color): argument
218 Frame.__init__(self, master)
223 self.name = name
224 self.color = StringVar()
225 self.color_default = color
226 self.color_current = color
227 self.color.set(color)
228 self.enabled = IntVar()
229 self.enabled_default = enabled
230 self.enabled_current = enabled
231 self.enabled.set(enabled)
232 self.draw()
234 def draw(self): argument
235 self.label = Label(self, text=self.name, anchor=W)
236 self.sample = Canvas(self, width=24, height=24,
238 self.rect = self.sample.create_rectangle(0, 0, 24, 24,
239 fill=self.color.get())
240 self.list = OptionMenu(self, self.color, command=self.setcolor,
242 self.checkbox = Checkbutton(self, text="enabled",
243 variable=self.enabled)
244 self.label.grid(row=0, column=0, sticky=E+W)
245 self.sample.grid(row=0, column=1)
246 self.list.grid(row=0, column=2, sticky=E+W)
247 self.checkbox.grid(row=0, column=3)
248 self.columnconfigure(0, weight=1)
249 self.columnconfigure(2, minsize=150)
251 def setcolor(self, color): argument
252 self.color.set(color)
253 self.sample.itemconfigure(self.rect, fill=color)
255 def apply(self): argument
258 if (self.color_current != self.color.get()):
260 if (self.enabled_current != self.enabled.get()):
262 self.color_current = self.color.get()
263 self.enabled_current = self.enabled.get()
265 if (self.enabled_current):
266 graph.setcolor(self.name, self.color_current)
268 graph.hide(self.name)
271 graph.setcolor(self.name, self.color_current)
273 def revert(self): argument
274 self.setcolor(self.color_default)
275 self.enabled.set(self.enabled_default)
278 def __init__(self, table, name): argument
279 Toplevel.__init__(self)
280 self.resizable(0, 0)
281 self.title(name)
282 self.items = LabelFrame(self, text="Item Type")
283 self.buttons = Frame(self)
284 self.drawbuttons()
285 self.items.grid(row=0, column=0, sticky=E+W)
286 self.columnconfigure(0, weight=1)
287 self.buttons.grid(row=1, column=0, sticky=E+W)
288 self.types = []
289 self.irow = 0
293 self.additem(type[0], color)
294 self.bind("<Control-w>", self.destroycb)
296 def destroycb(self, event): argument
297 self.destroy()
299 def additem(self, name, color): argument
300 item = ColorConf(self.items, name, color)
301 self.types.append(item)
302 item.grid(row=self.irow, column=0, sticky=E+W)
303 self.irow += 1
305 def drawbuttons(self): argument
306 self.apply = Button(self.buttons, text="Apply",
307 command=self.apress)
308 self.default = Button(self.buttons, text="Revert",
309 command=self.rpress)
310 self.apply.grid(row=0, column=0, sticky=E+W)
311 self.default.grid(row=0, column=1, sticky=E+W)
312 self.buttons.columnconfigure(0, weight=1)
313 self.buttons.columnconfigure(1, weight=1)
315 def apress(self): argument
316 for item in self.types:
319 def rpress(self): argument
320 for item in self.types:
324 def __init__(self, master, source): argument
325 Frame.__init__(self, master)
330 self.source = source
331 self.name = source.name
332 self.enabled = IntVar()
333 self.enabled_default = enabled
334 self.enabled_current = enabled
335 self.enabled.set(enabled)
336 self.draw()
338 def draw(self): argument
339 self.label = Label(self, text=self.name, anchor=W)
340 self.checkbox = Checkbutton(self, text="enabled",
341 variable=self.enabled)
342 self.label.grid(row=0, column=0, sticky=E+W)
343 self.checkbox.grid(row=0, column=1)
344 self.columnconfigure(0, weight=1)
346 def changed(self): argument
347 if (self.enabled_current != self.enabled.get()):
351 def apply(self): argument
352 self.enabled_current = self.enabled.get()
354 def revert(self): argument
355 self.enabled.set(self.enabled_default)
357 def check(self): argument
358 self.enabled.set(1)
360 def uncheck(self): argument
361 self.enabled.set(0)
364 def __init__(self): argument
365 Toplevel.__init__(self)
366 self.resizable(0, 0)
367 self.title("Source Configuration")
368 self.items = []
369 self.iframe = Frame(self)
370 self.iframe.grid(row=0, column=0, sticky=E+W)
371 f = LabelFrame(self.iframe, bd=4, text="Sources")
372 self.items.append(f)
373 self.buttons = Frame(self)
374 self.items[0].grid(row=0, column=0, sticky=E+W)
375 self.columnconfigure(0, weight=1)
376 self.sconfig = []
377 self.irow = 0
378 self.icol = 0
380 self.addsource(source)
381 self.drawbuttons()
382 self.buttons.grid(row=1, column=0, sticky=W)
383 self.bind("<Control-w>", self.destroycb)
385 def destroycb(self, event): argument
386 self.destroy()
388 def addsource(self, source): argument
389 if (self.irow > 30):
390 self.icol += 1
391 self.irow = 0
392 c = self.icol
393 f = LabelFrame(self.iframe, bd=4, text="Sources")
395 self.items.append(f)
396 item = SourceConf(self.items[self.icol], source)
397 self.sconfig.append(item)
398 item.grid(row=self.irow, column=0, sticky=E+W)
399 self.irow += 1
401 def drawbuttons(self): argument
402 self.apply = Button(self.buttons, text="Apply",
403 command=self.apress)
404 self.default = Button(self.buttons, text="Revert",
405 command=self.rpress)
406 self.checkall = Button(self.buttons, text="Check All",
407 command=self.cpress)
408 self.uncheckall = Button(self.buttons, text="Uncheck All",
409 command=self.upress)
410 self.checkall.grid(row=0, column=0, sticky=W)
411 self.uncheckall.grid(row=0, column=1, sticky=W)
412 self.apply.grid(row=0, column=2, sticky=W)
413 self.default.grid(row=0, column=3, sticky=W)
414 self.buttons.columnconfigure(0, weight=1)
415 self.buttons.columnconfigure(1, weight=1)
416 self.buttons.columnconfigure(2, weight=1)
417 self.buttons.columnconfigure(3, weight=1)
419 def apress(self): argument
422 for item in self.sconfig:
435 for item in self.sconfig:
438 def rpress(self): argument
439 for item in self.sconfig:
442 def cpress(self): argument
443 for item in self.sconfig:
446 def upress(self): argument
447 for item in self.sconfig:
451 def __init__(self, source): argument
452 self.source = source
453 Toplevel.__init__(self)
454 self.resizable(0, 0)
455 self.title(source.name + " statistics")
456 self.evframe = LabelFrame(self,
458 self.evframe.grid(row=0, column=0, sticky=E+W)
460 for event in self.source.events:
480 Label(self.evframe, text=name, bd=1,
483 Label(self.evframe, text=str(c), bd=1,
486 Label(self.evframe, text=ticks2sec(d),
493 Label(self.evframe, text=ticks2sec(d),
497 self.bind("<Control-w>", self.destroycb)
499 def destroycb(self, event): argument
500 self.destroy()
504 def __init__(self, event, source): argument
505 self.source = source
506 Menu.__init__(self, tearoff=0, takefocus=0)
507 self.add_command(label="hide", command=self.hide)
508 self.add_command(label="hide group", command=self.hidegroup)
509 self.add_command(label="stats", command=self.stats)
510 self.tk_popup(event.x_root-3, event.y_root+3)
512 def hide(self): argument
513 graph.sourcehide(self.source)
515 def hidegroup(self): argument
518 if (source.group == self.source.group):
522 def show(self): argument
523 graph.sourceshow(self.source)
525 def stats(self): argument
526 SourceStats(self.source)
529 def __init__(self, event, canvas): argument
530 Toplevel.__init__(self)
531 self.resizable(0, 0)
532 self.title("Event")
533 self.event = event
534 self.buttons = Frame(self)
535 self.buttons.grid(row=0, column=0, sticky=E+W)
536 self.frame = Frame(self)
537 self.frame.grid(row=1, column=0, sticky=N+S+E+W)
538 self.canvas = canvas
539 self.drawlabels()
540 self.drawbuttons()
542 self.bind("<Destroy>", self.destroycb)
543 self.bind("<Control-w>", self.destroycb)
545 def destroycb(self, event): argument
546 self.unbind("<Destroy>")
547 if (self.event != None):
548 self.event.displayunref(self.canvas)
549 self.event = None
550 self.destroy()
552 def clearlabels(self): argument
553 for label in self.frame.grid_slaves():
556 def drawlabels(self): argument
558 labels = self.event.labels()
566 l = Label(self.frame, text=name, bd=1, width=15,
572 r = Label(self.frame, text=value, bd=1,
577 r.bind("<Button-1>", self.linkpress)
579 self.frame.columnconfigure(1, minsize=80)
581 def drawbuttons(self): argument
582 self.back = Button(self.buttons, text="<", command=self.bpress)
583 self.forw = Button(self.buttons, text=">", command=self.fpress)
584 self.new = Button(self.buttons, text="new", command=self.npress)
585 self.back.grid(row=0, column=0, sticky=E+W)
586 self.forw.grid(row=0, column=1, sticky=E+W)
587 self.new.grid(row=0, column=2, sticky=E+W)
588 self.buttons.columnconfigure(2, weight=1)
590 def newevent(self, event): argument
591 self.event.displayunref(self.canvas)
592 self.clearlabels()
593 self.event = event
594 self.event.displayref(self.canvas)
595 self.drawlabels()
597 def npress(self): argument
598 EventView(self.event, self.canvas)
600 def bpress(self): argument
601 prev = self.event.prev()
608 self.newevent(prev)
610 def fpress(self): argument
611 next = self.event.next()
618 self.newevent(next)
620 def linkpress(self, wevent): argument
621 event = self.event.getlinked()
623 self.newevent(event)
626 def __init__(self, source, name, cpu, timestamp, attrs): argument
627 self.source = source
628 self.name = name
629 self.cpu = cpu
630 self.timestamp = int(timestamp)
631 self.attrs = attrs
632 self.idx = None
633 self.item = None
634 self.dispcnt = 0
635 self.duration = 0
636 self.recno = lineno
638 def status(self): argument
639 statstr = self.name + " " + self.source.name
640 statstr += " on: cpu" + str(self.cpu)
641 statstr += " at: " + str(self.timestamp)
643 for i in range(0, len(self.attrs)):
644 attr = self.attrs[i]
646 if (i != len(self.attrs) - 1):
650 def labels(self): argument
651 return [("Source", self.source.name),
652 ("Event", self.name),
653 ("CPU", self.cpu),
654 ("Timestamp", self.timestamp),
655 ("KTR Line ", self.recno)
656 ] + self.attrs
658 def mouseenter(self, canvas): argument
659 self.displayref(canvas)
660 self.status()
662 def mouseexit(self, canvas): argument
663 self.displayunref(canvas)
666 def mousepress(self, canvas): argument
667 EventView(self, canvas)
669 def draw(self, canvas, xpos, ypos, item): argument
670 self.item = item
672 canvas.items[item] = self
674 def move(self, canvas, x, y): argument
675 if (self.item == None):
677 canvas.move(self.item, x, y);
679 def next(self): argument
680 return self.source.eventat(self.idx + 1)
682 def nexttype(self, type): argument
683 next = self.next()
688 def prev(self): argument
689 return self.source.eventat(self.idx - 1)
691 def displayref(self, canvas): argument
692 if (self.dispcnt == 0):
693 canvas.itemconfigure(self.item, width=2)
694 self.dispcnt += 1
696 def displayunref(self, canvas): argument
697 self.dispcnt -= 1
698 if (self.dispcnt == 0):
699 canvas.itemconfigure(self.item, width=0)
702 def getlinked(self): argument
703 for attr in self.attrs:
707 return source.findevent(self.timestamp)
712 def __init__(self, source, name, cpu, timestamp, attrs): argument
713 Event.__init__(self, source, name, cpu, timestamp, attrs)
715 def draw(self, canvas, xpos, ypos): argument
716 color = colormap.lookup(self.name)
720 tags=("event", self.type, self.name, self.source.tag))
721 Event.draw(self, canvas, xpos, ypos, l)
727 def __init__(self, source, name, cpu, timestamp, attrs): argument
728 Event.__init__(self, source, name, cpu, timestamp, attrs)
730 def draw(self, canvas, xpos, ypos): argument
731 next = self.nexttype("state")
734 self.duration = duration = next.timestamp - self.timestamp
735 self.attrs.insert(0, ("duration", ticks2sec(duration)))
736 color = colormap.lookup(self.name)
740 print(self.cpu, self.timestamp)
745 tags=("event", self.type, self.name, self.source.tag))
746 Event.draw(self, canvas, xpos, ypos, l)
752 def __init__(self, source, count, cpu, timestamp, attrs): argument
754 self.count = count
755 Event.__init__(self, source, "count", cpu, timestamp, attrs)
757 def draw(self, canvas, xpos, ypos): argument
758 next = self.nexttype("count")
762 self.duration = duration = next.timestamp - self.timestamp
766 print(self.cpu, self.timestamp)
768 self.attrs.insert(0, ("count", self.count))
769 self.attrs.insert(1, ("duration", ticks2sec(duration)))
771 yhight = self.source.yscale() * self.count
774 tags=("event", self.type, self.name, self.source.tag))
775 Event.draw(self, canvas, xpos, ypos, l)
780 def __init__(self, source, cpu, timestamp, last=0): argument
785 StateEvent.__init__(self, source, "pad", cpu, timestamp, [])
786 def draw(self, canvas, xpos, ypos): argument
787 next = self.next()
790 duration = next.timestamp - self.timestamp
792 Event.draw(self, canvas, xpos, ypos, None)
798 def __init__(self, group, id): argument
799 self.name = id
800 self.events = []
801 self.cpuitems = []
802 self.group = group
803 self.y = 0
804 self.item = None
805 self.hidden = 0
806 self.tag = group + id
808 def __lt__(self, other): argument
811 return (self.group < other.group or
812 self.group == other.group and self.name < other.name)
814 def __eq__(self, other): argument
817 return self.group == other.group and self.name == other.name
822 def fixup(self): argument
823 self.events.reverse()
825 def addevent(self, event): argument
826 self.events.append(event)
828 def addlastevent(self, event): argument
829 self.events.insert(0, event)
831 def draw(self, canvas, ypos): argument
834 cpu = self.events[1].cpu
835 for i in range(0, len(self.events)):
836 self.events[i].idx = i
837 for event in self.events:
839 self.drawcpu(canvas, cpu, cpux, xpos, ypos)
843 self.drawcpu(canvas, cpu, cpux, xpos, ypos)
845 def drawname(self, canvas, ypos): argument
846 self.y = ypos
847 ypos = ypos - (self.ysize() / 2)
848 self.item = canvas.create_text(X_BORDER, ypos, anchor="w",
849 text=self.name)
850 return (self.item)
852 def drawcpu(self, canvas, cpu, fromx, tox, ypos): argument
857 ypos - self.ysize() - canvas.bdheight,
859 tags=("cpubg", cpu, self.tag), state="hidden")
860 self.cpuitems.append(l)
862 def move(self, canvas, xpos, ypos): argument
863 canvas.move(self.tag, xpos, ypos)
865 def movename(self, canvas, xpos, ypos): argument
866 self.y += ypos
867 canvas.move(self.item, xpos, ypos)
869 def ysize(self): argument
872 def eventat(self, i): argument
873 if (i >= len(self.events) or i < 0):
875 event = self.events[i]
878 def findevent(self, timestamp): argument
879 for event in self.events:
890 def __init__(self, group, id): argument
895 EventSource.__init__(self, group, id)
897 def fixup(self): argument
898 for event in self.events:
902 if (count > Counter.groups[self.group]):
903 Counter.groups[self.group] = count
904 EventSource.fixup(self)
906 def ymax(self): argument
907 return (Counter.groups[self.group])
909 def ysize(self): argument
912 def yscale(self): argument
913 return (self.ysize() / self.ymax())
916 def __init__(self, file): argument
917 self.timestamp_f = None
918 self.timestamp_l = None
919 self.locks = {}
920 self.ticks = {}
921 self.load = {}
922 self.crit = {}
923 self.stathz = 0
924 self.eventcnt = 0
925 self.taghash = {}
927 self.parse(file)
928 self.fixup()
930 ticksps = self.ticksps()
931 span = self.timespan()
939 titlestr += str(self.eventcnt) + " events"
942 def parse(self, file): argument
999 if (self.checkstamp(timestamp) == 0):
1032 self.setstathz(val, cpu)
1035 e = self.makeevent(group, id, type, args)
1039 def makeevent(self, group, id, type, args): argument
1041 source = self.makeid(group, id, type)
1049 self.eventcnt += 1
1053 def setstathz(self, val, cpu): argument
1054 self.stathz = int(val)
1057 ticks = self.ticks[cpu]
1059 self.ticks[cpu] = 0
1060 self.ticks[cpu] += 1
1062 def checkstamp(self, timestamp): argument
1064 if (self.timestamp_f == None):
1065 self.timestamp_f = timestamp;
1066 if (self.timestamp_l != None and
1067 timestamp -2048> self.timestamp_l):
1069 self.timestamp_l = timestamp;
1072 def makeid(self, group, id, type): argument
1074 if (tag in self.taghash):
1075 return self.taghash[tag]
1081 self.taghash[tag] = source
1084 def findid(self, id): argument
1090 def timespan(self): argument
1091 return (self.timestamp_f - self.timestamp_l);
1093 def ticksps(self): argument
1100 if (self.stathz != 0):
1101 return (self.timespan() / self.ticks[0]) * int(self.stathz)
1108 def fixup(self): argument
1110 e = PadEvent(source, -1, self.timestamp_l)
1112 e = PadEvent(source, -1, self.timestamp_f, last=1)
1118 def __init__(self, master, display): argument
1119 self.display = display
1120 self.parent = master
1121 self.bdheight = master.bdheight
1122 self.items = {}
1123 self.ysize = 0
1124 self.lines = []
1125 Canvas.__init__(self, master, width=120,
1129 def moveline(self, cur_y, y): argument
1130 for line in self.lines:
1131 (x0, y0, x1, y1) = self.coords(line)
1134 self.move(line, 0, y)
1137 def draw(self): argument
1140 self.configure(scrollregion=(0, 0,
1141 self["width"], self.display.ysize()))
1143 l = self.create_line(0, ypos, self["width"], ypos,
1145 self.lines.append(l)
1146 ypos += self.bdheight
1148 t = source.drawname(self, ypos)
1149 self.items[t] = source
1150 ypos += self.bdheight
1151 self.ysize = ypos
1152 self.create_line(0, ypos, self["width"], ypos,
1154 self.bind("<Button-1>", self.master.mousepress);
1155 self.bind("<Button-3>", self.master.mousepressright);
1156 self.bind("<ButtonRelease-1>", self.master.mouserelease);
1157 self.bind("<B1-Motion>", self.master.mousemotion);
1159 def updatescroll(self): argument
1160 self.configure(scrollregion=(0, 0,
1161 self["width"], self.display.ysize()))
1165 def __init__(self, master): argument
1166 self.ratio = 1
1167 self.parent = master
1168 self.bdheight = master.bdheight
1169 self.items = {}
1170 self.lines = []
1171 Canvas.__init__(self, master, width=800, height=500, bg='grey',
1174 def prepare(self): argument
1180 self.ratio = (ktrfile.timespan() - 1) / 2**31 + 1
1182 def draw(self): argument
1184 xsize = self.xsize()
1187 l = self.create_line(0, ypos, xsize, ypos,
1189 self.lines.append(l)
1190 ypos += self.bdheight
1192 source.draw(self, ypos)
1193 ypos += self.bdheight
1194 self.tag_raise("point", "state")
1195 self.tag_lower("cpubg", ALL)
1196 self.create_line(0, ypos, xsize, ypos,
1198 self.tag_bind("event", "<Enter>", self.mouseenter)
1199 self.tag_bind("event", "<Leave>", self.mouseexit)
1200 self.bind("<Button-1>", self.mousepress)
1201 self.bind("<Button-3>", self.master.mousepressright);
1202 self.bind("<Button-4>", self.wheelup)
1203 self.bind("<Button-5>", self.wheeldown)
1204 self.bind("<ButtonRelease-1>", self.master.mouserelease);
1205 self.bind("<B1-Motion>", self.master.mousemotion);
1207 def moveline(self, cur_y, y): argument
1208 for line in self.lines:
1209 (x0, y0, x1, y1) = self.coords(line)
1212 self.move(line, 0, y)
1215 def mouseenter(self, event): argument
1216 item, = self.find_withtag(CURRENT)
1217 self.items[item].mouseenter(self)
1219 def mouseexit(self, event): argument
1220 item, = self.find_withtag(CURRENT)
1221 self.items[item].mouseexit(self)
1223 def mousepress(self, event): argument
1225 items = self.find_withtag(CURRENT)
1227 self.master.mousepress(event)
1231 tags = self.gettags(item)
1234 self.items[item].mousepress(self)
1237 self.master.mousepress(event)
1239 def wheeldown(self, event): argument
1240 self.parent.display_yview("scroll", 1, "units")
1242 def wheelup(self, event): argument
1243 self.parent.display_yview("scroll", -1, "units")
1245 def xsize(self): argument
1246 return ((ktrfile.timespan() / self.ratio) + (X_BORDER * 2))
1248 def ysize(self): argument
1253 ysize += self.parent.sourcesize(source)
1256 def scaleset(self, ratio): argument
1259 oldratio = self.ratio
1260 xstart, xend = self.xview()
1263 self.ratio = ratio
1264 self.updatescroll()
1265 self.scale(ALL, 0, 0, float(oldratio) / ratio, 1)
1267 xstart, xend = self.xview()
1269 self.xview_moveto(midpoint - xsize)
1271 def updatescroll(self): argument
1272 self.configure(scrollregion=(0, 0, self.xsize(), self.ysize()))
1274 def scaleget(self): argument
1275 return self.ratio
1277 def getcolor(self, tag): argument
1278 return self.itemcget(tag, "fill")
1280 def getstate(self, tag): argument
1281 return self.itemcget(tag, "state")
1283 def setcolor(self, tag, color): argument
1284 self.itemconfigure(tag, state="normal", fill=color)
1286 def hide(self, tag): argument
1287 self.itemconfigure(tag, state="hidden")
1290 def __init__(self, master): argument
1291 Frame.__init__(self, master, bd=2, relief=RAISED)
1292 self.conf = Menubutton(self, text="Configure")
1293 self.confmenu = Menu(self.conf, tearoff=0)
1294 self.confmenu.add_command(label="Event Colors",
1295 command=self.econf)
1296 self.confmenu.add_command(label="CPU Colors",
1297 command=self.cconf)
1298 self.confmenu.add_command(label="Source Configure",
1299 command=self.sconf)
1300 self.conf["menu"] = self.confmenu
1301 self.conf.pack(side=LEFT)
1303 def econf(self): argument
1306 def cconf(self): argument
1309 def sconf(self): argument
1313 def __init__(self, master): argument
1314 Frame.__init__(self, master)
1315 self.menu = None
1316 self.names = None
1317 self.display = None
1318 self.scale = None
1319 self.status = None
1320 self.bdheight = Y_BORDER
1321 self.clicksource = None
1322 self.lastsource = None
1323 self.pack(expand=1, fill="both")
1324 self.buildwidgets()
1325 self.layout()
1326 self.bind_all("<Control-q>", self.quitcb)
1328 def quitcb(self, event): argument
1329 self.quit()
1331 def buildwidgets(self): argument
1333 self.menu = GraphMenu(self)
1334 self.display = SchedDisplay(self)
1335 self.names = SchedNames(self, self.display)
1336 self.scale = Scaler(self, self.display)
1337 status = self.status = Status(self)
1338 self.scrollY = Scrollbar(self, orient="vertical",
1339 command=self.display_yview)
1340 self.display.scrollX = Scrollbar(self, orient="horizontal",
1341 command=self.display.xview)
1342 self.display["xscrollcommand"] = self.display.scrollX.set
1343 self.display["yscrollcommand"] = self.scrollY.set
1344 self.names["yscrollcommand"] = self.scrollY.set
1346 def layout(self): argument
1347 self.columnconfigure(1, weight=1)
1348 self.rowconfigure(1, weight=1)
1349 self.menu.grid(row=0, column=0, columnspan=3, sticky=E+W)
1350 self.names.grid(row=1, column=0, sticky=N+S)
1351 self.display.grid(row=1, column=1, sticky=W+E+N+S)
1352 self.scrollY.grid(row=1, column=2, sticky=N+S)
1353 self.display.scrollX.grid(row=2, column=0, columnspan=2,
1355 self.scale.grid(row=3, column=0, columnspan=3, sticky=E+W)
1356 self.status.grid(row=4, column=0, columnspan=3, sticky=E+W)
1358 def draw(self): argument
1359 self.master.update()
1360 self.display.prepare()
1361 self.names.draw()
1362 self.display.draw()
1363 self.status.startup("")
1367 scalemax = ktrfile.timespan() / int(self.display["width"])
1369 self.constwidth = width - int(self.display["width"])
1370 self.scale.setmax(scalemax)
1371 self.scale.set(scalemax)
1372 self.display.xview_moveto(0)
1373 self.bind("<Configure>", self.resize)
1375 def mousepress(self, event): argument
1376 self.clicksource = self.sourceat(event.y)
1378 def mousepressright(self, event): argument
1379 source = self.sourceat(event.y)
1384 def mouserelease(self, event): argument
1385 if (self.clicksource == None):
1387 newsource = self.sourceat(event.y)
1388 if (self.clicksource != newsource):
1389 self.sourceswap(self.clicksource, newsource)
1390 self.clicksource = None
1391 self.lastsource = None
1393 def mousemotion(self, event): argument
1394 if (self.clicksource == None):
1396 newsource = self.sourceat(event.y)
1404 self.clicksource = None
1405 self.lastsource = None
1407 if (newsource == self.lastsource):
1409 self.lastsource = newsource
1410 if (newsource != self.clicksource):
1411 self.sourceswap(self.clicksource, newsource)
1414 def sourcestart(self, source): argument
1415 return source.y - self.bdheight - source.ysize()
1417 def sourceend(self, source): argument
1418 return source.y + self.bdheight
1420 def sourcesize(self, source): argument
1421 return (self.bdheight * 2) + source.ysize()
1423 def sourceswap(self, source1, source2): argument
1430 if (self.sourceend(source1) != self.sourcestart(source2)):
1433 y1 = self.sourcestart(source1)
1434 y2 = self.sourcestart(source2)
1435 y1targ = y1 + self.sourcesize(source2)
1443 self.names.moveline(y2, diff);
1444 self.display.moveline(y2, diff)
1445 source1.move(self.display, 0, y1targ - y1)
1446 source2.move(self.display, 0, y2targ - y2)
1447 source1.movename(self.names, 0, y1targ - y1)
1448 source2.movename(self.names, 0, y2targ - y2)
1450 def sourcepicky(self, source): argument
1452 return self.sourcestart(source)
1464 newy = self.sourcestart(prev) + self.sourcesize(prev)
1467 def sourceshow(self, source): argument
1470 newy = self.sourcepicky(source)
1471 off = newy - self.sourcestart(source)
1472 self.sourceshiftall(newy-1, self.sourcesize(source))
1473 self.sourceshift(source, off)
1481 def sourceshowlist(self, srclist): argument
1487 startsize.append((self.sourcepicky(source),
1488 self.sourcesize(source)))
1491 self.status.startup("Updating display...");
1495 nstart = self.sourcestart(source)
1501 self.sourceshift(source, size)
1506 off = (newy + size) - self.sourcestart(source)
1507 self.sourceshift(source, off)
1511 self.updatescroll()
1512 self.status.set("")
1519 def sourcehidelist(self, srclist): argument
1524 self.status.startup("Updating display...");
1532 startsize.append((self.sourcestart(source),
1533 self.sourcesize(source)))
1534 self.sourceshift(source, off)
1545 stop = self.display.ysize()
1548 nstart = self.sourcestart(source)
1553 self.sourceshift(source, -size)
1554 self.updatescroll()
1555 self.status.set("")
1557 def sourcehide(self, source): argument
1562 start = self.sourcestart(source)
1563 self.sourceshift(source, off)
1564 self.sourceshiftall(start, -self.sourcesize(source))
1567 def sourceshift(self, source, off): argument
1568 start = self.sourcestart(source)
1569 source.move(self.display, 0, off)
1570 source.movename(self.names, 0, off)
1571 self.names.moveline(start, off);
1572 self.display.moveline(start, off)
1577 self.names.update_idletasks()
1578 self.display.update_idletasks()
1580 def sourceshiftall(self, start, off): argument
1581 self.status.startup("Updating display...");
1583 nstart = self.sourcestart(source)
1586 self.sourceshift(source, off)
1587 self.updatescroll()
1588 self.status.set("")
1590 def sourceat(self, ypos): argument
1591 (start, end) = self.names.yview()
1592 starty = start * float(self.names.ysize)
1597 yend = self.sourceend(source)
1598 ystart = self.sourcestart(source)
1603 def display_yview(self, *args): argument
1604 self.names.yview(*args)
1605 self.display.yview(*args)
1607 def resize(self, *args): argument
1609 scalemax = ktrfile.timespan() / (width - self.constwidth)
1610 self.scale.setmax(scalemax)
1612 def updatescroll(self): argument
1613 self.names.updatescroll()
1614 self.display.updatescroll()
1616 def setcolor(self, tag, color): argument
1617 self.display.setcolor(tag, color)
1619 def hide(self, tag): argument
1620 self.display.hide(tag)
1622 def getcolor(self, tag): argument
1623 return self.display.getcolor(tag)
1625 def getstate(self, tag): argument
1626 return self.display.getstate(tag)