def dropEvent(self, event): GLView.dropEvent(self, event) if event.mimeData().hasUrls(): p = self.camera.qt_to_opengl(event.pos()) current_x = p.x() for url in event.mimeData().urls(): filename = str(url.toString(QtCore.QUrl.RemoveScheme)) filename = os.path.normpath(filename) hue = random.random() color = QtGui.QColor.fromHsvF(hue, 0.5, 0.75) r, g, b = color.redF(), color.greenF(), color.blueF() clip = Clip() clip._color = (r, g, b, 1) clip.name = os.path.basename(filename) clip.producer = mlt.Producer(mlt_profile, filename) clip.start_frame = current_x cpgl = clip.producer.get_length() if cpgl == 15000: # some hardcoded value? cpgl = 25 clip.end_frame = clip.start_frame+cpgl current_x = clip.end_frame+1 clip.producer.set("in", 0) clip.producer.set("out", cpgl) clip.track = self.scene.tracks clip.path = filename self.scene.clips.append(clip) self.scene.generate_mlt() self.updateImage()
def __init__(self, parent=None): GLView.__init__(self, parent) self.setWindowTitle("very-simple-nle") self.setAcceptDrops(True) self.scene = Scene() self.parameters = ParameterWindow(main_window=self, parent=None) self.parameters.show() self.parameters.raise_() self.setAutoFillBackground(False) self.setAttribute(QtCore.Qt.WA_StaticContents, True) self.setAttribute(QtCore.Qt.WA_OpaquePaintEvent, True) self.setAttribute(QtCore.Qt.WA_NoSystemBackground, True) self.setAttribute(QtCore.Qt.WA_PaintOnScreen, True) self.playhead = 0 self.texture = -1 self.texture_data = None self.tc = tc(25) self.playbackTimer = QtCore.QTimer(self) self.playbackTimer.setInterval(1000/25) self.connect(self.playbackTimer, QtCore.SIGNAL("timeout()"), self.onPlaybackTimer) self.play = False if os.path.exists("test.scene"): self.scene.load("test.scene") else: for c in range(10): hue = random.random() color = QtGui.QColor.fromHsvF(hue, 0.5, 0.75) r, g, b = color.redF(), color.greenF(), color.blueF() clip = Clip() clip._color = (r, g, b, 1) clip.name = "clip%d" % c clip.start_frame = c*120 clip.end_frame = c*120+119 clip.track = random.randint(0, 1) clip.path = "../media/output%d.mov" % (clip.track+1) self.scene.clips.append(clip) self.scene.save_as("test.scene") self.scene.generate_mlt() self.camera.translate(100, self.height()-50) self.updateImage() self.extendLeft = None self.extendRight = None self.cursorLeft = QtGui.QCursor(QtGui.QPixmap("img/trim_left.png")) self.cursorRight = QtGui.QCursor(QtGui.QPixmap("img/trim_right.png")) self.gl_font = QtGui.QFont("Tahoma", 9) self.pointVertices = [] self.textureCoordinates = []