def _setup_widgets(self):
        this_modules_file_path = os.path.dirname(os.path.abspath(__file__))
        rows_ui_file_path = os.path.join(this_modules_file_path,
                                         '../render_watch_data/rows_ui.glade')

        gtk_builder = Gtk.Builder()
        gtk_builder.add_from_file(rows_ui_file_path)

        self.subtitle_stream_row_box = gtk_builder.get_object(
            'subtitle_stream_row_box')
        self.subtitle_stream_combobox = gtk_builder.get_object(
            'subtitle_stream_combobox')
        self._build_stream_combobox()
        self.subtitle_stream_method_combobox = gtk_builder.get_object(
            'subtitle_stream_method_combobox')
        self.remove_subtitle_stream_button = gtk_builder.get_object(
            'remove_subtitle_stream_button')

        self.add(self.subtitle_stream_row_box)

        self.subtitle_stream_combobox.connect(
            'changed', self.changed_subtitle_stream_signal.
            on_subtitle_stream_combobox_changed)
        self.subtitle_stream_method_combobox.connect(
            'changed', self.change_stream_method_signal.
            on_subtitle_stream_method_combobox_changed)
        self.remove_subtitle_stream_button.connect(
            'clicked', self.remove_subtitle_stream_signal.
            on_remove_subtitle_stream_button_clicked)
Ejemplo n.º 2
0
    def _setup_widgets(self, application_preferences):
        this_modules_file_path = os.path.dirname(os.path.abspath(__file__))
        rows_ui_file_path = os.path.join(this_modules_file_path,
                                         '../render_watch_data/rows_ui.glade')

        gtk_builder = Gtk.Builder()
        gtk_builder.add_from_file(rows_ui_file_path)

        self.per_codec_listbox_row_box = gtk_builder.get_object(
            'per_codec_listbox_row_box')
        self.per_codec_label = gtk_builder.get_object('per_codec_label')
        self.per_codec_label.set_text('vp9')
        self.per_codec_subtext_label = gtk_builder.get_object(
            'per_codec_subtext_label')
        self.per_codec_subtext_label.set_text(
            'Number of tasks to run for the vp9 codec')
        self.per_codec_combobox = gtk_builder.get_object('per_codec_combobox')
        UIHelper.setup_combobox(self.per_codec_combobox,
                                ApplicationPreferences.PER_CODEC_TASKS_VALUES)
        self.per_codec_combobox.set_active(
            ApplicationPreferences.PER_CODEC_TASKS_VALUES.index(
                str(application_preferences.per_codec_parallel_tasks['vp9'])))

        self.add(self.per_codec_listbox_row_box)

        self.per_codec_combobox.connect(
            'changed', self.per_codec_parallel_tasks_signal.
            on_per_codec_vp9_combobox_changed)
Ejemplo n.º 3
0
 def _show_input_exists_dialog(self, ffmpeg):
     message_dialog = Gtk.MessageDialog(
         self.main_window_handlers.main_window,
         Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.MessageType.WARNING,
         Gtk.ButtonsType.OK,
         'File \"' + ffmpeg.input_file + '\" is already imported')
     message_dialog.run()
     message_dialog.destroy()
Ejemplo n.º 4
0
 def _show_codec_settings_not_supported_message(main_window):
     message_dialog = Gtk.MessageDialog(main_window,
                                        Gtk.DialogFlags.DESTROY_WITH_PARENT,
                                        Gtk.MessageType.WARNING,
                                        Gtk.ButtonsType.OK,
                                        'Current NVENC settings not supported on this system.')
     message_dialog.run()
     message_dialog.destroy()
Ejemplo n.º 5
0
 def _show_autocrop_not_needed_dialog(self):
     message_dialog = Gtk.MessageDialog(
         self.main_window_handlers.main_window,
         Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.MessageType.WARNING,
         Gtk.ButtonsType.OK, 'Auto crop not needed')
     message_dialog.format_secondary_text(
         'Could not detect any \"black bars\" within the video.')
     message_dialog.run()
     message_dialog.destroy()
Ejemplo n.º 6
0
 def _show_stop_all_tasks_message_dialog(self):
     message_dialog = Gtk.MessageDialog(
         self.main_window_handlers.main_window,
         Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.MessageType.WARNING,
         Gtk.ButtonsType.YES_NO, 'Stop all tasks?')
     message_dialog.format_secondary_text(
         'This will stop and remove all queued and running tasks')
     response = message_dialog.run()
     message_dialog.destroy()
     return response
