def on_action_render(self): """ Get file name. Then show a progress dialog while rendering to file. """ if self.corr_thread is not None: error_msg = self.tr("Cannot render to file, another {} is active").format( self.preview_or_render ) qw.QMessageBox.critical(self, "Error", error_msg) return # Name and extension (no folder). video_filename = self.get_save_filename(cli.VIDEO_NAME) filters = ["MP4 files (*.mp4)", "All files (*)"] # Points to either `file_dir` or `render_dir`. # Folder is obtained from `dir_ref`. dir_ref = self.pref.render_dir_ref path = get_save_file_path( self, "Render to Video", dir_ref, video_filename, filters, cli.VIDEO_NAME ) if path: name = str(path) dlg = CorrProgressDialog(self, "Rendering video") # FFmpegOutputConfig contains only hashable/immutable strs, # so get_ffmpeg_cfg() can be shared across threads without copying. # Optionally copy_config() first. outputs = [self.cfg.get_ffmpeg_cfg(name)] self.play_thread(outputs, PreviewOrRender.render, dlg)
def on_action_save_as(self) -> bool: """ :return: False if user cancels save action. """ # Name and extension (no folder). cfg_filename = self.get_save_filename(cli.YAML_NAME) # Folder is obtained from self.pref.file_dir_ref. filters = ["YAML files (*.yaml)", "All files (*)"] path = get_save_file_path( self, "Save As", self.pref.file_dir_ref, cfg_filename, filters, cli.YAML_NAME, ) if path: self._cfg_path = path self.load_title() self.on_action_save() return True else: return False
def on_action_render(self): """ Get file name. Then show a progress dialog while rendering to file. """ error_msg = "Cannot render to file, another play/render is active" if self.corr_thread is not None: qw.QMessageBox.critical(self, "Error", error_msg) return video_path = self.file_stem + cli.VIDEO_NAME filters = ["MP4 files (*.mp4)", "All files (*)"] # Points to either `file_dir` or `render_dir`. ref = self.pref.render_dir_ref path = get_save_file_path(ref, self, "Render to Video", video_path, filters, cli.VIDEO_NAME) if path: name = str(path) dlg = CorrProgressDialog(self, "Rendering video") outputs = [FFmpegOutputConfig(name)] self.play_thread(outputs, dlg)
def on_action_save_as(self) -> bool: """ :return: False if user cancels save action. """ cfg_path_default = self.file_stem + cli.YAML_NAME filters = ["YAML files (*.yaml)", "All files (*)"] path = get_save_file_path( self.pref.file_dir_ref, self, "Save As", cfg_path_default, filters, cli.YAML_NAME, ) if path: self._cfg_path = path self.load_title() self.on_action_save() return True else: return False