本文整理汇总了Python中context.Context.stop方法的典型用法代码示例。如果您正苦于以下问题:Python Context.stop方法的具体用法?Python Context.stop怎么用?Python Context.stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类context.Context
的用法示例。
在下文中一共展示了Context.stop方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test
# 需要导入模块: from context import Context [as 别名]
# 或者: from context.Context import stop [as 别名]
def test(self):
c = Context('Root')
c.start()
o0 = self.SampleObj()
Dispatcher.add(obj=o0, parent_obj=None, context=c)
o1 = self.SampleObj()
Dispatcher.add(obj=o1, parent_obj=None, context=c)
Dispatcher.add_listener(src_obj=o1, dst_obj=o0)
Dispatcher.send(event=Event('1'), src_obj=o0, dst_obj=o1)
assert str(o1.lastHandler) == 'on1'
Dispatcher.queue(event=Event('2'), src_obj=o0, dst_obj=o1)
#assert str(o1.lastHandler) == 'on2'
Dispatcher.send(event=Event('3'), src_obj=o0, dst_obj=o1)
#assert str(o1.lastHandler) == 'on3'
Dispatcher.notify(event=Event('4'), src_obj=o1)
#assert str(o1.lastHandler) == 'on4'
Dispatcher.notify(event=Event('4'), src_obj=o1)
#assert str(o1.lastHandler) == 'on4'
c.stop()
示例2: test
# 需要导入模块: from context import Context [as 别名]
# 或者: from context.Context import stop [as 别名]
def test(self):
events = [Event('event0'), Event('event1'), Event('event2')]
o = SampleObj(events)
c = Context('context0')
c.start()
for event in events:
future = c.queue(event, o, o)
#print future
#future.cancel()
#print future()
#print future
time.sleep(0.1)
c.stop()
示例3: test
# 需要导入模块: from context import Context [as 别名]
# 或者: from context.Context import stop [as 别名]
def test(self):
d = Dispatcher()
c = Context('Root')
c.start()
o = self.SampleObj()
d.add(obj=o, parent_obj=None, context=c)
o.Start()
assert str(o.state.current_state) == o.STATE_STARTED
assert str(o.last_handler) == 'inStarted_onEnter'
o.Pause()
assert str(o.state.current_state) == 'Paused'
assert str(o.last_handler) == 'inPaused_onEnter'
o.Stop()
assert str(o.state.current_state) == 'Stopped'
assert str(o.last_handler) == 'inStopped_onEnter'
c.stop()
示例4: runTest
# 需要导入模块: from context import Context [as 别名]
# 或者: from context.Context import stop [as 别名]
def runTest( self ):
context = Context( 'root' )
context.start()
listener = TestListener()
listener.context = context
node = System( 'system', listener )
node.addListener( listener )
context.queue( Event( System.EVENT_START ), node )
# from message import *
s = 'INVITE sip:[email protected] SIP/2.0\r\n' \
'Call-ID: abcde\r\nContent-Length: 136\r\nContent-Type: application/simple-message-summary\r\n\r\nMessages-Waiting: yes\r\nMessage-Account: sip:[email protected]\r\nvoice-message: 1/5(2/4)\r\nfax-message: 0/1\r\ntext-message: 3/7\r\n' \
'\r\n'
message = Request( s )
e = MessageEvent( MessageEvent.EVENT_RX, message )
context.queue( e, node )
#context.queue( Event( System.EVENT_STOP ), node )
context.stop()