Ejemplo n.º 7
0
 def _show_directory_not_accessible_dialog(self, temp_directory):
     message_dialog = Gtk.MessageDialog(
         self.main_window_handlers.main_window,
         Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.MessageType.WARNING,
         Gtk.ButtonsType.OK,
         'Directory \"' + temp_directory + '\" is not accessible')
     message_dialog.format_secondary_text(
         'Check permissions or select a different directory.')
     message_dialog.run()
     message_dialog.destroy()
Ejemplo n.º 8
0
 def _show_clear_temp_files_warning_dialog(self):
     message_dialog = Gtk.MessageDialog(
         self.main_window_handlers.main_window,
         Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.MessageType.WARNING,
         Gtk.ButtonsType.OK, 'Possible Data Loss')
     message_dialog.format_secondary_text(
         'This option deletes all files in the chosen temporary folder when the '
         'application is closed.')
     message_dialog.run()
     message_dialog.destroy()
Ejemplo n.º 9
0
    def _active_list_update_header_func(active_page_listbox_row, previous_active_page_listbox_row, data=None):
        if previous_active_page_listbox_row is None:
            active_page_listbox_row.set_header(None)
        else:
            active_page_listbox_row_header = active_page_listbox_row.get_header()

            if active_page_listbox_row_header is None:
                active_page_listbox_row_header = Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL)
                active_page_listbox_row_header.show()

                active_page_listbox_row.set_header(active_page_listbox_row_header)
Ejemplo n.º 10
0
    def _show_directory_not_empty_message_dialog(self, temp_directory):
        message_dialog = Gtk.MessageDialog(
            self.main_window_handlers.main_window,
            Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.MessageType.WARNING,
            Gtk.ButtonsType.YES_NO,
            'Directory \"' + temp_directory + '\" is not empty')
        message_dialog.format_secondary_text('Use chosen directory?')
        response = message_dialog.run()
        message_dialog.destroy()

        return response
Ejemplo n.º 11
0
    def _setup_widgets(self, gtk_builder):
        this_modules_file_path = os.path.dirname(os.path.abspath(__file__))
        rows_ui_file_path = os.path.join(this_modules_file_path, '../render_watch_data/rows_ui.glade')

        self.options_rows_gtk_builder = Gtk.Builder()
        self.options_rows_gtk_builder.add_from_file(rows_ui_file_path)

        self.subtitle_settings_stack = gtk_builder.get_object('subtitle_settings_stack')
        self.subtitle_settings_box = gtk_builder.get_object('subtitle_settings_box')
        self.subtitle_settings_not_available_label = gtk_builder.get_object('subtitle_settings_not_available_label')
        self.subtitle_streams_list = gtk_builder.get_object('subtitle_streams_list')
Ejemplo n.º 12
0
    def _create_and_show_folder_chooser(self):
        file_chooser = Gtk.FileChooserDialog(
            'Choose a folder', self.main_window_handlers.main_window,
            Gtk.FileChooserAction.SELECT_FOLDER,
            (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN,
             Gtk.ResponseType.OK))
        file_chooser.set_select_multiple(True)
        file_chooser_response = file_chooser.run()

        selected_folders = file_chooser.get_filenames()

        file_chooser.destroy()

        return file_chooser_response, selected_folders
Ejemplo n.º 13
0
    def _setup_widgets(self):
        this_modules_file_path = os.path.dirname(os.path.abspath(__file__))
        chunk_ui_file_path = os.path.join(this_modules_file_path, '../render_watch_data/chunk_ui.glade')

        gtk_builder = Gtk.Builder()
        gtk_builder.add_from_file(chunk_ui_file_path)

        self.chunk_listbox_row_box = gtk_builder.get_object('chunk_listbox_row_box')
        self.chunk_identifier_label = gtk_builder.get_object('chunk_identifier_label')
        self.chunk_time_span_label = gtk_builder.get_object('chunk_time_span_label')
        self.chunk_progressbar = gtk_builder.get_object('chunk_progressbar')

        self._setup_chunk_row()
        self.add(self.chunk_listbox_row_box)
Ejemplo n.º 14
0
    def _show_directory_not_accessible_dialog(self, output_directory,
                                              file_chooser_button):
        message_dialog = Gtk.MessageDialog(
            self.main_window_handlers.main_window,
            Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.MessageType.WARNING,
            Gtk.ButtonsType.OK,
            'Directory \"' + output_directory + '\" is not accessable')
        message_dialog.format_secondary_text(
            'Check permissions or select a different directory.')
        message_dialog.run()
        message_dialog.destroy()

        file_chooser_button.set_filename(
            self.application_preferences.output_directory)
