本文整理匯總了Python中gi.repository.GstValidate.utils_enum_from_str方法的典型用法代碼示例。如果您正苦於以下問題:Python GstValidate.utils_enum_from_str方法的具體用法?Python GstValidate.utils_enum_from_str怎麽用?Python GstValidate.utils_enum_from_str使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gi.repository.GstValidate
的用法示例。
在下文中一共展示了GstValidate.utils_enum_from_str方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: setEditingMode
# 需要導入模塊: from gi.repository import GstValidate [as 別名]
# 或者: from gi.repository.GstValidate import utils_enum_from_str [as 別名]
def setEditingMode(timeline, scenario, action):
if not hasattr(scenario, "last_mode"):
scenario.last_mode = None
try:
res, mode = GstValidate.utils_enum_from_str(GES.EditMode, action.structure["edit-mode"])
if not res:
mode = GES.EditMode.EDIT_NORMAL
else:
mode = GES.EditMode(mode)
except KeyError:
mode = GES.EditMode.EDIT_NORMAL
if mode == GES.EditMode.EDIT_RIPPLE:
timeline.ui.get_parent().do_key_press_event(Event(Gdk.EventType.KEY_PRESS, keyval=Gdk.KEY_Shift_L))
if scenario.last_mode == GES.EditMode.EDIT_ROLL:
timeline.ui.get_parent().do_key_release_event(Event(Gdk.EventType.KEY_RELEASE, keyval=Gdk.KEY_Control_L))
elif mode == GES.EditMode.EDIT_ROLL:
timeline.ui.do_key_press_event(Event(Gdk.EventType.KEY_PRESS, keyval=Gdk.KEY_Control_L))
if scenario.last_mode == GES.EditMode.EDIT_RIPPLE:
timeline.ui.do_key_release_event(Event(Gdk.EventType.KEY_RELEASE, keyval=Gdk.KEY_Shift_L))
else:
cleanEditModes(timeline, scenario)
scenario.last_mode = mode
示例2: setEditingMode
# 需要導入模塊: from gi.repository import GstValidate [as 別名]
# 或者: from gi.repository.GstValidate import utils_enum_from_str [as 別名]
def setEditingMode(timeline, scenario, action):
try:
mode = scenario.last_mode
mode
except AttributeError:
scenario.last_mode = None
try:
res, mode = GstValidate.utils_enum_from_str(GES.EditMode, action.structure["edit-mode"])
if not res:
mode = GES.EditMode.EDIT_NORMAL
else:
mode = GES.EditMode(mode)
except KeyError:
mode = GES.EditMode.EDIT_NORMAL
if mode == GES.EditMode.EDIT_RIPPLE:
timeline.ui.sendFakeEvent(Event(Gdk.EventType.KEY_PRESS, keyval=Gdk.KEY_Shift_L))
if scenario.last_mode == GES.EditMode.EDIT_ROLL:
timeline.ui.sendFakeEvent(Event(Gdk.EventType.KEY_RELEASE, keyval=Gdk.KEY_Control_L))
elif mode == GES.EditMode.EDIT_ROLL:
timeline.ui.sendFakeEvent(Event(Gdk.EventType.KEY_PRESS, keyval=Gdk.KEY_Control_L))
if scenario.last_mode == GES.EditMode.EDIT_RIPPLE:
timeline.ui.sendFakeEvent(Event(Gdk.EventType.KEY_RELEASE, keyval=Gdk.KEY_Shift_L))
else:
cleanEditModes(timeline, scenario)
scenario.last_mode = mode
示例3: get_edge
# 需要導入模塊: from gi.repository import GstValidate [as 別名]
# 或者: from gi.repository.GstValidate import utils_enum_from_str [as 別名]
def get_edge(structure):
try:
res, edge = GstValidate.utils_enum_from_str(GES.Edge, structure["edge"])
if not res:
edge = GES.Edge.EDGE_NONE
else:
edge = GES.Edge(edge)
except KeyError:
edge = GES.Edge.EDGE_NONE
return edge