本文整理汇总了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
示例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)
示例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)
示例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)
示例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)
示例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()
示例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()
示例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!
示例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)
示例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)
示例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
示例12: __init__
# 需要导入模块: from echomesh.base import Config [as 别名]
# 或者: from echomesh.base.Config import add_client [as 别名]
def __init__(self):
Config.add_client(self)
示例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)
示例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:
示例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)