Ejemplo n.º 15
0
    def _options_list_update_header_func(inputs_page_listbox_row,
                                         previous_inputs_page_listbox_row,
                                         data=None):
        if previous_inputs_page_listbox_row is None:
            inputs_page_listbox_row.set_header(None)
        else:
            inputs_page_listbox_row_header = inputs_page_listbox_row.get_header(
            )

            if inputs_page_listbox_row_header is None:
                inputs_page_listbox_row_header = Gtk.Separator(
                    orientation=Gtk.Orientation.HORIZONTAL)
                inputs_page_listbox_row_header.show()
                inputs_page_listbox_row.set_header(
                    inputs_page_listbox_row_header)
Ejemplo n.º 16
0
    def _completed_list_update_header(completed_page_listbox_row,
                                      previous_completed_page_listbox_row,
                                      data):
        if previous_completed_page_listbox_row is None:
            completed_page_listbox_row.set_header(None)
        else:
            completed_page_listbox_row_header = completed_page_listbox_row.get_header(
            )

            if completed_page_listbox_row_header is None:
                completed_page_listbox_row_header = Gtk.Separator(
                    orientation=Gtk.Orientation.HORIZONTAL)
                completed_page_listbox_row_header.show()

                completed_page_listbox_row.set_header(
                    completed_page_listbox_row_header)
Ejemplo n.º 17
0
    def on_remove_all_button_clicked(self, remove_all_button):  # Unused parameters needed for this signal
        """
        On user confirmation, removes all inputs from the inputs page.

        :param remove_all_button: Button that emitted the signal.
        """
        message_dialog = Gtk.MessageDialog(self.main_window_handlers.main_window,
                                           Gtk.DialogFlags.DESTROY_WITH_PARENT,
                                           Gtk.MessageType.WARNING,
                                           Gtk.ButtonsType.YES_NO,
                                           'Remove all inputs?')
        message_dialog.format_secondary_text('This will remove all of your imports along with any settings applied')

        response = message_dialog.run()
        if response == Gtk.ResponseType.YES:
            self.inputs_page_handlers.remove_all_rows()

        message_dialog.destroy()

        self.main_window_handlers.popdown_app_preferences_popover()
Ejemplo n.º 18
0
    def setup_and_run(self):
        """
        Loads all widgets for the application's UI using Gtk.Builder and runs Gtk.main().
        """
        self._setup_preferences_dialog_widgets()
        self._setup_general_settings_widgets()
        self._setup_x264_widgets()
        self._setup_x265_widgets()
        self._setup_nvenc_widgets()
        self._setup_vp9_widgets()
        self._setup_aac_widgets()
        self._setup_opus_widgets()
        self._setup_inputs_page_widgets()
        self._setup_active_page_widgets()
        self._setup_main_window_widgets()

        self.gtk_builder.connect_signals(HandlersManager(self.gtk_builder,
                                                         self.gtk_settings,
                                                         self.encoder_queue,
                                                         self.application_preferences))

        return Gtk.main()
