def _show_clip_info(data): clip, track, item_id, x = data width = clip.get("width") height = clip.get("height") if clip.media_type == appconsts.IMAGE: graphic_img = Image.open(clip.path) width, height = graphic_img.size size = str(width) + " x " + str(height) l_frames = clip.clip_out - clip.clip_in + 1 # +1 out inclusive length = utils.get_tc_string(l_frames) mark_in = utils.get_tc_string(clip.clip_in) mark_out = utils.get_tc_string(clip.clip_out + 1) # +1 out inclusive video_index = clip.get_int("video_index") audio_index = clip.get_int("audio_index") long_video_property = "meta.media." + str(video_index) + ".codec.long_name" long_audio_property = "meta.media." + str(audio_index) + ".codec.long_name" vcodec = clip.get(str(long_video_property)) acodec = clip.get(str(long_audio_property)) if vcodec == None: vcodec = _("N/A") if acodec == None: acodec = _("N/A") dialogs.clip_properties_dialog((mark_in, mark_out, length, size, clip.path, vcodec, acodec))
def _show_clip_info(data): clip, track, item_id, x = data width = clip.get("width") height = clip.get("height") if clip.media_type == appconsts.IMAGE: graphic_img = Image.open(clip.path) width, height = graphic_img.size size = str(width) + " x " + str(height) l_frames = clip.clip_out - clip.clip_in + 1 # +1 out inclusive length = utils.get_tc_string(l_frames) mark_in = utils.get_tc_string(clip.clip_in) mark_out = utils.get_tc_string(clip.clip_out + 1) # +1 out inclusive video_index = clip.get_int("video_index") audio_index = clip.get_int("audio_index") long_video_property = "meta.media." + str(video_index) + ".codec.long_name" long_audio_property = "meta.media." + str(audio_index) + ".codec.long_name" vcodec = clip.get(str(long_video_property)) acodec = clip.get(str(long_audio_property)) if vcodec == None: vcodec = _("N/A") if acodec == None: acodec = _("N/A") dialogs.clip_properties_dialog( (mark_in, mark_out, length, size, clip.path, vcodec, acodec))
def display_monitor_clip_name():#we're displaying length and range length also tc_info = utils.get_tc_string(gui.pos_bar.producer.get_length()) if MONITOR_MEDIA_FILE().mark_in != -1 and MONITOR_MEDIA_FILE().mark_out != -1: clip_length = utils.get_tc_string(MONITOR_MEDIA_FILE().mark_out - MONITOR_MEDIA_FILE().mark_in + 1) #+1 out incl. tc_info = tc_info + " ][ " + str(clip_length) else: tc_info = tc_info + " ][ --:--:--:--" gui.editor_window.monitor_source.set_text(MONITOR_MEDIA_FILE().name) gui.editor_window.info1.set_text(tc_info)
def _display_file_info(media_file): # get info clip = current_sequence().create_file_producer_clip(media_file.path) info = utils.get_file_producer_info(clip) width = info["width"] height = info["height"] size = str(width) + " x " + str(height) length = utils.get_tc_string(info["length"]) try: img = guiutils.get_gtk_image_from_file(media_file.icon_path, 300) except: print "_display_file_info() failed to get thumbnail" vcodec = info["vcodec"] acodec = info["acodec"] channels = str(info["channels"]) frequency = str(info["frequency"]) + "Hz" try: num = info["fps_num"] den = info["fps_den"] fps = float(num / den) except: fps = "N/A" dialogs.file_properties_dialog((media_file, img, size, length, vcodec, acodec, channels, frequency, fps))
def _display_file_info(media_file): # get info clip = current_sequence().create_file_producer_clip(media_file.path) info = utils.get_file_producer_info(clip) width = info["width"] height = info["height"] size = str(width) + " x " + str(height) length = utils.get_tc_string(info["length"]) try: img = guiutils.get_gtk_image_from_file(media_file.icon_path, 300) except: print "_display_file_info() failed to get thumbnail" vcodec = info["vcodec"] acodec = info["acodec"] channels = str(info["channels"]) frequency = str(info["frequency"]) + "Hz" try: num = info["fps_num"] den = info["fps_den"] fps = float(num/den) except: fps ="N/A" dialogs.file_properties_dialog((media_file, img, size, length, vcodec, acodec, channels, frequency, fps))
def _draw_bottom_panel(self, event, cr, allocation): x, y, w, h = allocation # Draw bg cr.set_source_rgb(0.0, 0.0, 0.0) if self.view == FRAME_MATCH_VIEW: cr.set_source_rgb(*FRAME_MATCH_VIEW_COLOR) cr.rectangle(0, 0, w, h) cr.fill() # if were minimized, stop if w == 1: return if self.view == START_TRIM_VIEW or self.view == END_TRIM_VIEW: self._draw_bottom_panel_one_roll(event, cr, allocation) elif self.view == ROLL_TRIM_RIGHT_ACTIVE_VIEW or self.view == ROLL_TRIM_LEFT_ACTIVE_VIEW: self._draw_bottom_panel_two_roll(event, cr, allocation) elif self.view == SLIP_TRIM_RIGHT_ACTIVE_VIEW or self.view == SLIP_TRIM_LEFT_ACTIVE_VIEW: self._draw_bottom_panel_slip(event, cr, allocation) elif self.view == FRAME_MATCH_VIEW: cr.set_source_rgb(*MONITOR_INDICATOR_COLOR) cr.select_font_face ("monospace", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_BOLD) cr.set_font_size(21) cr.move_to(5, 35) cr.show_text(utils.get_tc_string(self.match_frame))
def _display_file_info(media_file): clip = current_sequence().create_file_producer_clip(media_file.path) width = clip.get("width") height = clip.get("height") size = str(width) + " x " + str(height) length = utils.get_tc_string(clip.get_length()) try: img = guiutils.get_gtk_image_from_file(media_file.icon_path, 300) except: print "_display_file_info() failed to get thumbnail" video_index = clip.get_int("video_index") audio_index = clip.get_int("audio_index") long_video_property = "meta.media." + str(video_index) + ".codec.long_name" long_audio_property = "meta.media." + str(audio_index) + ".codec.long_name" sample_rate_property = "meta.media." + str(audio_index) + ".codec.sample_rate" channels_property = "meta.media." + str(audio_index) + ".codec.channels" vcodec = clip.get(str(long_video_property)) acodec = clip.get(str(long_audio_property)) channels = str(clip.get_int(str(channels_property))) frequency = str(clip.get_int(str(sample_rate_property))) + "Hz" try: num = float(clip.get("meta.media.frame_rate_num")) # from producer_avformat.c den = float(clip.get("meta.media.frame_rate_den")) # from producer_avformat.c fps = str(num/den) except: fps ="N/A" dialogs.file_properties_dialog((media_file, img, size, length, vcodec, acodec, channels, frequency, fps))
def display_monitor_clip_name():#we're displaying length and range length also clip_len = utils.get_tc_string(gui.pos_bar.producer.get_length()) range_info = _get_marks_range_info(MONITOR_MEDIA_FILE().mark_in, MONITOR_MEDIA_FILE().mark_out) gui.editor_window.monitor_tc_info.set_source_name(MONITOR_MEDIA_FILE().name + " - ") gui.editor_window.monitor_tc_info.set_source_tc(clip_len) gui.editor_window.monitor_tc_info.set_range_info(*range_info)
def display_monitor_clip_name(): # Display clip name if MONITOR_MEDIA_FILE().mark_in != -1 and MONITOR_MEDIA_FILE().mark_out != -1: clip_length = utils.get_tc_string(MONITOR_MEDIA_FILE().mark_out - MONITOR_MEDIA_FILE().mark_in + 1) #+1 out incl. range_text = " / ][ " + str(clip_length) else: range_text = "" gui.editor_window.monitor_source.set_text(MONITOR_MEDIA_FILE().name + range_text)
def _display_file_info(media_file): # get info clip = current_sequence().create_file_producer_clip(media_file.path) info = utils.get_file_producer_info(clip) width = info["width"] height = info["height"] if media_file.type == appconsts.IMAGE: graphic_img = Image.open(media_file.path) width, height = graphic_img.size size = str(width) + " x " + str(height) length = utils.get_tc_string(info["length"]) try: img = guiutils.get_gtk_image_from_file(media_file.icon_path, 300) except: print "_display_file_info() failed to get thumbnail" vcodec = info["vcodec"] acodec = info["acodec"] if vcodec == None: vcodec = _("N/A") if acodec == None: acodec = _("N/A") channels = str(info["channels"]) frequency = str(info["frequency"]) + "Hz" if media_file.type == appconsts.VIDEO: match_profile_index = mltprofiles.get_closest_matching_profile_index( info) match_profile_name = mltprofiles.get_profile_name_for_index( match_profile_index) else: match_profile_name = _("N/A") if media_file.type == appconsts.VIDEO: if media_file.matches_project_profile(): matches_project_profile = _("Yes") else: matches_project_profile = _("No") else: matches_project_profile = _("N/A") try: num = info["fps_num"] den = info["fps_den"] fps = float(num / den) except: fps = _("N/A") dialogs.file_properties_dialog( (media_file, img, size, length, vcodec, acodec, channels, frequency, fps, match_profile_name, matches_project_profile))
def update_seqence_info_text(): name = editorstate.current_sequence().name prog_len = PLAYER().producer.get_length() if prog_len < 2: # # to 'fix' the single frame black frame at start, will bug for actual 1 frame sequences prog_len = 0 tc_info = utils.get_tc_string(prog_len) gui.editor_window.monitor_source.set_text(name + " - " + tc_info) range_info = _get_marks_range_info_text(PLAYER().producer.mark_in, PLAYER().producer.mark_out) gui.editor_window.info1.set_text(range_info)
def _get_marks_range_info(mark_in, mark_out): if mark_in != -1: mark_in_info = utils.get_tc_string(mark_in) else: mark_in_info = "--:--:--:--" if mark_out != -1: mark_out_info = utils.get_tc_string(mark_out) else: mark_out_info = "--:--:--:--" range_len = mark_out - mark_in + 1 # +1, out incl. if mark_in != -1 and mark_out != -1: range_info = utils.get_tc_string(range_len) else: range_info = "--:--:--:--" return (mark_in_info, mark_out_info, range_info)
def _show_clip_info(data): clip, track, item_id, x = data width = clip.get("width") height = clip.get("height") size = str(width) + " x " + str(height) l_frames = clip.clip_out - clip.clip_in + 1 # +1 out inclusive length = utils.get_tc_string(l_frames) mark_in = utils.get_tc_string(clip.clip_in) mark_out = utils.get_tc_string(clip.clip_out + 1) # +1 out inclusive video_index = clip.get_int("video_index") audio_index = clip.get_int("audio_index") long_video_property = "meta.media." + str(video_index) + ".codec.long_name" long_audio_property = "meta.media." + str(audio_index) + ".codec.long_name" vcodec = clip.get(str(long_video_property)) acodec = clip.get(str(long_audio_property)) dialogs.clip_properties_dialog((mark_in, mark_out, length, size, clip.path, vcodec, acodec))
def _show_clip_info(data): clip, track, item_id, x = data width = clip.get("width") height = clip.get("height") size = str(width) + " x " + str(height) l_frames = clip.clip_out - clip.clip_in + 1 # +1 out inclusive length = utils.get_tc_string(l_frames) mark_in = utils.get_tc_string(clip.clip_in) mark_out = utils.get_tc_string(clip.clip_out + 1) # +1 out inclusive video_index = clip.get_int("video_index") audio_index = clip.get_int("audio_index") long_video_property = "meta.media." + str(video_index) + ".codec.long_name" long_audio_property = "meta.media." + str(audio_index) + ".codec.long_name" vcodec = clip.get(str(long_video_property)) acodec = clip.get(str(long_audio_property)) dialogs.clip_properties_dialog( (mark_in, mark_out, length, size, clip.path, vcodec, acodec))
def _add_clip_marker(data): clip, track, item_id, item_data = data current_frame = PLAYER().current_frame() playhead_on_popup_clip = True try: current_frame_clip_index = track.get_clip_index_at(current_frame) current_frame_clip = track.clips[current_frame_clip_index] except: current_frame_clip = None if current_frame_clip != clip: # Playhead is not on popup clip return clip_start_in_tline = track.clip_start(current_frame_clip_index) clip_frame = current_frame - clip_start_in_tline + clip.clip_in dialogs.clip_marker_name_dialog(utils.get_tc_string(clip_frame), utils.get_tc_string(current_frame), _clip_marker_add_dialog_callback, (clip, track, clip_frame))
def update_seqence_info_text(): name = editorstate.current_sequence().name profile_desc = editorstate.current_sequence().profile.description() if editorpersistance.prefs.show_sequence_profile: gui.editor_window.monitor_source.set_text(name + " - " + profile_desc) else: gui.editor_window.monitor_source.set_text(name) prog_len = PLAYER().producer.get_length() if prog_len < 2: # # to 'fix' the single frame black frame at start, will bug for actual 1 frame sequences prog_len = 0 range_len = PLAYER().producer.mark_out - PLAYER().producer.mark_in + 1 # +1, out incl. tc_info = utils.get_tc_string(prog_len) if PLAYER().producer.mark_in != -1 and PLAYER().producer.mark_out != -1: tc_info = tc_info + " ][ " + utils.get_tc_string(range_len) else: tc_info = tc_info + " ][ --:--:--:--" gui.editor_window.info1.set_text(tc_info)
def _get_marks_range_info_text(mark_in, mark_out): if editorstate.screen_size_small_width() == False: if mark_in != -1: range_info = "] " + utils.get_tc_string(mark_in) else: range_info = "] --:--:--:--" if mark_out != -1: range_info = range_info + " [ " + utils.get_tc_string(mark_out) + " " else: range_info = range_info + " [ --:--:--:--" + " " else: range_info = "" range_len = mark_out - mark_in + 1 # +1, out incl. if mark_in != -1 and mark_out != -1: range_info = range_info + "][ " + utils.get_tc_string(range_len) else: range_info = range_info + "][ --:--:--:--" return range_info
def _display_file_info(media_file): # get info clip = current_sequence().create_file_producer_clip(media_file.path) info = utils.get_file_producer_info(clip) width = info["width"] height = info["height"] if media_file.type == appconsts.IMAGE: graphic_img = Image.open(media_file.path) width, height = graphic_img.size size = str(width) + " x " + str(height) length = utils.get_tc_string(info["length"]) try: img = guiutils.get_gtk_image_from_file(media_file.icon_path, 300) except: print "_display_file_info() failed to get thumbnail" vcodec = info["vcodec"] acodec = info["acodec"] if vcodec == None: vcodec = _("N/A") if acodec == None: acodec = _("N/A") channels = str(info["channels"]) frequency = str(info["frequency"]) + "Hz" if media_file.type == appconsts.VIDEO: match_profile_index = mltprofiles.get_closest_matching_profile_index(info) match_profile_name = mltprofiles.get_profile_name_for_index(match_profile_index) else: match_profile_name = _("N/A") if media_file.type == appconsts.VIDEO: if media_file.matches_project_profile(): matches_project_profile = _("Yes") else: matches_project_profile = _("No") else: matches_project_profile = _("N/A") try: num = info["fps_num"] den = info["fps_den"] fps = float(num/den) except: fps = _("N/A") dialogs.file_properties_dialog((media_file, img, size, length, vcodec, acodec, channels, frequency, fps, match_profile_name, matches_project_profile))
def display_monitor_clip_name(): # Display clip name if MONITOR_MEDIA_FILE().mark_in != -1 and MONITOR_MEDIA_FILE( ).mark_out != -1: clip_length = utils.get_tc_string(MONITOR_MEDIA_FILE().mark_out - MONITOR_MEDIA_FILE().mark_in + 1) #+1 out incl. range_text = " / ][ " + str(clip_length) else: range_text = "" gui.editor_window.monitor_source.set_text(MONITOR_MEDIA_FILE().name + range_text)
def _marker_menu_item_activated(widget, msg): current_frame = PLAYER().current_frame() if msg == "add": dialogs.marker_name_dialog(utils.get_tc_string(current_frame), _marker_add_dialog_callback) elif msg == "delete": mrk_index = -1 for i in range(0, len(current_sequence().markers)): name, frame = current_sequence().markers[i] if frame == current_frame: mrk_index = i if mrk_index != -1: current_sequence().markers.pop(mrk_index) updater.repaint_tline() elif msg == "deleteall": current_sequence().markers = [] updater.repaint_tline() else: # seek to marker name, frame = current_sequence().markers[int(msg)] PLAYER().seek_frame(frame)
def update_seqence_info_text(): name = editorstate.current_sequence().name prog_len = PLAYER().producer.get_length() if prog_len < 2: # # to 'fix' the single frame black frame at start, will bug for actual 1 frame sequences prog_len = 0 tc_info = utils.get_tc_string(prog_len) """ profile_desc = editorstate.current_sequence().profile.description() if editorpersistance.prefs.show_sequence_profile: gui.editor_window.monitor_source.set_text(name + " - " + profile_desc + " - " + tc_info) else: gui.editor_window.monitor_source.set_text(name + " - " + tc_info) """ gui.editor_window.monitor_source.set_text(name + " - " + tc_info) range_info = _get_marks_range_info_text(PLAYER().producer.mark_in, PLAYER().producer.mark_out) gui.editor_window.info1.set_text(range_info)
def display_monitor_clip_name():#we're displaying length and range length also clip_len = utils.get_tc_string(gui.pos_bar.producer.get_length()) range_info = _get_marks_range_info_text(MONITOR_MEDIA_FILE().mark_in, MONITOR_MEDIA_FILE().mark_out) gui.editor_window.monitor_source.set_text(MONITOR_MEDIA_FILE().name + " - " + clip_len) gui.editor_window.info1.set_text(range_info)
def frames_to_tc(self, frame): if self.use_drop_frames == True: return self.frames_to_DF(frame) else: return utils.get_tc_string(frame)
def add_marker(): current_frame = PLAYER().current_frame() dialogs.marker_name_dialog(utils.get_tc_string(current_frame), _marker_add_dialog_callback)
def get_mark_out_str(self): return utils.get_tc_string(self.mark_out)
def _slomo_range_changed(range_combo, media_file, slider, length_label): clip_length = _get_rendered_slomo_clip_length(media_file, range_combo, slider.get_adjustment().get_value()) length_label.set_text(utils.get_tc_string(clip_length))
def show_slowmo_dialog(media_file, _response_callback): folder, file_name = os.path.split(media_file.path) name, ext = os.path.splitext(file_name) dialog = Gtk.Dialog(_("Render Slow/Fast Motion Video File"), gui.editor_window.window, Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, (Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT, _("Render").encode('utf-8'), Gtk.ResponseType.ACCEPT)) media_file_label = Gtk.Label(label=_("Source Media File: ")) media_name = Gtk.Label(label="<b>" + media_file.name + "</b>") media_name.set_use_markup(True) SOURCE_PAD = 8 SOURCE_HEIGHT = 20 mf_row = guiutils.get_left_justified_box([media_file_label, guiutils.pad_label(SOURCE_PAD, SOURCE_HEIGHT), media_name]) mark_in = Gtk.Label(label=_("<b>not set</b>")) mark_out = Gtk.Label(label=_("<b>not set</b>")) if media_file.mark_in != -1: mark_in = Gtk.Label(label="<b>" + utils.get_tc_string(media_file.mark_in) + "</b>") if media_file.mark_out != -1: mark_out = Gtk.Label(label="<b>" + utils.get_tc_string(media_file.mark_out) + "</b>") mark_in.set_use_markup(True) mark_out.set_use_markup(True) fb_widgets = utils.EmptyClass() fb_widgets.file_name = Gtk.Entry() fb_widgets.file_name.set_text(name + "_MOTION") fb_widgets.extension_label = Gtk.Label() fb_widgets.extension_label.set_size_request(45, 20) name_row = Gtk.HBox(False, 4) name_row.pack_start(fb_widgets.file_name, True, True, 0) name_row.pack_start(fb_widgets.extension_label, False, False, 4) fb_widgets.out_folder = Gtk.FileChooserButton(_("Select Target Folder")) fb_widgets.out_folder.set_action(Gtk.FileChooserAction.SELECT_FOLDER) fb_widgets.out_folder.set_current_folder(folder) label = Gtk.Label(label=_("Speed %:")) adjustment = Gtk.Adjustment(float(100), float(1), float(600), float(1)) fb_widgets.hslider = Gtk.HScale() fb_widgets.hslider.set_adjustment(adjustment) fb_widgets.hslider.set_draw_value(False) spin = Gtk.SpinButton() spin.set_numeric(True) spin.set_adjustment(adjustment) fb_widgets.hslider.set_digits(0) spin.set_digits(0) slider_hbox = Gtk.HBox(False, 4) slider_hbox.pack_start(fb_widgets.hslider, True, True, 0) slider_hbox.pack_start(spin, False, False, 4) slider_hbox.set_size_request(350,35) hbox = Gtk.HBox(False, 2) hbox.pack_start(guiutils.pad_label(8, 8), False, False, 0) hbox.pack_start(label, False, False, 0) hbox.pack_start(slider_hbox, False, False, 0) profile_selector = ProfileSelector() profile_selector.fill_options() profile_selector.widget.set_sensitive(True) fb_widgets.out_profile_combo = profile_selector.widget quality_selector = RenderQualitySelector() fb_widgets.quality_cb = quality_selector.widget # Encoding encoding_selector = RenderEncodingSelector(quality_selector, fb_widgets.extension_label, None) encoding_selector.encoding_selection_changed() fb_widgets.encodings_cb = encoding_selector.widget objects_list = Gtk.TreeStore(str, bool) objects_list.append(None, [_("Full Source Length"), True]) if media_file.mark_in != -1 and media_file.mark_out != -1: range_available = True else: range_available = False objects_list.append(None, [_("Source Mark In to Mark Out"), range_available]) fb_widgets.render_range = Gtk.ComboBox.new_with_model(objects_list) renderer_text = Gtk.CellRendererText() fb_widgets.render_range.pack_start(renderer_text, True) fb_widgets.render_range.add_attribute(renderer_text, "text", 0) fb_widgets.render_range.add_attribute(renderer_text, 'sensitive', 1) fb_widgets.render_range.set_active(0) fb_widgets.render_range.show() # To update rendered length display clip_length = _get_rendered_slomo_clip_length(media_file, fb_widgets.render_range, 100) clip_length_label = Gtk.Label(label=utils.get_tc_string(clip_length)) fb_widgets.hslider.connect("value-changed", _slomo_speed_changed, media_file, fb_widgets.render_range, clip_length_label) fb_widgets.render_range.connect("changed", _slomo_range_changed, media_file, fb_widgets.hslider, clip_length_label) # Build gui vbox = Gtk.VBox(False, 2) vbox.pack_start(mf_row, False, False, 0) vbox.pack_start(guiutils.get_left_justified_box([Gtk.Label(label=_("Source Mark In: ")), guiutils.pad_label(SOURCE_PAD, SOURCE_HEIGHT), mark_in]), False, False, 0) vbox.pack_start(guiutils.get_left_justified_box([Gtk.Label(label=_("Source_Mark Out: ")), guiutils.pad_label(SOURCE_PAD, SOURCE_HEIGHT), mark_out]), False, False, 0) vbox.pack_start(guiutils.pad_label(18, 12), False, False, 0) vbox.pack_start(hbox, False, False, 0) vbox.pack_start(guiutils.pad_label(18, 12), False, False, 0) vbox.pack_start(guiutils.get_two_column_box(Gtk.Label(label=_("Target File:")), name_row, 120), False, False, 0) vbox.pack_start(guiutils.get_two_column_box(Gtk.Label(label=_("Target Folder:")), fb_widgets.out_folder, 120), False, False, 0) vbox.pack_start(guiutils.get_two_column_box(Gtk.Label(label=_("Target Profile:")), fb_widgets.out_profile_combo, 200), False, False, 0) vbox.pack_start(guiutils.get_two_column_box(Gtk.Label(label=_("Target Encoding:")), fb_widgets.encodings_cb, 200), False, False, 0) vbox.pack_start(guiutils.get_two_column_box(Gtk.Label(label=_("Target Quality:")), fb_widgets.quality_cb, 200), False, False, 0) vbox.pack_start(guiutils.pad_label(18, 12), False, False, 0) vbox.pack_start(guiutils.get_two_column_box(Gtk.Label(label=_("Render Range:")), fb_widgets.render_range, 180), False, False, 0) vbox.pack_start(guiutils.get_two_column_box(Gtk.Label(label=_("Rendered Clip Length:")), clip_length_label, 180), False, False, 0) alignment = guiutils.set_margins(vbox, 6, 24, 24, 24) dialog.vbox.pack_start(alignment, True, True, 0) dialogutils.set_outer_margins(dialog.vbox) dialogutils.default_behaviour(dialog) dialog.connect('response', _response_callback, fb_widgets, media_file) dialog.show_all()
def _reverse_range_changed(range_combo, media_file, slider, length_label): clip_length = _get_rendered_reverse_clip_length(media_file, range_combo, slider.get_adjustment().get_value()) length_label.set_text(utils.get_tc_string(clip_length))
def _reverse_speed_changed(slider, media_file, range_combo, length_label): clip_length = _get_rendered_reverse_clip_length(media_file, range_combo, slider.get_adjustment().get_value()) length_label.set_text(utils.get_tc_string(clip_length))
def show_reverse_dialog(media_file, default_range_render, _response_callback): folder, file_name = os.path.split(media_file.path) if media_file.is_proxy_file: folder, file_name = os.path.split(media_file.second_file_path) name, ext = os.path.splitext(file_name) dialog = Gtk.Dialog(_("Render Reverse Motion Video File"), gui.editor_window.window, Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, (Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT, _("Render").encode('utf-8'), Gtk.ResponseType.ACCEPT)) media_file_label = Gtk.Label(label=_("Source Media File: ")) media_name = Gtk.Label(label="<b>" + media_file.name + "</b>") media_name.set_use_markup(True) SOURCE_PAD = 8 SOURCE_HEIGHT = 20 mf_row = guiutils.get_left_justified_box([media_file_label, guiutils.pad_label(SOURCE_PAD, SOURCE_HEIGHT), media_name]) mark_in = Gtk.Label(label=_("<b>not set</b>")) mark_out = Gtk.Label(label=_("<b>not set</b>")) if media_file.mark_in != -1: mark_in = Gtk.Label(label="<b>" + utils.get_tc_string(media_file.mark_in) + "</b>") if media_file.mark_out != -1: mark_out = Gtk.Label(label="<b>" + utils.get_tc_string(media_file.mark_out) + "</b>") mark_in.set_use_markup(True) mark_out.set_use_markup(True) fb_widgets = utils.EmptyClass() fb_widgets.file_name = Gtk.Entry() fb_widgets.file_name.set_text(name + "_REVERSE") fb_widgets.extension_label = Gtk.Label() fb_widgets.extension_label.set_size_request(45, 20) name_row = Gtk.HBox(False, 4) name_row.pack_start(fb_widgets.file_name, True, True, 0) name_row.pack_start(fb_widgets.extension_label, False, False, 4) fb_widgets.out_folder = Gtk.FileChooserButton(_("Select Target Folder")) fb_widgets.out_folder.set_action(Gtk.FileChooserAction.SELECT_FOLDER) fb_widgets.out_folder.set_current_folder(folder) label = Gtk.Label(label=_("Speed %:")) adjustment = Gtk.Adjustment(float(-100), float(-600), float(-1), float(1)) fb_widgets.hslider = Gtk.HScale() fb_widgets.hslider.set_adjustment(adjustment) fb_widgets.hslider.set_draw_value(False) spin = Gtk.SpinButton() spin.set_numeric(True) spin.set_adjustment(adjustment) fb_widgets.hslider.set_digits(0) spin.set_digits(0) slider_hbox = Gtk.HBox(False, 4) slider_hbox.pack_start(fb_widgets.hslider, True, True, 0) slider_hbox.pack_start(spin, False, False, 4) slider_hbox.set_size_request(450,35) hbox = Gtk.HBox(False, 2) hbox.pack_start(guiutils.pad_label(8, 8), False, False, 0) hbox.pack_start(slider_hbox, False, False, 0) profile_selector = ProfileSelector() profile_selector.fill_options() profile_selector.widget.set_sensitive(True) fb_widgets.out_profile_combo = profile_selector.widget quality_selector = RenderQualitySelector() fb_widgets.quality_cb = quality_selector.widget # Encoding encoding_selector = RenderEncodingSelector(quality_selector, fb_widgets.extension_label, None) encoding_selector.encoding_selection_changed() fb_widgets.encodings_cb = encoding_selector.widget objects_list = Gtk.TreeStore(str, bool) objects_list.append(None, [_("Full Source Length"), True]) if media_file.mark_in != -1 and media_file.mark_out != -1: range_available = True else: range_available = False objects_list.append(None, [_("Source Mark In to Mark Out"), range_available]) fb_widgets.render_range = Gtk.ComboBox.new_with_model(objects_list) renderer_text = Gtk.CellRendererText() fb_widgets.render_range.pack_start(renderer_text, True) fb_widgets.render_range.add_attribute(renderer_text, "text", 0) fb_widgets.render_range.add_attribute(renderer_text, 'sensitive', 1) if default_range_render == False: fb_widgets.render_range.set_active(0) else: fb_widgets.render_range.set_active(1) fb_widgets.render_range.show() # To update rendered length display clip_length = _get_rendered_slomo_clip_length(media_file, fb_widgets.render_range, 100) clip_length_label = Gtk.Label(label=utils.get_tc_string(clip_length)) fb_widgets.hslider.connect("value-changed", _reverse_speed_changed, media_file, fb_widgets.render_range, clip_length_label) fb_widgets.render_range.connect("changed", _reverse_range_changed, media_file, fb_widgets.hslider, clip_length_label) # Build gui vbox = Gtk.VBox(False, 2) vbox.pack_start(mf_row, False, False, 0) vbox.pack_start(guiutils.get_left_justified_box([Gtk.Label(label=_("Source Mark In: ")), guiutils.pad_label(SOURCE_PAD, SOURCE_HEIGHT), mark_in]), False, False, 0) vbox.pack_start(guiutils.get_left_justified_box([Gtk.Label(label=_("Source Mark Out: ")), guiutils.pad_label(SOURCE_PAD, SOURCE_HEIGHT), mark_out]), False, False, 0) vbox.pack_start(guiutils.pad_label(18, 12), False, False, 0) vbox.pack_start(label, False, False, 0) vbox.pack_start(hbox, False, False, 0) vbox.pack_start(guiutils.pad_label(18, 12), False, False, 0) vbox.pack_start(guiutils.get_two_column_box(Gtk.Label(label=_("Target File:")), name_row, 120), False, False, 0) vbox.pack_start(guiutils.get_two_column_box(Gtk.Label(label=_("Target Folder:")), fb_widgets.out_folder, 120), False, False, 0) vbox.pack_start(guiutils.get_two_column_box(Gtk.Label(label=_("Target Profile:")), fb_widgets.out_profile_combo, 200), False, False, 0) vbox.pack_start(guiutils.get_two_column_box(Gtk.Label(label=_("Target Encoding:")), fb_widgets.encodings_cb, 200), False, False, 0) vbox.pack_start(guiutils.get_two_column_box(Gtk.Label(label=_("Target Quality:")), fb_widgets.quality_cb, 200), False, False, 0) vbox.pack_start(guiutils.pad_label(18, 12), False, False, 0) vbox.pack_start(guiutils.get_two_column_box(Gtk.Label(label=_("Render Range:")), fb_widgets.render_range, 180), False, False, 0) vbox.pack_start(guiutils.get_two_column_box(Gtk.Label(label=_("Rendered Clip Length:")), clip_length_label, 180), False, False, 0) alignment = guiutils.set_margins(vbox, 6, 24, 24, 24) dialog.vbox.pack_start(alignment, True, True, 0) dialogutils.set_outer_margins(dialog.vbox) dialogutils.default_behaviour(dialog) dialog.connect('response', _response_callback, fb_widgets, media_file) dialog.show_all()
def _slomo_speed_changed(slider, media_file, range_combo, length_label): clip_length = _get_rendered_slomo_clip_length(media_file, range_combo, slider.get_adjustment().get_value()) length_label.set_text(utils.get_tc_string(clip_length))
def _slomo_range_changed(range_combo, media_file, adjustment, length_label): clip_length = _get_rendered_slomo_clip_length(media_file, range_combo, adjustment.get_value()) length_label.set_text(utils.get_tc_string(clip_length))
def set_frame(self, frame): frame_str = utils.get_tc_string(frame) self.kf_pos_label.set_text(frame_str)