当前位置: 首页>>代码示例>>Python>>正文


Python Config.add_client方法代码示例

本文整理汇总了Python中echomesh.base.Config.add_client方法的典型用法代码示例。如果您正苦于以下问题:Python Config.add_client方法的具体用法?Python Config.add_client怎么用?Python Config.add_client使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在echomesh.base.Config的用法示例。


在下文中一共展示了Config.add_client方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get

# 需要导入模块: from echomesh.base import Config [as 别名]
# 或者: from echomesh.base.Config import add_client [as 别名]
 def get(self, *path):
   Config.add_client(self)
   with self.lock:
     value = self.clients.get(path)
     if not value:
       value = Units.convert(Config.get(*path))
       self.clients[path] = value
     return value
开发者ID:dasbavaria,项目名称:echomesh,代码行数:10,代码来源:UnitConfig.py

示例2: __init__

# 需要导入模块: from echomesh.base import Config [as 别名]
# 或者: from echomesh.base.Config import add_client [as 别名]
 def __init__(self, instance, peers, config_name):
   super(PeerSocketBase, self).__init__()
   self.instance = instance
   self.peers = peers
   self.config_name = config_name
   self.add_slave(self.peers)
   self.port = -1
   self.socket = None
   Config.add_client(self)
开发者ID:dasbavaria,项目名称:echomesh,代码行数:11,代码来源:PeerSocket.py

示例3: __init__

# 需要导入模块: from echomesh.base import Config [as 别名]
# 或者: from echomesh.base.Config import add_client [as 别名]
 def __init__(self):
   # TODO: the idea of not calling super.__init__ here is a hack - come up
   # with a better way.
   LOGGER.vdebug('Creating ClientServer')
   ClientServer.INSTANCE = self
   self.process = None
   self.constructed = False
   Config.add_client(self)
   Quit.register_atexit(self.kill)
开发者ID:florian-f,项目名称:echomesh,代码行数:11,代码来源:ClientServer.py

示例4: __init__

# 需要导入模块: from echomesh.base import Config [as 别名]
# 或者: from echomesh.base.Config import add_client [as 别名]
 def __init__(self, port, bind_port, hostname, socket_type):
   super(Socket, self).__init__()
   self.port = port
   self.bind_port = bind_port
   self.hostname = hostname
   self.socket_type = socket_type
   self.socket = None
   self.buffer = ''
   self.queue = queue.Queue()
   self.max_size = MAX_SIZE
   Config.add_client(self)
开发者ID:florian-f,项目名称:echomesh,代码行数:13,代码来源:Socket.py

示例5: _before_thread_start

# 需要导入模块: from echomesh.base import Config [as 别名]
# 或者: from echomesh.base.Config import add_client [as 别名]
  def _before_thread_start(self):
    self.tk_count = 0
    self.light_count = 0
    self.count_difference = 1
    self.last_get = {}
    self.tkwin = None
    self.count = 0
    self.lights = []

    super(TkLightBank, self)._before_thread_start()
    TkThreadRunner.run()
    Config.add_client(self)
开发者ID:dasbavaria,项目名称:echomesh,代码行数:14,代码来源:TkLightBank.py

示例6: __init__

# 需要导入模块: from echomesh.base import Config [as 别名]
# 或者: from echomesh.base.Config import add_client [as 别名]
  def __init__(self, element,
               level=1, pan=0, loops=1, begin=0.0, end=INF, **kwds):
    super(PyaudioPlayer, self).__init__(name='PyaudioPlayer')
    PlayerSetter.set_player(self, element,
                            level=level, pan=pan, loops=loops, begin=begin, end=end, **kwds)

    if begin > 0.0 or end != INF:
      LOGGER.error('The Python PyaudioPlayer doesn\'t support begin or end')

    from echomesh.sound import SetOutput
    if not SetOutput.OUTPUT_SET:
      SetOutput.set_output()

    try:
      what = sndhdr.what(self._filename)
    except IOError:
      raise Exception('Can\'t open file %s' % self._filename)

    if not what:
      raise Exception(UNKNOWN_FORMAT_ERROR % self._filename)
    filetype = what[0]
    handler = Util.FILE_READERS.get(filetype)
    if not handler:
      LOGGER.error("Can't understand the file type of file %s", self._filename)
      self.pause()
      return

    self._file_stream = handler.open(self._filename, 'rb')
    self._sample_width = self._file_stream.getsampwidth()

    (self._channels, self._sample_width, self._sampling_rate,
     _, _, _) = self._file_stream.getparams()
    self._dtype = Util.numpy_types()[self._sample_width]
    self._request_channels = 2 if self._pan else self._channels
    self._format = Sound.PYAUDIO().get_format_from_width(self._sample_width)
    self._samples_per_frame = self._sample_width * self._channels
    self._loop_number = 0
    Config.add_client(self)
    self.restart_sound()
开发者ID:florian-f,项目名称:echomesh,代码行数:41,代码来源:PyaudioPlayer.py

示例7: __init__