Ejemplo n.º 19
0
    def _setup_widgets(self):
        this_modules_file_path = os.path.dirname(os.path.abspath(__file__))
        rows_ui_file_path = os.path.join(this_modules_file_path,
                                         '../render_watch_data/rows_ui.glade')

        self.gtk_builder = Gtk.Builder()
        self.gtk_builder.add_from_file(rows_ui_file_path)

        self.inputs_listbox_row_box = self.gtk_builder.get_object(
            'inputs_listbox_row_box')
        self.inputs_listbox_row_preview_icon = self.gtk_builder.get_object(
            'inputs_listbox_row_preview_icon')
        self.inputs_listbox_row_start_button = self.gtk_builder.get_object(
            'inputs_listbox_row_start_button')
        self.inputs_listbox_row_task_info_button = self.gtk_builder.get_object(
            'inputs_listbox_row_task_info_button')
        self.inputs_listbox_row_file_name_label = self.gtk_builder.get_object(
            'inputs_listbox_row_file_name_label')
        self.inputs_listbox_row_remove_button = self.gtk_builder.get_object(
            'inputs_listbox_row_remove_button')
        self.inputs_listbox_row_video_codec_value_label = self.gtk_builder.get_object(
            'inputs_listbox_row_video_codec_value_label')
        self.inputs_listbox_row_audio_codec_value_label = self.gtk_builder.get_object(
            'inputs_listbox_row_audio_codec_value_label')
        self.inputs_listbox_row_resolution_value_label = self.gtk_builder.get_object(
            'inputs_listbox_row_resolution_value_label')
        self.inputs_listbox_row_duration_value_label = self.gtk_builder.get_object(
            'inputs_listbox_row_duration_value_label')
        self.streams_stack = self.gtk_builder.get_object('streams_stack')
        self.folder_type_buttonbox = self.gtk_builder.get_object(
            'folder_type_buttonbox')
        self.standard_folder_task_radiobutton = self.gtk_builder.get_object(
            'standard_folder_task_radiobutton')
        self.recursive_folder_task_radiobutton = self.gtk_builder.get_object(
            'recursive_folder_task_radiobutton')
        self.watch_folder_task_radiobutton = self.gtk_builder.get_object(
            'watch_folder_task_radiobutton')
        self.video_stream_combobox = self.gtk_builder.get_object(
            'video_stream_combobox')
        self.audio_stream_combobox = self.gtk_builder.get_object(
            'audio_stream_combobox')
        self.ffmpeg_parameters_value_label = self.gtk_builder.get_object(
            'ffmpeg_parameters_value_label')
        self.input_info_video_codec_label = self.gtk_builder.get_object(
            'input_info_video_codec_label')
        self.input_info_audio_codec_label = self.gtk_builder.get_object(
            'input_info_audio_codec_label')
        self.input_info_container_label = self.gtk_builder.get_object(
            'input_info_container_label')
        self.input_info_resolution_label = self.gtk_builder.get_object(
            'input_info_resolution_label')
        self.input_info_duration_label = self.gtk_builder.get_object(
            'input_info_duration_label')
        self.input_info_frame_rate_label = self.gtk_builder.get_object(
            'input_info_frame_rate_label')
        self.input_info_channels_label = self.gtk_builder.get_object(
            'input_info_channels_label')
        self.input_info_file_size_label = self.gtk_builder.get_object(
            'input_info_file_size_label')
        self.output_info_video_codec_label = self.gtk_builder.get_object(
            'output_info_video_codec_label')
        self.output_info_audio_codec_label = self.gtk_builder.get_object(
            'output_info_audio_codec_label')
        self.output_info_container_label = self.gtk_builder.get_object(
            'output_info_container_label')
        self.output_info_resolution_label = self.gtk_builder.get_object(
            'output_info_resolution_label')
        self.output_info_duration_label = self.gtk_builder.get_object(
            'output_info_duration_label')
        self.output_info_frame_rate_label = self.gtk_builder.get_object(
            'output_info_frame_rate_label')
        self.output_info_channels_label = self.gtk_builder.get_object(
            'output_info_channels_label')

        self._setup_row_state()
        self._setup_streams()
        self.setup_labels()
        self.add(self.inputs_listbox_row_box)

        self.inputs_listbox_row_remove_button.connect(
            'clicked',
            self.remove_task_signal.on_remove_input_task_button_clicked)
        self.inputs_listbox_row_start_button.connect(
            'clicked', self.start_signal.on_start_button_clicked)
        self.video_stream_combobox.connect(
            'changed',
            self.video_stream_signal.on_video_stream_combobox_changed)
        self.audio_stream_combobox.connect(
            'changed',
            self.audio_stream_signal.on_audio_stream_combobox_changed)
        self.recursive_folder_task_radiobutton.connect(
            'toggled', self.recursive_folder_task_signal.
            on_recursive_folder_task_radiobutton_toggled)
        self.watch_folder_task_radiobutton.connect(
            'toggled', self.watch_folder_task_signal.
            on_watch_folder_task_radiobutton_toggled)
Ejemplo n.º 20
0
 def _on_main_window_destroy(self, application_window):
     self._save_application_preferences(application_window)
     self.encoder_queue.kill()
     Gtk.main_quit()
Ejemplo n.º 21
0
    def _setup_gtk_builder(self):
        working_directory = os.path.dirname(os.path.abspath(__file__))
        glade_file_path = os.path.join(working_directory, '../render_watch_data/rw_ui.glade')

        self.gtk_builder = Gtk.Builder()
        self.gtk_builder.add_from_file(glade_file_path)
