本文整理汇总了Python中engine.Engine.prioritize方法的典型用法代码示例。如果您正苦于以下问题:Python Engine.prioritize方法的具体用法?Python Engine.prioritize怎么用?Python Engine.prioritize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类engine.Engine
的用法示例。
在下文中一共展示了Engine.prioritize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GesDemo
# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import prioritize [as 别名]
class GesDemo():
'''User Interface class'''
def __init__(self):
'''Initialize the User Interface and the GES Engine'''
self.engine = Engine()
self.clips = {}
# we import the gtk objects from glade and create our GtkStore and TreeView
self.builder = Gtk.Builder()
self.builder.add_from_file(os.path.join(os.path.curdir, \
"py-ges-demo.glade"))
self.builder.connect_signals(self)
self.timeline_treeview = self.builder.get_object("timeline_treeview")
#id, uri, start, duration, in point
self.timeline_store = Gtk.ListStore(int, str, long, long, long)
self.timeline_treeview.set_model(self.timeline_store)
self.timeline_current_iter = None #To keep track of the cursor
self.start_entry = self.builder.get_object("start_entry")
self.duration_scale = self.builder.get_object("duration_scale")
self.in_point_scale = self.builder.get_object("in_point_scale")
self.window = self.builder.get_object("window")
self.window.show_all()
def _clip_selected(self, widget):
'''Method connected to the selection-changed signal of the TreeView'''
model, row_iter = self.timeline_treeview.get_selection().get_selected()
if row_iter is None:
self.engine.prioritize(None)
else:
idf = self.timeline_store.get_value(row_iter, 0)
self.engine.prioritize(self.clips[idf][5])
print "active clip: ", self.clips[idf]
self._update_properties_box(idf)
def _update_properties_box(self, idf):
'''Method to update the properties box with the information of the selected clip'''
clip = self.clips[idf]
self.start_entry.set_text(str(clip[1]))
self.duration_scale.set_range(0, clip[4] - clip[3])
self.duration_scale.set_value(clip[2])
self.in_point_scale.set_range(0, clip[4])
self.in_point_scale.set_value(clip[3])
def _play_activate_cb(self, widget):
'''Method connected to the Play button'''
self.engine.play()
def _stop_activate_cb(self, widget):
'''Method connected to the Stop button'''
self.engine.stop()
def _add_file_activated_cb(self, widget):
'''Method connected to the Add File button'''
filechooser = Gtk.FileChooserDialog(action=Gtk.FileChooserAction.OPEN,
buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
response = filechooser.run()
if response != Gtk.ResponseType.OK:
filechooser.destroy()
return
filepath = filechooser.get_filename()
if filepath and os.access(filepath, os.R_OK):
filechooser.destroy()
self.add_file(filepath)
def add_file(self, filepath):
'''Method that adds the file to the GtkStore and GESTimeline'''
idf = len(self.clips) # id field is a counter
uri = Gst.filename_to_uri (filepath) # conver the filepath into a valid URI
duration, tlobj = self.engine.add_file(uri) # add the uri to the GESTimeline
# add to the GtkStore and internal list
self.timeline_store.append([idf, os.path.basename(filepath), 0,
duration, 0])
# clips[id] = uri, start, duration, in_point, max_duration, timelineobj
self.clips[idf] = [uri, 0, duration, 0, duration, tlobj]
def _delete_activate_cb(self, widget):
'''Method connected to the Delete button'''
print "delete"
def _start_changed(self, widget):
'''Method connected to the Changed event of the start entry'''
new_start = widget.get_text()
print "new start entered", new_start
# find the selected clip
model, row_iter = self.timeline_treeview.get_selection().get_selected()
idf = self.timeline_store.get_value(row_iter, 0)
self.clips[idf][1] = new_start
# set the new value to the Gtk TreeStore
try:
#.........这里部分代码省略.........