# 需要导入模块: from echomesh.base import Config [as 别名]
# 或者: from echomesh.base.Config import add_client [as 别名]
  def __init__(self, element, level=1, pan=0, loops=1, **kwds):
    super(FilePlayer, self).__init__(name='FilePlayer')
    from echomesh.sound import SetOutput
    if not SetOutput.OUTPUT_SET:
      SetOutput.set_output()

    self.element = element
    self.file = kwds.pop('file')
    if kwds:
      LOGGER.error('Unused keywords %s', kwds)
    self.debug = True
    self.passthrough = (level == 1 and pan == 0)

    self.level = Expression(level, element)
    self.pan = Expression(pan, element)
    self.loops = loops

    filename = Util.DEFAULT_AUDIO_DIRECTORY.expand(self.file)
    filetype = sndhdr.what(filename)[0]
    handler = Util.FILE_READERS.get(filetype)
    if not handler:
      LOGGER.error("Can't understand the file type of file %s", filename)
      self.pause()
      return

    self.file_stream = handler.open(filename, 'rb')
    self.sample_width = self.file_stream.getsampwidth()

    (self.channels, self.sample_width, self.sampling_rate,
     _, _, _) = self.file_stream.getparams()
    self.dtype = Util.numpy_types()[self.sample_width]
    self.request_channels = 2 if self.pan else self.channels
    self.format = Sound.PYAUDIO().get_format_from_width(self.sample_width)
    self.samples_per_frame = self.sample_width * self.channels
    self.loop_number = 0
    Config.add_client(self)
    self.restart_sound()
开发者ID:dasbavaria,项目名称:echomesh,代码行数:39,代码来源:FilePlayer.py

示例8: __init__

# 需要导入模块: from echomesh.base import Config [as 别名]
# 或者: from echomesh.base.Config import add_client [as 别名]
  def __init__(self):
    super(Display, self).__init__()
    self.timeout = DEFAULT_TIMEOUT
    if not Config.get('load_module', 'pi3d'):
      self.display = None
      return

    keywords = {}

    background = Config.get('pi3d', 'background')
    if background:
      keywords.update(background=background)

    dimensions = Config.get('pi3d', 'dimensions')
    if dimensions:
      x, y, width, height = dimensions
      keywords.update(x=x, y=y, width=width, height=height)

    for k in ['aspect', 'depth', 'far', 'near', 'tk', 'window_title']:
      keywords[k] = Config.get('pi3d', k)

    self.display = pi3d.Display.create(**keywords)
    Config.add_client(self)
    Shader.SHADER()  # Make sure that the shader is created in the main thread!
开发者ID:dasbavaria,项目名称:echomesh,代码行数:26,代码来源:Display.py

示例9: _before_thread_start

# 需要导入模块: from echomesh.base import Config [as 别名]
# 或者: from echomesh.base.Config import add_client [as 别名]
 def _before_thread_start(self):
   self._next_time = time.time()
   Config.add_client(self)
开发者ID:dasbavaria,项目名称:echomesh,代码行数:5,代码来源:LightBank.py

示例10: __init__

# 需要导入模块: from echomesh.base import Config [as 别名]
# 或者: from echomesh.base.Config import add_client [as 别名]
 def __init__(self):
   ClientServer.INSTANCE = self
   self.process = None
   self.constructed = False
   Config.add_client(self)
   Quit.register(self.kill)
开发者ID:dasbavaria,项目名称:echomesh,代码行数:8,代码来源:ClientServer.py

示例11: instance

# 需要导入模块: from echomesh.base import Config [as 别名]
# 或者: from echomesh.base.Config import add_client [as 别名]
def instance():
  if not Aliases.INSTANCE:
    Aliases.INSTANCE = Aliases()
    Config.add_client(Aliases.INSTANCE)

  return Aliases.DICT
开发者ID:dasbavaria,项目名称:echomesh,代码行数:8,代码来源:Aliases.py

示例12: __init__

# 需要导入模块: from echomesh.base import Config [as 别名]
# 或者: from echomesh.base.Config import add_client [as 别名]
 def __init__(self):
   Config.add_client(self)
开发者ID:florian-f,项目名称:echomesh,代码行数:4,代码来源:Aliases.py

示例13: __init__

# 需要导入模块: from echomesh.base import Config [as 别名]
# 或者: from echomesh.base.Config import add_client [as 别名]
 def __init__(self):
   self.clients = {}
   self.lock = Lock.Lock()
   Config.add_client(self)
开发者ID:florian-f,项目名称:echomesh,代码行数:6,代码来源:UnitConfig.py

示例14: get

# 需要导入模块: from echomesh.base import Config [as 别名]
# 或者: from echomesh.base.Config import add_client [as 别名]
      self.kwds[u'filename'] = self.filename
    else:
      self.kwds[u'stream'] = sys.stdout

    self.kwds[u'format'] = (get and get('logging', 'format')) or (
      FILE_FORMAT if self.filename else
      DEBUG_FORMAT if self.debug
      else DEFAULT_FORMAT)

    logging.basicConfig(**self.kwds)


CONFIG = ConfigSetter()
try:
  from echomesh.base import Config
  Config.add_client(CONFIG)
except:
  CONFIG.config_update(None)


def logger(name=None):
  assert name
  log = logging.getLogger(name or 'echomesh')
  original_error_logger = log.error

  def new_error_logger(*args, **kwds):
    limit = kwds.pop('limit', None)
    every = kwds.pop('every', None)
    raw = kwds.pop('raw', None)

    if limit is not None or limit is not None:
开发者ID:dasbavaria,项目名称:echomesh,代码行数:33,代码来源:Log.py

示例15: __init__

# 需要导入模块: from echomesh.base import Config [as 别名]
# 或者: from echomesh.base.Config import add_client [as 别名]
 def __init__(self, *sockets):
   super(SelectLoop, self).__init__(name='SelectLoop')
   self.sockets = dict((s.socket, s) for s in sockets)
   Config.add_client(self)
开发者ID:florian-f,项目名称:echomesh,代码行数:6,代码来源:SelectLoop.py


注:本文中的echomesh.base.Config.add_client方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。