本文整理汇总了Python中mpx.lib.node.ConfigurableNode类的典型用法代码示例。如果您正苦于以下问题:Python ConfigurableNode类的具体用法?Python ConfigurableNode怎么用?Python ConfigurableNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfigurableNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start
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: __init__
def __init__(self, parent):
self.__parent = parent
self.__cov_count = 0
self._old_value = None
ConfigurableNode.__init__(self)
EventProducerMixin.__init__(self)
return
示例3: __init__
def __init__( self ):
ConfigurableNode.__init__( self )
EventProducerMixin.__init__( self )
#
# Set old value to something which will never be valid so that
# we always generate an event on startup.
self.old_value = -99
示例4: configure
def configure(self, config):
"""method configure(): Called by MFW."""
self.debug_print('Starting configuration...', 0)
ConfigurableNode.configure(self, config)
self.debug_print('Configuration complete.', 0)
示例5: __init__
def __init__(self, prop_type_id, prop_type_name, prop_inst_num, dev):
ConfigurableNode.__init__(self)
self._prop_type_id = prop_type_id
self._prop_type_name = prop_type_name
self._prop_inst_num = prop_inst_num
self._dev = dev
self.running = 0
示例6: __init__
def __init__(self):
ConfigurableNode.__init__(self)
self._url = 'unknown'
self._poll_event = None
self._period = 0.2
# Pre-load attributes.
self.off_text = "Off"
self.on_text = "On"
self.auto_text = "Auto"
self.reverse_output = 0
self.output = REQUIRED
self.input = REQUIRED
self.period = self._period
self.asyncOK = 1
self.state = 2
self.debug = 0
self.__running = False
self._init_debug()
self.OFF = EnumeratedValue(0, self.off_text)
self.ON = EnumeratedValue(1, self.on_text)
self.AUTO = EnumeratedValue(2, self.auto_text)
self._NORMAL = 0
self._SAFETY = 1
self._output_state = self._NORMAL
self._output_lock = Lock()
self._changes_at = 0
self._waiting_value = None
self._value = None
self._lock = Lock()
return
示例7: configure
def configure(self,config):
ConfigurableNode.configure(self, config)
message = ''
if not (config.has_key('message') and config['message']):
for var in self.variables:
if message:
message += ', '
message += '%s = ${%s}' % (var['vn'],var['vn'])
set_attribute(self, 'message', message, {})
else:
set_attribute(self, 'message', REQUIRED, config)
set_attribute(self, 'subject', '', config, str)
set_attribute(self, 'send_retries', 3, config, int)
set_attribute(self, 'enabled', 1, config, as_boolean)
set_attribute(self, 'prodnode', '', config, str)
set_attribute(self, 'eventmodule', '', config, str)
set_attribute(self, 'eventclass', '', config, str)
set_attribute(self, 'debug', 0, config, int)
self._event_class = None
# Try to import our specified event class.
try:
x = __import__(self.eventmodule, {}, {}, self.eventclass)
self._event_class = eval('x.%s' % self.eventclass)
except:
msglog.log('broadway',msglog.types.WARN,
'Got exception trying to import event class.')
msglog.exception()
self._manager = self.parent.parent
示例8: configure
def configure( self, config ):
set_attribute( self, 'enable', 0, config, int )
set_attribute( self, 'user_id', '', config )
set_attribute( self, 'password', '', config )
set_attribute( self, 'local_ip', '', config )
set_attribute( self, 'client_ip', '', config )
set_attribute( self, 'debug', 0, config, int )
ConfigurableNode.configure( self, config )
示例9: stop
def stop(self):
self.DEBUG3("stop():\n")
ConfigurableNode.stop(self)
self.__running = False
self._begin_critical_section()
try: self._cancel_polling()
finally: self._end_critical_section()
self.DEBUG3("stop: return\n")
return
示例10: __init__
def __init__(self):
ConfigurableNode.__init__(self)
EventProducerMixin.__init__(self)
EventConsumerMixin.__init__(self)
self._current_id = None
self._event_class = None
self.start_counter = 0
self.pnode_obj = None
self.pnode_subscribed = 0
示例11: prune
def prune(self, force=False):
ConfigurableNode.prune(self, force)
new_value = ENoSuchNode(self._pruned_url)
self._value = new_value
cov = ChangeOfValueEvent(self, self._old_value, new_value,
time.time())
self._old_value = new_value
self.event_generate(cov)
return
示例12: start
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
示例13: __init__
def __init__( self ):
ConfigurableNode.__init__( self )
self.isRunning = 0
self.ipcheck_pid = 0
self._lock = Lock()
self.thread = None
self.first_time = 0
self.log_name = 'broadway'
self.update_count = 0
示例14: configure
def configure(self, config):
"""method configure(): Called by MFW."""
self.debug_print('Starting configuration...', 0)
ConfigurableNode.configure(self, config) # includes addition of "parent" attr
try:
self.parent.open()
except termios.error, details:
print 'termios.error: %s.' % str(details)
示例15: configure
def configure( self, config_dict ):
ConfigurableNode.configure( self, config_dict )
set_attribute( self, 'enable', 0, config_dict, int )
set_attribute( self, 'debug', 0, config_dict, int )
set_attribute( self, 'ddns_service', 0, config_dict )
set_attribute( self, 'ddns_acct', 0, config_dict )
set_attribute( self, 'ddns_pswd', 0, config_dict )
set_attribute( self, 'host_name', 0, config_dict )
map_to_attribute( self, 'period', 0, config_dict, map_to_seconds )