def paintTickMarks(self, qp): if (self.struct_times_days != None): qp.setPen(self.pen_tick_days) qp.setBrush(self.color_tick_days) qp.setFont(self.font_tick_days) metrics = qp.fontMetrics() for n, time_struct in enumerate(self.struct_times_days): if (n == 0): mstime = self.t0 else: mstime = self.mstimestamps_days[n] if (mstime >= self.t0): x0 = int(round(self.pixel_per_msec * (mstime - self.t0))) + self.lmx y0 = 0 timestr=str(time_struct.tm_mday) + ". " + \ str(time_struct.tm_mon) + ". " + str(time_struct.tm_year) fx = 0 fy = int(round(metrics.height())) qp.drawText(QtCore.QPoint(x0 + fx, y0 + fy), timestr) if (self.struct_times_major != None): qp.setPen(self.pen_tick_major) qp.setBrush(self.color_tick_major) qp.setFont(self.font_tick_major) metrics = qp.fontMetrics() for n, time_struct in enumerate(self.struct_times_major): mstime = self.mstimestamps_major[n] if (mstime >= self.t0): x0 = int(round(self.pixel_per_msec * (mstime - self.t0))) + self.lmx x1 = x0 y0 = self.ytick y1 = y0 + self.matick qp.drawLine(QtCore.QLine(x0, y0, x0, y1)) timestr=str(time_struct.tm_hour) + ":" + \ str(time_struct.tm_min) + ":" + str(time_struct.tm_sec) fx = -int(round(metrics.width(timestr) / 2)) fy = int(round(metrics.height())) qp.drawText(QtCore.QPoint(x0 + fx, y1 + fy), timestr) if (self.struct_times_minor != None): qp.setPen(self.pen_tick_minor) qp.setBrush(self.color_tick_minor) for n, time_struct in enumerate(self.struct_times_minor): mstime = self.mstimestamps_minor[n] if (mstime >= self.t0): x0 = int(round(self.pixel_per_msec * (mstime - self.t0))) + self.lmx x1 = x0 y0 = self.ytick y1 = y0 + self.mitick qp.drawLine(QtCore.QLine(x0, y0, x0, y1))
def paintTimeBar(self, qp): if (self.mstime != None): qp.setPen(self.pen_timebar) qp.setBrush(self.color_timebar) self.logger.debug("paintTimeBar: mstime=%s, t0=%s, lmx=%s",\ self.mstime, self.t0, self.lmx) x0 = int(round( (self.mstime - self.t0) * self.pixel_per_msec)) + self.lmx y0 = 0 y1 = self.h + self.lmy + self.umy self.logger.debug("paintTimeBar: x0=%s, y0=%s, y1=%s",\ x0, y0, y1) qp.drawLine(QtCore.QLine(x0, y0, x0, y1))