def pause_resume_queue(self): if self.app.fastflix.conversion_paused: self.pause_queue.setText(t("Pause Queue")) self.pause_queue.setIcon( QtGui.QIcon( get_icon("onyx-pause", self.app.fastflix.config.theme))) send_next = self.main.send_next_video() logger.debug(f"queue resumed, will I send next? {send_next}") else: self.pause_queue.setText(t("Resume Queue")) self.pause_queue.setIcon( QtGui.QIcon(get_icon("play", self.app.fastflix.config.theme))) # self.app.fastflix.worker_queue.put(["pause queue"]) self.app.fastflix.conversion_paused = not self.app.fastflix.conversion_paused
def init_dhdr10_warning_and_opt(self): label = QtWidgets.QLabel() label.setToolTip( "WARNING: This only works on a few FFmpeg builds, and it will not raise error on failure!\n" "Specifically, FFmpeg needs the x265 ENABLE_HDR10_PLUS option enabled on compile.\n" "The latest windows builds from BtbN should have this feature.\n" "I do not know of any public Linux/Mac ones that do.") icon = QtGui.QIcon( get_icon("onyx-warning", self.app.fastflix.config.theme)) label.setPixmap(icon.pixmap(22)) layout = QtWidgets.QHBoxLayout() self.extract_button = QtWidgets.QPushButton(t("Extract HDR10+")) self.extract_button.hide() self.extract_button.clicked.connect(self.extract_hdr10plus) self.extract_label = QtWidgets.QLabel(self) self.extract_label.hide() self.movie = QtGui.QMovie(loading_movie) self.movie.setScaledSize(QtCore.QSize(25, 25)) self.extract_label.setMovie(self.movie) layout.addWidget(self.extract_button) layout.addWidget(self.extract_label) layout.addWidget(label) layout.addLayout(self.init_dhdr10_opt()) return layout
def _add_file_select(self, label, widget_name, button_action, connect="default", enabled=True, tooltip=""): layout = QtWidgets.QHBoxLayout() self.labels[widget_name] = QtWidgets.QLabel(t(label)) self.labels[widget_name].setToolTip(tooltip) self.widgets[widget_name] = QtWidgets.QLineEdit() self.widgets[widget_name].setDisabled(not enabled) self.widgets[widget_name].setToolTip(tooltip) self.opts[widget_name] = widget_name if connect: if connect == "default": self.widgets[widget_name].textChanged.connect( lambda: self.main.page_update(build_thumbnail=False)) elif connect == "self": self.widgets[widget_name].textChanged.connect( lambda: self.page_update()) else: self.widgets[widget_name].textChanged.connect(connect) button = QtWidgets.QPushButton(icon=QtGui.QIcon( get_icon("onyx-file-search", self.app.fastflix.config.theme))) button.clicked.connect(button_action) layout.addWidget(self.labels[widget_name]) layout.addWidget(self.widgets[widget_name]) layout.addWidget(button) return layout
def change_conversion(self, conversion): conversion = conversion.strip() encoder = self.app.fastflix.encoders[conversion] self.current_settings.close() self.current_settings = encoder.settings_panel(self, self.main, self.app) self.current_settings.show() self.removeTab(0) self.insertTab(0, self.current_settings, t("Quality")) self.setTabIcon( 0, QtGui.QIcon( get_icon("onyx-quality", self.app.fastflix.config.theme))) self.setCurrentIndex(0) self.change_tab(0) self.setTabEnabled(1, getattr(encoder, "enable_audio", True)) self.setTabEnabled(2, getattr(encoder, "enable_subtitles", True)) self.setTabEnabled(3, getattr(encoder, "enable_attachments", True)) self.selected = conversion self.current_settings.new_source() self.main.page_update(build_thumbnail=False) if (self.app.fastflix.current_video and not getattr(self.main.current_encoder, "enable_concat", False) and self.app.fastflix.current_video.concat): error_message( f"This encoder, {self.main.current_encoder.name} does not support concatenating files together" ) # Page update does a reload which bases itself off the current encoder so we have to do audio formats after self.audio.allowed_formats(self._get_audio_formats(encoder))
def __init__(self, parent, app: FastFlixApp): super(CommandList, self).__init__(parent) self.app = app self.video_options = parent layout = QtWidgets.QGridLayout() top_row = QtWidgets.QHBoxLayout() top_row.addWidget(QtWidgets.QLabel(t("Commands to execute"))) copy_commands_button = QtWidgets.QPushButton( QtGui.QIcon(get_icon("onyx-copy", self.app.fastflix.config.theme)), t("Copy Commands")) copy_commands_button.setToolTip( t("Copy all commands to the clipboard")) copy_commands_button.clicked.connect( lambda: self.copy_commands_to_clipboard()) save_commands_button = QtWidgets.QPushButton( QtGui.QIcon(get_icon("onyx-save", self.app.fastflix.config.theme)), t("Save Commands")) save_commands_button.setToolTip(t("Save commands to file")) save_commands_button.clicked.connect( lambda: self.save_commands_to_file()) top_row.addStretch() top_row.addWidget(copy_commands_button) top_row.addWidget(save_commands_button) layout.addLayout(top_row, 0, 0) self.inner_widget = QtWidgets.QWidget() self.scroll_area = QtWidgets.QScrollArea(self) self.scroll_area.setMinimumHeight(200) layout.addWidget(self.scroll_area) self.commands = [] self.setLayout(layout)
def __init__(self, parent): super().__init__() self.main = parent self.label = ImageLabel(self) self.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) screen = self.main.app.primaryScreen() size = screen.size() self.setMaximumWidth(size.width()) self.setMaximumHeight(size.height()) self.setMinimumSize(400, 400) self.current_image = QtGui.QPixmap( get_icon("onyx-cover", self.main.app.fastflix.config.theme)) self.last_path: Optional[Path] = None self.last_command = "NOPE" self.setWindowTitle(t("Preview - Press Q to Exit"))
def __init__(self, parent, app: FastFlixApp): super().__init__(parent) self.app = app self.main = parent.main self.attachments = Box() self.updating = False self.only_int = QtGui.QIntValidator() self.layout = QtWidgets.QGridLayout() self.last_row = 0 self.init_fps() self.add_spacer() self.init_video_speed() self.add_spacer() self.init_eq() self.add_spacer() self.init_denoise() self.add_spacer() self.init_deblock() self.add_spacer() self.init_color_info() self.add_spacer() self.init_vbv() self.last_row += 1 self.layout.setRowStretch(self.last_row, True) # self.layout.setColumnStretch(6, True) self.last_row += 1 warning_label = QtWidgets.QLabel() ico = QtGui.QIcon(get_icon("onyx-warning", app.fastflix.config.theme)) warning_label.setPixmap(ico.pixmap(22)) self.layout.addWidget(warning_label, self.last_row, 0, alignment=QtCore.Qt.AlignRight) self.layout.addWidget( QtWidgets.QLabel( t("Advanced settings are currently not saved in Profiles")), self.last_row, 1, 1, 4) for i in range(6): self.layout.setColumnMinimumWidth(i, 155) self.setLayout(self.layout)
def __init__(self, parent, app: FastFlixApp): super().__init__(parent) self.app = app self.main = parent.main self.attachments = Box() self.updating = False self.only_int = QtGui.QIntValidator() self.only_float = QtGui.QDoubleValidator() self.layout = QtWidgets.QGridLayout() self.last_row = 0 self.init_fps() self.add_spacer() self.init_video_speed() self.add_spacer() self.init_eq() self.add_spacer() self.init_denoise() self.add_spacer() self.init_deblock() self.add_spacer() self.init_color_info() self.add_spacer() self.init_vbv() self.add_spacer() self.layout.setRowStretch(self.last_row, True) self.init_hw_message() # self.add_spacer() # self.init_custom_filters() # self.last_row += 1 # self.layout.setColumnStretch(6, True) self.last_row += 1 warning_label = QtWidgets.QLabel() ico = QtGui.QIcon(get_icon("onyx-warning", app.fastflix.config.theme)) warning_label.setPixmap(ico.pixmap(22)) for i in range(1, 7): self.layout.setColumnMinimumWidth(i, 155) self.setLayout(self.layout)
def __init__(self, parent, main, app: FastFlixApp): super().__init__(parent, main, app) self.main = main self.app = app grid = QtWidgets.QGridLayout() self.widgets = Box(mode=None) self.mode = "Bitrate" self.updating_settings = False grid.addLayout(self.init_modes(), 0, 2, 4, 4) grid.addLayout( self._add_custom(title="Custom VCEEncC options", disable_both_passes=True), 10, 0, 1, 6) grid.addLayout(self.init_preset(), 0, 0, 1, 2) grid.addLayout(self.init_profile(), 1, 0, 1, 2) grid.addLayout(self.init_mv_precision(), 2, 0, 1, 2) grid.addLayout(self.init_pre(), 3, 0, 1, 2) breaker = QtWidgets.QHBoxLayout() breaker_label = QtWidgets.QLabel(t("Advanced")) breaker_label.setFont(QtGui.QFont("helvetica", 8, weight=55)) breaker.addWidget(get_breaker(), stretch=1) breaker.addWidget(breaker_label, alignment=QtCore.Qt.AlignHCenter) breaker.addWidget(get_breaker(), stretch=1) grid.addLayout(breaker, 4, 0, 1, 6) qp_line = QtWidgets.QHBoxLayout() qp_line.addLayout(self.init_min_q()) qp_line.addStretch(1) qp_line.addLayout(self.init_max_q()) qp_line.addStretch(1) qp_line.addLayout(self.init_ref()) qp_line.addStretch(1) qp_line.addLayout(self.init_b_frames()) qp_line.addStretch(1) qp_line.addLayout(self.init_level()) qp_line.addStretch(1) qp_line.addLayout(self.init_decoder()) qp_line.addStretch(1) qp_line.addLayout(self.init_metrics()) grid.addLayout(qp_line, 5, 0, 1, 6) self.ffmpeg_level = QtWidgets.QLabel() grid.addWidget(self.ffmpeg_level, 8, 2, 1, 4) grid.setRowStretch(9, 1) guide_label = QtWidgets.QLabel( link( "https://github.com/rigaya/VCEEnc/blob/master/VCEEncC_Options.en.md", t("VCEEncC Options"), app.fastflix.config.theme, )) warning_label = QtWidgets.QLabel() warning_label.setPixmap( QtGui.QIcon( get_icon("onyx-warning", self.app.fastflix.config.theme)).pixmap(22)) guide_label.setAlignment(QtCore.Qt.AlignBottom) guide_label.setOpenExternalLinks(True) grid.addWidget(guide_label, 11, 0, 1, 4) grid.addWidget(warning_label, 11, 4, 1, 1, alignment=QtCore.Qt.AlignRight) grid.addWidget( QtWidgets.QLabel( t("VCEEncC Encoder support is still experimental!")), 11, 5, 1, 1) self.setLayout(grid) self.hide() self.hdr10plus_signal.connect(self.done_hdr10plus_extract) self.hdr10plus_ffmpeg_signal.connect( lambda x: self.ffmpeg_level.setText(x))
def __init__(self, parent, video: Video, index, first=False): self.loading = True super().__init__(parent) self.parent = parent self.index = index self.first = first self.last = False self.video = video.copy() self.setFixedHeight(60) self.widgets = Box( up_button=QtWidgets.QPushButton( QtGui.QIcon( get_icon("up-arrow", self.parent.app.fastflix.config.theme)), ""), down_button=QtWidgets.QPushButton( QtGui.QIcon( get_icon("down-arrow", self.parent.app.fastflix.config.theme)), ""), cancel_button=QtWidgets.QPushButton( QtGui.QIcon( get_icon("black-x", self.parent.app.fastflix.config.theme)), ""), reload_button=QtWidgets.QPushButton( QtGui.QIcon( get_icon("edit-box", self.parent.app.fastflix.config.theme)), ""), retry_button=QtWidgets.QPushButton( QtGui.QIcon( get_icon("undo", self.parent.app.fastflix.config.theme)), ""), ) for widget in self.widgets.values(): widget.setStyleSheet(no_border) title = QtWidgets.QLabel( video.video_settings.video_title if video.video_settings. video_title else video.video_settings.output_path.name) title.setFixedWidth(300) settings = Box(copy.deepcopy(video.video_settings.dict())) settings.output_path = str(settings.output_path) for i, o in enumerate(settings.attachment_tracks): if o.get("file_path"): o["file_path"] = str(o["file_path"]) del settings.conversion_commands title.setToolTip(settings.to_yaml()) open_button = QtWidgets.QPushButton( QtGui.QIcon(get_icon("play", self.parent.app.fastflix.config.theme)), t("Open Directory")) open_button.setLayoutDirection(QtCore.Qt.RightToLeft) open_button.setIconSize(QtCore.QSize(14, 14)) open_button.clicked.connect( lambda: open_folder(video.video_settings.output_path.parent)) view_button = QtWidgets.QPushButton( QtGui.QIcon(get_icon("play", self.parent.app.fastflix.config.theme)), t("Watch")) view_button.setLayoutDirection(QtCore.Qt.RightToLeft) view_button.setIconSize(QtCore.QSize(14, 14)) view_button.clicked.connect(lambda: QtGui.QDesktopServices.openUrl( QtCore.QUrl.fromLocalFile(str(video.video_settings.output_path)))) open_button.setStyleSheet(no_border) view_button.setStyleSheet(no_border) add_retry = False status = t("Ready to encode") if video.status.error: status = t("Encoding errored") elif video.status.complete: status = f"{t('Encoding complete')}" elif video.status.running: status = ( f"{t('Encoding command')} {video.status.current_command + 1} {t('of')} " f"{len(video.video_settings.conversion_commands)}") elif video.status.cancelled: status = t("Cancelled") add_retry = True if not self.video.status.running: self.widgets.cancel_button.clicked.connect( lambda: self.parent.remove_item(self.video)) self.widgets.reload_button.clicked.connect( lambda: self.parent.reload_from_queue(self.video)) self.widgets.cancel_button.setFixedWidth(25) self.widgets.reload_button.setFixedWidth(25) else: self.widgets.cancel_button.hide() self.widgets.reload_button.hide() grid = QtWidgets.QGridLayout() grid.addLayout(self.init_move_buttons(), 0, 0) # grid.addWidget(self.widgets.track_number, 0, 1) grid.addWidget(title, 0, 1, 1, 3) grid.addWidget( QtWidgets.QLabel( f"{video.video_settings.video_encoder_settings.name}"), 0, 4) grid.addWidget( QtWidgets.QLabel( f"{t('Audio Tracks')}: {len(video.video_settings.audio_tracks)}" ), 0, 5) grid.addWidget( QtWidgets.QLabel( f"{t('Subtitles')}: {len(video.video_settings.subtitle_tracks)}" ), 0, 6) grid.addWidget(QtWidgets.QLabel(status), 0, 7) if video.status.complete and not get_bool_env("FF_DOCKERMODE"): grid.addWidget(view_button, 0, 8) grid.addWidget(open_button, 0, 9) elif add_retry: grid.addWidget(self.widgets.retry_button, 0, 8) self.widgets.retry_button.setFixedWidth(25) self.widgets.retry_button.clicked.connect( lambda: self.parent.retry_video(self.video)) right_buttons = QtWidgets.QHBoxLayout() right_buttons.addWidget(self.widgets.reload_button) right_buttons.addWidget(self.widgets.cancel_button) grid.addLayout(right_buttons, 0, 10, alignment=QtCore.Qt.AlignRight) self.setLayout(grid) self.loading = False self.updating_burn = False
def __init__(self, parent, app: FastFlixApp): self.main = parent.main self.app = app self.paused = False self.encode_paused = False self.encoding = False top_layout = QtWidgets.QHBoxLayout() top_layout.addWidget(QtWidgets.QLabel(t("Queue"))) top_layout.addStretch(1) self.clear_queue = QtWidgets.QPushButton( QtGui.QIcon( get_icon("onyx-clear-queue", self.app.fastflix.config.theme)), t("Clear Completed")) self.clear_queue.clicked.connect(self.clear_complete) self.clear_queue.setFixedWidth(120) self.clear_queue.setToolTip(t("Remove completed tasks")) self.pause_queue = QtWidgets.QPushButton( QtGui.QIcon(get_icon("onyx-pause", self.app.fastflix.config.theme)), t("Pause Queue")) self.pause_queue.clicked.connect(self.pause_resume_queue) # pause_queue.setFixedHeight(40) self.pause_queue.setFixedWidth(120) self.pause_queue.setToolTip( t("Wait for the current command to finish," " and stop the next command from processing")) self.pause_encode = QtWidgets.QPushButton( QtGui.QIcon(get_icon("onyx-pause", self.app.fastflix.config.theme)), t("Pause Encode")) self.pause_encode.clicked.connect(self.pause_resume_encode) # pause_queue.setFixedHeight(40) self.pause_encode.setFixedWidth(120) self.pause_encode.setToolTip(t("Pause / Resume the current command")) self.after_done_combo = QtWidgets.QComboBox() self.after_done_combo.addItem("None") actions = set() if reusables.win_based: actions.update(done_actions["windows"].keys()) elif sys.platform == "darwin": actions.update(["shutdown", "restart"]) else: actions.update(done_actions["linux"].keys()) if self.app.fastflix.config.custom_after_run_scripts: actions.update(self.app.fastflix.config.custom_after_run_scripts) self.after_done_combo.addItems(sorted(actions)) self.after_done_combo.setToolTip( "Run a command after conversion completes") self.after_done_combo.currentIndexChanged.connect( lambda: self.set_after_done()) self.after_done_combo.setMaximumWidth(150) top_layout.addWidget(QtWidgets.QLabel(t("After Conversion"))) top_layout.addWidget(self.after_done_combo, QtCore.Qt.AlignRight) top_layout.addWidget(self.pause_encode, QtCore.Qt.AlignRight) top_layout.addWidget(self.pause_queue, QtCore.Qt.AlignRight) top_layout.addWidget(self.clear_queue, QtCore.Qt.AlignRight) super().__init__(app, parent, t("Queue"), "queue", top_row_layout=top_layout) try: self.queue_startup_check() except Exception: logger.exception( "Could not load queue as it is outdated or malformed. Deleting for safety." ) save_queue([], queue_file=self.app.fastflix.queue_path, config=self.app.fastflix.config)
def init_menu(self): menubar = self.menuBar() menubar.setNativeMenuBar(False) file_menu = menubar.addMenu(t("File")) setting_action = QAction( self.si(QtWidgets.QStyle.SP_FileDialogListView), t("Settings"), self) setting_action.setShortcut("Ctrl+S") setting_action.triggered.connect(self.show_setting) exit_action = QAction(self.si(QtWidgets.QStyle.SP_DialogCancelButton), t("Exit"), self) exit_action.setShortcut(QtGui.QKeySequence("Ctrl+Q")) exit_action.setStatusTip(t("Exit application")) exit_action.triggered.connect(self.close) file_menu.addAction(setting_action) file_menu.addSeparator() file_menu.addAction(exit_action) profile_menu = menubar.addMenu(t("Profiles")) new_profile_action = QAction(t("New Profile"), self) new_profile_action.triggered.connect(self.new_profile) show_profile_action = QAction(t("Current Profile Settings"), self) show_profile_action.triggered.connect(self.show_profile) delete_profile_action = QAction(t("Delete Current Profile"), self) delete_profile_action.triggered.connect(self.delete_profile) profile_menu.addAction(new_profile_action) profile_menu.addAction(show_profile_action) profile_menu.addAction(delete_profile_action) tools_menu = menubar.addMenu(t("Tools")) concat_action = QAction( QtGui.QIcon(get_icon("onyx-queue", self.app.fastflix.config.theme)), t("Concatenation Builder"), self) concat_action.triggered.connect(self.show_concat) tools_menu.addAction(concat_action) wiki_action = QAction(self.si(QtWidgets.QStyle.SP_FileDialogInfoView), t("FastFlix Wiki"), self) wiki_action.triggered.connect(self.show_wiki) about_action = QAction(self.si(QtWidgets.QStyle.SP_FileDialogInfoView), t("About"), self) about_action.triggered.connect(self.show_about) changes_action = QAction( self.si(QtWidgets.QStyle.SP_FileDialogDetailedView), t("View Changes"), self) changes_action.triggered.connect(self.show_changes) log_dir_action = QAction(self.si(QtWidgets.QStyle.SP_DialogOpenButton), t("Open Log Directory"), self) log_dir_action.triggered.connect(self.show_log_dir) log_action = QAction( self.si(QtWidgets.QStyle.SP_FileDialogDetailedView), t("View GUI Debug Logs"), self) log_action.triggered.connect(self.show_logs) report_action = QAction(self.si(QtWidgets.QStyle.SP_DialogHelpButton), t("Report Issue"), self) report_action.triggered.connect(self.open_issues) version_action = QAction(self.si(QtWidgets.QStyle.SP_BrowserReload), t("Check for Newer Version of FastFlix"), self) version_action.triggered.connect( lambda: latest_fastflix(no_new_dialog=True)) ffmpeg_update_action = QAction(self.si(QtWidgets.QStyle.SP_ArrowDown), t("Download Newest FFmpeg"), self) ffmpeg_update_action.triggered.connect(self.download_ffmpeg) clean_logs_action = QAction( self.si(QtWidgets.QStyle.SP_DialogResetButton), t("Clean Old Logs"), self) clean_logs_action.triggered.connect(self.clean_old_logs) help_menu = menubar.addMenu(t("Help")) help_menu.addAction(wiki_action) help_menu.addSeparator() help_menu.addAction(changes_action) help_menu.addAction(report_action) help_menu.addAction(log_dir_action) help_menu.addAction(log_action) help_menu.addAction(clean_logs_action) help_menu.addSeparator() help_menu.addAction(version_action) if reusables.win_based: help_menu.addAction(ffmpeg_update_action) help_menu.addSeparator() help_menu.addAction(about_action)
def resetTabIcons(self): for index, icon_name in icons.items(): self.setTabIcon( index, QtGui.QIcon(get_icon(icon_name, self.app.fastflix.config.theme)))
def __init__( self, parent, audio, index, codec, available_audio_encoders, title="", language="", profile="", outdex=None, enabled=True, original=False, first=False, last=False, codecs=(), channels=2, all_info=None, disable_dup=False, ): self.loading = True super(Audio, self).__init__(parent) self.parent = parent self.audio = audio self.setFixedHeight(60) self.original = original self.outdex = index if self.original else outdex self.first = first self.track_name = title self.profile = profile self.last = last self.index = index self.codec = codec self.codecs = codecs self.channels = channels self.available_audio_encoders = available_audio_encoders self.all_info = all_info self.widgets = Box( track_number=QtWidgets.QLabel( f"{index}:{self.outdex}" if enabled else "❌"), title=QtWidgets.QLineEdit(title), audio_info=QtWidgets.QLabel(audio), up_button=QtWidgets.QPushButton( QtGui.QIcon( get_icon("up-arrow", self.parent.app.fastflix.config.theme)), ""), down_button=QtWidgets.QPushButton( QtGui.QIcon( get_icon("down-arrow", self.parent.app.fastflix.config.theme)), ""), enable_check=QtWidgets.QCheckBox(t("Enabled")), dup_button=QtWidgets.QPushButton( QtGui.QIcon( get_icon("onyx-copy", self.parent.app.fastflix.config.theme)), ""), delete_button=QtWidgets.QPushButton( QtGui.QIcon( get_icon("black-x", self.parent.app.fastflix.config.theme)), ""), language=QtWidgets.QComboBox(), downmix=QtWidgets.QComboBox(), convert_to=None, convert_bitrate=None, ) self.widgets.up_button.setStyleSheet(no_border) self.widgets.down_button.setStyleSheet(no_border) self.widgets.dup_button.setStyleSheet(no_border) self.widgets.delete_button.setStyleSheet(no_border) if all_info: self.widgets.audio_info.setToolTip(all_info.to_yaml()) self.widgets.language.addItems(["No Language Set"] + language_list) self.widgets.language.setMaximumWidth(110) if language: try: lang = Lang(language).name except InvalidLanguageValue: pass else: if lang in language_list: self.widgets.language.setCurrentText(lang) self.widgets.language.currentIndexChanged.connect(self.page_update) self.widgets.title.setFixedWidth(150) self.widgets.title.textChanged.connect(self.page_update) self.widgets.audio_info.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.widgets.downmix.addItems( [t("No Downmix")] + [k for k, v in channel_list.items() if v <= channels]) self.widgets.downmix.currentIndexChanged.connect(self.update_downmix) self.widgets.downmix.setCurrentIndex(0) self.widgets.downmix.setDisabled(True) self.widgets.enable_check.setChecked(enabled) self.widgets.enable_check.toggled.connect(self.update_enable) self.widgets.dup_button.clicked.connect(lambda: self.dup_me()) self.widgets.dup_button.setFixedWidth(20) if disable_dup: self.widgets.dup_button.hide() self.widgets.dup_button.setDisabled(True) self.widgets.delete_button.clicked.connect(lambda: self.del_me()) self.widgets.delete_button.setFixedWidth(20) self.widgets.track_number.setFixedWidth(20) label = QtWidgets.QLabel(f"{t('Title')}: ") self.widgets.title.setFixedWidth(150) title_layout = QtWidgets.QHBoxLayout() title_layout.addWidget(label) title_layout.addWidget(self.widgets.title) grid = QtWidgets.QGridLayout() grid.addLayout(self.init_move_buttons(), 0, 0) grid.addWidget(self.widgets.track_number, 0, 1) grid.addWidget(self.widgets.audio_info, 0, 2) grid.addLayout(title_layout, 0, 3) # grid.addWidget(self.widgets.title, 0, 4) grid.addLayout(self.init_conversion(), 0, 5) grid.addWidget(self.widgets.downmix, 0, 6) grid.addWidget(self.widgets.language, 0, 7) right_button_start_index = 8 if not original: spacer = QtWidgets.QLabel() spacer.setFixedWidth(63) grid.addWidget(spacer, 0, right_button_start_index) grid.addWidget(self.widgets.delete_button, 0, right_button_start_index + 1) else: grid.addWidget(self.widgets.enable_check, 0, right_button_start_index) grid.addWidget(self.widgets.dup_button, 0, right_button_start_index + 1) self.setLayout(grid) self.loading = False
def __init__(self, parent, subtitle, index, enabled=True, first=False): self.loading = True super(Subtitle, self).__init__(parent) self.parent = parent self.index = index self.outdex = None self.subtitle = Box(subtitle, default_box=True) self.first = first self.last = False self.subtitle_lang = subtitle.get("tags", {}).get("language") self.subtitle_type = subtitle_types.get(subtitle["codec_name"], "text") self.setFixedHeight(60) self.widgets = Box( track_number=QtWidgets.QLabel( f"{self.index}:{self.outdex}" if enabled else "❌"), title=QtWidgets.QLabel(f" {self.subtitle.codec_long_name}"), up_button=QtWidgets.QPushButton( QtGui.QIcon( get_icon("up-arrow", self.parent.app.fastflix.config.theme)), ""), down_button=QtWidgets.QPushButton( QtGui.QIcon( get_icon("down-arrow", self.parent.app.fastflix.config.theme)), ""), enable_check=QtWidgets.QCheckBox(t("Preserve")), disposition=QtWidgets.QComboBox(), language=QtWidgets.QComboBox(), burn_in=QtWidgets.QCheckBox(t("Burn In")), ) self.widgets.up_button.setStyleSheet(no_border) self.widgets.down_button.setStyleSheet(no_border) self.widgets.disposition.addItems(dispositions) self.widgets.enable_check.setChecked(enabled) self.widgets.enable_check.toggled.connect(self.update_enable) self.widgets.burn_in.toggled.connect(self.update_burn_in) self.widgets.disposition.currentIndexChanged.connect(self.page_update) self.widgets.disposition.setCurrentIndex(0) for disposition, is_set in self.subtitle.disposition.items(): if is_set: try: self.widgets.disposition.setCurrentIndex( dispositions.index(disposition)) except ValueError: pass break self.setFixedHeight(60) self.widgets.title.setToolTip(self.subtitle.to_yaml()) self.widgets.burn_in.setToolTip( f"""{t("Overlay this subtitle track onto the video during conversion.")}\n {t("Please make sure seek method is set to exact")}.\n {t("Cannot remove afterwards!")} """) self.widgets.extract = QtWidgets.QPushButton(t("Extract")) self.widgets.extract.clicked.connect(self.extract) self.gif_label = QtWidgets.QLabel(self) self.movie = QtGui.QMovie(loading_movie) self.movie.setScaledSize(QtCore.QSize(25, 25)) self.gif_label.setMovie(self.movie) # self.movie.start() disposition_layout = QtWidgets.QHBoxLayout() disposition_layout.addWidget(QtWidgets.QLabel(t("Disposition"))) disposition_layout.addWidget(self.widgets.disposition) self.grid = QtWidgets.QGridLayout() self.grid.addLayout(self.init_move_buttons(), 0, 0) self.grid.addWidget(self.widgets.track_number, 0, 1) self.grid.addWidget(self.widgets.title, 0, 2) self.grid.setColumnStretch(2, True) if self.subtitle_type == "text": self.grid.addWidget(self.widgets.extract, 0, 3) self.grid.addWidget(self.gif_label, 0, 3) self.gif_label.hide() self.grid.addLayout(disposition_layout, 0, 4) self.grid.addWidget(self.widgets.burn_in, 0, 5) self.grid.addLayout(self.init_language(), 0, 6) self.grid.addWidget(self.widgets.enable_check, 0, 8) self.setLayout(self.grid) self.loading = False self.updating_burn = False self.extract_completed_signal.connect(self.extraction_complete)
def change_tab(self, index): if index == -1: return self.resetTabIcons() self.setTabIcon(index, QtGui.QIcon(get_icon(icons[index], "selected")))
def __init__(self, parent, app: FastFlixApp, available_audio_encoders): super().__init__(parent) self.main = parent self.app = app self.selected = 0 self.commands = CommandList(self, self.app) self.current_settings = self.main.current_encoder.settings_panel( self, self.main, self.app) self.tabBar().tabBarClicked.connect(self.change_tab) self.audio = AudioList(self, self.app) self.subtitles = SubtitleList(self, self.app) self.status = StatusPanel(self, self.app) self.attachments = CoverPanel(self, self.app) self.queue = EncodingQueue(self, self.app) self.advanced = AdvancedPanel(self, self.app) self.info = InfoPanel(self, self.app) self.debug = DebugPanel(self, self.app) if self.app.fastflix.config.theme == "onyx": self.setStyleSheet( "*{ background-color: #4b5054; color: white} QTabWidget{margin-top: 34px; background-color: #4b5054;} " "QTabBar{font-size: 13px; background-color: #4f5962}" "QComboBox{min-height: 1.1em;}") self.setIconSize(QtCore.QSize(24, 24)) self.addTab( self.current_settings, QtGui.QIcon(get_icon("onyx-quality", app.fastflix.config.theme)), t("Quality")) self.addTab( self.audio, QtGui.QIcon(get_icon("onyx-audio", app.fastflix.config.theme)), t("Audio")) self.addTab( self.subtitles, QtGui.QIcon(get_icon("onyx-cc", app.fastflix.config.theme)), t("Subtitles")) self.addTab( self.attachments, QtGui.QIcon(get_icon("onyx-cover", app.fastflix.config.theme)), t("Cover")) self.addTab( self.advanced, QtGui.QIcon(get_icon("onyx-advanced", app.fastflix.config.theme)), t("Advanced")) self.addTab( self.info, QtGui.QIcon( get_icon("onyx-source-details", app.fastflix.config.theme)), t("Source Details")) self.addTab( self.commands, QtGui.QIcon( get_icon("onyx-raw-commands", app.fastflix.config.theme)), t("Raw Commands")) self.addTab( self.status, QtGui.QIcon(get_icon("onyx-status", app.fastflix.config.theme)), t("Encoding Status")) self.addTab( self.queue, QtGui.QIcon(get_icon("onyx-queue", app.fastflix.config.theme)), t("Encoding Queue")) if DEVMODE: self.addTab( self.debug, QtGui.QIcon(get_icon("info", app.fastflix.config.theme)), "Debug")