def openFrameGroup(self, fgroup): '''Slot to know when the application opens a new framegroup''' frameCount = len(fgroup) self.ui.frameSlider.setMaximum(frameCount -1) # render previews f0 = fgroup[0][0].asQPixmap() previewW = self.ui.previewLabel.width() previewH = self.ui.previewLabel.height() previewPmap = QtGui.QPixmap(previewW, previewH) previewPmap.fill() scaledW = f0.width() * previewH / f0.height() printCount = int(previewW) / int(scaledW) # int division freeSpace = float(previewW - (printCount * scaledW)) / (printCount - 1) painter = QtGui.QPainter(previewPmap) for i in xrange(printCount): fid = int(round(float(i * (frameCount-1)) / (printCount-1))) x = int(round(i * (freeSpace + scaledW))) frame = fgroup[fid][0].asQPixmap().scaled(scaledW, previewH) painter.drawPixmap(x,0,frame) painter.end() self.ui.previewLabel.setPixmap(previewPmap) # render the current frame self.ui.frameLabel.setPixmap(fgroup.current()[0].asQPixmap())
def paintEvent(self, e): qp = QtGui.QPainter() qp.begin(self) qp.Antialiasing = True self.drawWidget(qp) qp.end()