本文整理汇总了Python中mpx.lib.node.ConfigurableNode.start方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigurableNode.start方法的具体用法?Python ConfigurableNode.start怎么用?Python ConfigurableNode.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpx.lib.node.ConfigurableNode
的用法示例。
在下文中一共展示了ConfigurableNode.start方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start
# 需要导入模块: from mpx.lib.node import ConfigurableNode [as 别名]
# 或者: from mpx.lib.node.ConfigurableNode import start [as 别名]
def start( self ):
#
# Should I also call ConnectionMixin.start() and
# EventProducerMixin.start()????
ConfigurableNode.start( self )
msg = ''
_msg = ''
# This node is a child of DirectPPP, which in turn is a child of a Port.
self.port = self.parent.parent
try:
if self.enable:
_msg = ( '%s.%s did not start..\nReason\n'
% (str( self.parent.name ), str( self.name )) )
self._enable_direct_ppp()
self._start_ppp_program()
else:
_msg = ( 'Could not disable %s.%s '
% (self.parent.name, self.name) )
self._disable_direct_ppp()
self._start_ppp_program()
except EPermission, e:
msg += _msg
msg += str( e.keywords['reason'] )
示例2: start
# 需要导入模块: from mpx.lib.node import ConfigurableNode [as 别名]
# 或者: from mpx.lib.node.ConfigurableNode import start [as 别名]
def start(self):
self.DEBUG3("start():\n")
ConfigurableNode.start(self)
self.__running = True
self._begin_critical_section()
try: self._poll_input()
finally: self._end_critical_section()
self.DEBUG3("start: return\n")
return
示例3: start
# 需要导入模块: from mpx.lib.node import ConfigurableNode [as 别名]
# 或者: from mpx.lib.node.ConfigurableNode import start [as 别名]
def start(self):
self.debug_print('Starting...', 0)
ConfigurableNode.start(self)
poll_obj = select.poll()
poll_obj.register(self.parent.file.fileno(), select.POLLIN)
count = 0
while count < 10:
evt_prs = poll_obj.poll()
print 'Got event pair %s.' % evt_prs
self.parent.file.read(1024)
count = count + 1
time.sleep(0.5)
示例4: start
# 需要导入模块: from mpx.lib.node import ConfigurableNode [as 别名]
# 或者: from mpx.lib.node.ConfigurableNode import start [as 别名]
def start(self):
"""method start(): Called by MFW."""
self.debug_print('Starting...', 0)
ConfigurableNode.start(self)
示例5: start
# 需要导入模块: from mpx.lib.node import ConfigurableNode [as 别名]
# 或者: from mpx.lib.node.ConfigurableNode import start [as 别名]
def start(self):
# Grab a handle to our event producer node.
if not self.pnode_obj:
try:
self.pnode_obj = as_node(self.prodnode)
except:
mstr = 'Could not grab handle to our event producer node: %s' % self.prodnode
self._logMsg(ERR, mstr)
msglog.exception()
if not self.pnode_subscribed:
# Attempt to subscribe to events produced by
# our event producer node.
try:
self.pnode_obj.event_subscribe(self, self._event_class)
self.pnode_subscribed = 1
except:
mstr = 'Could not subscribe to events from our Event Producer node (%s).' % self.prodnode
self._logMsg(WARN, mstr)
msglog.exception()
#
ConfigurableNode.start(self)
variables = []
self._message = ''
message = self.message
while '$' in message:
index = message.index('$')
try:
if message[index+1] == '{':
end = string.find(message,'}',index)
if end > -1:
var = message[index:end+1]
variable = var[2:-1]
if '$' not in variable and '{' not in variable:
message = string.replace(message,var,'%s')
variables.append(variable)
except IndexError:
pass
self._message += message[0:index+1]
message = message[index+1:]
self._message += message
self._message_vars = tuple(variables)
variables = []
self._subject = ''
subject = self.subject
while '$' in subject:
index = subject.index('$')
try:
if subject[index+1] == '{':
end = string.find(subject,'}',index)
if end > -1:
var = subject[index:end+1]
variable = var[2:-1]
if '$' not in variable and '{' not in variable:
subject = string.replace(subject,var,'%s')
variables.append(variable)
except IndexError:
pass
self._subject += subject[0:index+1]
subject = subject[index+1:]
self._subject += subject
self._subject_vars = tuple(variables)