def browseOutput(self): dlg = QFileDialog() dlg.setFileMode(QFileDialog.Directory) if self.txt_output_path and Path(self.txt_output_path.text()).exists(): dlg.setDirectory(self.txt_output_path.text()) if dlg.exec_(): self.txt_output_path.setText(dlg.selectedFiles()[0])
def open(self): fileDialog = QFileDialog(self) supportedMimeTypes = QMediaPlayer.supportedMimeTypes() if not supportedMimeTypes: supportedMimeTypes.append("video/x-msvideo") # AVI fileDialog.setMimeTypeFilters(supportedMimeTypes) moviesLocation = QStandardPaths.writableLocation( QStandardPaths.MoviesLocation) fileDialog.setDirectory(moviesLocation) if fileDialog.exec_() == QDialog.Accepted: self.playlist.addMedia(fileDialog.selectedUrls()[0]) self.player.play()