本文整理汇总了Python中gstswitch.controller.Controller.cb_signal_handler方法的典型用法代码示例。如果您正苦于以下问题:Python Controller.cb_signal_handler方法的具体用法?Python Controller.cb_signal_handler怎么用?Python Controller.cb_signal_handler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gstswitch.controller.Controller
的用法示例。
在下文中一共展示了Controller.cb_signal_handler方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_multiple_handler_calls
# 需要导入模块: from gstswitch.controller import Controller [as 别名]
# 或者: from gstswitch.controller.Controller import cb_signal_handler [as 别名]
def test_multiple_handler_calls(self, monkeypatch):
"""Test that the various Handler gets calles"""
monkeypatch.setattr(Connection, 'connect_dbus', Mock())
controller = Controller(address='unix:abstract=abcd')
signals = ('preview_port_added', 'preview_port_removed',
'new_mode_online', 'show_face_marker',
'show_track_marker', 'select_face')
test_cbs = {}
for signal in signals:
test_cbs[signal] = Mock()
getattr(controller, 'on_'+signal)(test_cbs[signal])
getattr(controller, 'on_'+signal)(test_cbs[signal])
getattr(controller, 'on_'+signal)(test_cbs[signal])
for signal in signals:
controller.cb_signal_handler(
None,
':0',
'/us/timvideos/gstswitch/SwitchControllerInterface',
'us.timvideos.gstswitch.SwitchControllerInterface',
signal,
GLib.Variant('(i)', (123,)),
None)
for signal in signals:
test_cbs[signal].assert_called_with(123)
assert test_cbs[signal].call_count == 3
示例2: test_signal_name_collision
# 需要导入模块: from gstswitch.controller import Controller [as 别名]
# 或者: from gstswitch.controller.Controller import cb_signal_handler [as 别名]
def test_signal_name_collision(self, monkeypatch):
"""Test that nothing happens when a signal is on the bus which name
collides with an attribute also starting with 'callbacks_'
"""
monkeypatch.setattr(Connection, 'connect_dbus', Mock())
controller = Controller(address='unix:abstract=abcd')
controller.callbacks_foobar = 123
controller.cb_signal_handler(None, ':0', '/foo/bar',
'foo.bar', 'foobar', None, None)
示例3: test_single_handler_calls
# 需要导入模块: from gstswitch.controller import Controller [as 别名]
# 或者: from gstswitch.controller.Controller import cb_signal_handler [as 别名]
def test_single_handler_calls(self, monkeypatch):
"""Test that the various Handler gets calles"""
monkeypatch.setattr(Connection, 'connect_dbus', Mock())
for signal in ('preview_port_added', 'preview_port_removed',
'new_mode_online', 'show_face_marker',
'show_track_marker', 'select_face'):
test_cb = Mock()
controller = Controller(address='unix:abstract=abcd')
getattr(controller, 'on_'+signal)(test_cb)
controller.cb_signal_handler(
None,
':0',
'/us/timvideos/gstswitch/SwitchControllerInterface',
'us.timvideos.gstswitch.SwitchControllerInterface',
signal,
GLib.Variant('(iii)', (5, 10, 20,)),
None)
test_cb.assert_called_once_with(5, 10, 20)
示例4: test_unknown_signal_name
# 需要导入模块: from gstswitch.controller import Controller [as 别名]
# 或者: from gstswitch.controller.Controller import cb_signal_handler [as 别名]
def test_unknown_signal_name(self, monkeypatch):
"""Test that nothing happens when a unknown signal is on the bus"""
monkeypatch.setattr(Connection, 'connect_dbus', Mock())
controller = Controller(address='unix:abstract=abcd')
controller.cb_signal_handler(None, ':0', '/foo/bar',
'foo.bar', 'foobar', None, None)