本文整理汇总了Python中utils.get_tc_string函数的典型用法代码示例。如果您正苦于以下问题:Python get_tc_string函数的具体用法?Python get_tc_string怎么用?Python get_tc_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_tc_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _show_clip_info
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))
示例2: _display_file_info
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))
示例3: _display_file_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))
示例4: _draw_bottom_panel
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))
示例5: display_monitor_clip_name
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)
示例6: _show_clip_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))
示例7: update_seqence_info_text
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)
示例8: _add_clip_marker
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))
示例9: _get_marks_range_info_text
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
示例10: _display_file_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))
示例11: _marker_menu_item_activated
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)
示例12: display_monitor_clip_name
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)
示例13: _slomo_range_changed
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))
示例14: show_slowmo_dialog
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)
#.........这里部分代码省略.........
示例15: frames_to_tc
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)