def __init__(self, label, indices, pos, length, height, label_width, frame_width, color, parent=None): super(TimeLine, self).__init__(parent) self._pos = pos self._length = length self._height = height self.label = label self._label_width = label_width self._indices = indices self.frame_width = frame_width size = QSizeF() size.setHeight(self._height) size.setWidth(self._length) self._bounding_rect = QRectF() self._bounding_rect.setX(self._pos.x()) self._bounding_rect.setY(self._pos.y()) self._bounding_rect.setSize(size) self._tpos = QPointF(pos) self._tpos.setY(pos.y() + self._height) self.color = QColor() self.color.setRed(color[0] * 255) self.color.setGreen(color[1] * 255) self.color.setBlue(color[2] * 255) self.color.setAlpha(255)
def create_frame_indicator(self): size = QSizeF() height = 100 size.setHeight(height) size.setWidth(self.label_height) self.frame_indicator = FrameIndicator(size, self.frame_width, self.label_width, 0) self._label_scene.addItem(self.frame_indicator) self.edit_start_frame_indicator = FrameIndicator( size, self.frame_width, self.label_width, 0, blue) self._label_scene.addItem(self.edit_start_frame_indicator)
def getSizeFromCmnd(self, sizeinfo): ''' Returns a QSizeF based on the information in the dictionary sizeinfo. Recognized keys are "width" and "height", and correspond to those float values in the QSizeF. Values not given in sizeinfo are assigned as zero in the returned QSizeF. ''' myrect = QSizeF(0.0, 0.0) try: myrect.setWidth(float(sizeinfo["width"])) except KeyError: pass try: myrect.setHeight(float(sizeinfo["height"])) except KeyError: pass return myrect