def send_edl(self, edl_path, media_path): """Sends the edl with the given path to AVID, also copies the MXF files to the media folder path :param edl_path: The edl path :param media_path: The AVID media files path """ # get the source clips from edl import edl parser = edl.Parser('24') # just use some random frame rate with open(edl_path) as f: l = parser.parse(f) total_item_count = len(l) + 1 progress_dialog = QtWidgets.QProgressDialog(self) progress_dialog.setRange(0, total_item_count) progress_dialog.setLabelText('Copying MXF files...') progress_dialog.show() step = 0 progress_dialog.setValue(step) for event in l: # assert isinstance(event, edl.Event) mov_full_path = event.source_file mxf_full_path = os.path.expandvars( os.path.splitext(mov_full_path)[0] + '.mxf' ) target_mxf_path = os.path.expandvars( os.path.join( media_path, os.path.basename(mxf_full_path) ) ) shutil.copy( mxf_full_path, target_mxf_path ) step += 1 progress_dialog.setValue(step) # and call EDL_Manager.exe with the edl_path progress_dialog.setLabelText('Calling EDL Manager...') step += 1 progress_dialog.setValue(step) subprocess.call(['EDL_Mgr', os.path.normcase(edl_path)], shell=False)
def create_dialog(self): """creates the progressWindow """ if self.use_ui: if self.dialog is None: self.dialog = \ QtWidgets.QProgressDialog(self.parent) # QtGui.QProgressDialog(None, QtCore.Qt.WindowStaysOnTopHint) # self.dialog.setMinimumDuration(2000) self.dialog.setRange(0, self.max_steps) self.dialog.setLabelText(self.title) # self.dialog.setAutoClose(True) # self.dialog.setAutoReset(True) self.center_window() self.dialog.show() # also set the Manager to in progress self.in_progress = True