def draw_packets(self, packets): #cur_packet_no = 0 if packets == None: packets = self.cached_packets else: self.cached_packets = packets for p in packets: #if self.xmin < texttime.sec_between(self.maxtime, p[1]) < self.xmax: if self.xmin < texttime.sec_between(p[1], self.start_packet_time) < self.xmax: #print "Recent packet", p[1], texttime.sec_between(self.maxtime, p[1]) self.add_rectangle(p[0], texttime.sec_between(p[1], self.start_packet_time), p[2], p[3], p[4], p[1])
def set_lims(self, maxtime, maxnode): self.maxtime = maxtime self.maxnode = maxnode self.xmax = texttime.sec_between(maxtime, self.start_packet_time)+10 self.xmin = max(0, self.xmax - self.SECONDS_TO_SHOW) self.ymax = maxnode+2 self.axes.set_xlim(self.xmin, self.xmax) self.axes.set_ylim(self.ymin, self.ymax) self.axes.set_yticks(range(0, self.ymax)) self.axes.yaxis.grid(True, linewidth=.2)