Ejemplo n.º 22
0
    def _setup_widgets(self, gtk_builder, gtk_settings, main_window_handlers,
                       application_preferences):
        this_modules_file_path = os.path.dirname(os.path.abspath(__file__))
        rows_ui_file_path = os.path.join(this_modules_file_path,
                                         '../render_watch_data/rows_ui.glade')

        options_rows_gtk_builder = Gtk.Builder()
        options_rows_gtk_builder.add_from_file(rows_ui_file_path)

        self.temporary_files_list = gtk_builder.get_object(
            'temporary_files_list')
        self.temporary_files_restart_stack = options_rows_gtk_builder.get_object(
            'temporary_files_restart_stack')
        self.temporary_files_restart_blank_label = options_rows_gtk_builder.get_object(
            'temporary_files_restart_blank_label')
        self.temporary_files_restart_icon = options_rows_gtk_builder.get_object(
            'temporary_files_restart_icon')
        self.misc_preferences_list = gtk_builder.get_object(
            'misc_preferences_list')
        self.parallel_tasks_stack = gtk_builder.get_object(
            'parallel_tasks_stack')
        self.concurrent_tasks_frame = gtk_builder.get_object(
            'concurrent_tasks_frame')
        self.concurrent_tasks_list = gtk_builder.get_object(
            'concurrent_tasks_list')
        self.concurrent_tasks_combobox = options_rows_gtk_builder.get_object(
            'concurrent_tasks_combobox')
        self.concurrent_tasks_restart_stack = options_rows_gtk_builder.get_object(
            'concurrent_tasks_restart_stack')
        self.concurrent_tasks_restart_blank_label = options_rows_gtk_builder.get_object(
            'concurrent_tasks_restart_blank_label')
        self.concurrent_tasks_restart_icon = options_rows_gtk_builder.get_object(
            'concurrent_tasks_restart_icon')
        self.concurrent_tasks_message_stack = options_rows_gtk_builder.get_object(
            'concurrent_tasks_message_stack')
        self.concurrent_tasks_message_8 = options_rows_gtk_builder.get_object(
            'concurrent_tasks_message_8')
        self.concurrent_tasks_message_12 = options_rows_gtk_builder.get_object(
            'concurrent_tasks_message_12')
        self.concurrent_tasks_message_24 = options_rows_gtk_builder.get_object(
            'concurrent_tasks_message_24')
        self.concurrent_tasks_message_32 = options_rows_gtk_builder.get_object(
            'concurrent_tasks_message_32')
        self.concurrent_tasks_message_max = options_rows_gtk_builder.get_object(
            'concurrent_tasks_message_max')
        self.per_codec_warning_stack = gtk_builder.get_object(
            'per_codec_warning_stack')
        self.per_codec_restart_blank_label = gtk_builder.get_object(
            'per_codec_restart_blank_label')
        self.per_codec_restart_icon = gtk_builder.get_object(
            'per_codec_restart_icon')
        self.per_codec_switch = gtk_builder.get_object('per_codec_switch')
        self.per_codec_list = gtk_builder.get_object('per_codec_list')
        self.per_codec_frame = gtk_builder.get_object('per_codec_frame')
        self.parallel_nvenc_tasks_list = gtk_builder.get_object(
            'parallel_nvenc_tasks_list')
        self.concurrent_nvenc_tasks_warning_stack = options_rows_gtk_builder.get_object(
            'concurrent_nvenc_tasks_warning_stack')
        self.concurrent_nvenc_tasks_warning_blank_label = options_rows_gtk_builder.get_object(
            'concurrent_nvenc_tasks_warning_blank_label')
        self.concurrent_nvenc_tasks_warning_icon = options_rows_gtk_builder.get_object(
            'concurrent_nvenc_tasks_warning_icon')
        self.encoder_outputs_list = gtk_builder.get_object(
            'encoder_outputs_list')
        self.queue_list = gtk_builder.get_object('queue_list')
        self.watch_folder_outputs_list = gtk_builder.get_object(
            'watch_folder_outputs_list')

        self.temporary_files_list.set_header_func(
            self._options_list_update_header_func, None)
        self.misc_preferences_list.set_header_func(
            self._options_list_update_header_func, None)
        self.concurrent_tasks_list.set_header_func(
            self._options_list_update_header_func, None)
        self.per_codec_list.set_header_func(
            self._options_list_update_header_func, None)
        self.parallel_nvenc_tasks_list.set_header_func(
            self._options_list_update_header_func, None)
        self.encoder_outputs_list.set_header_func(
            self._options_list_update_header_func, None)
        self.queue_list.set_header_func(self._options_list_update_header_func,
                                        None)
        self.watch_folder_outputs_list.set_header_func(
            self._options_list_update_header_func, None)

        self._add_general_page_options_rows(options_rows_gtk_builder,
                                            gtk_settings, main_window_handlers,
                                            application_preferences)
        self._add_encoder_page_options_rows(options_rows_gtk_builder,
                                            application_preferences)
        self._add_watch_folder_page_options_rows(options_rows_gtk_builder,
                                                 application_preferences)