本文整理汇总了Python中signals.emit函数的典型用法代码示例。如果您正苦于以下问题:Python emit函数的具体用法?Python emit怎么用?Python emit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了emit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: on_xmms_playlist_changed
def on_xmms_playlist_changed(self, pls, type, id, pos, newpos):
if pos is None and \
type in (xmmsclient.PLAYLIST_CHANGED_ADD,
xmmsclient.PLAYLIST_CHANGED_MOVE,
xmmsclient.PLAYLIST_CHANGED_REMOVE):
self._reload()
signals.emit('need-redraw')
开发者ID:GunioRobot,项目名称:ccx2,代码行数:7,代码来源:playlist.py
示例2: _loop
def _loop(self):
previous_buffer = ''
while self.connected:
try:
gevent.sleep() # Force a yield. We want to be fair to other connections
newdata = self.socket.recv(512)
lines = (previous_buffer + newdata).split('\r\n')
if not newdata:
# No data returned from recv - assume connection is broken
self.disconnect('Connection reset by peer')
continue
# If newdata cuts off the end of a command, store it and we'll get the rest next time through
if not newdata.endswith('\r\n'):
previous_buffer = lines.pop()
else:
previous_buffer = '' # Clear it out for the next time round
for line in lines:
message = line.strip()
if message == '':
continue # Ignore empty messages
self.raw_logger.debug('<' + message)
signals.emit('server incoming', (self, line))
except socket.error, e:
self.disconnect(e[1]) # Element 1 is the error message
continue
开发者ID:niax,项目名称:NiaxBot,代码行数:27,代码来源:server.py
示例3: pushCommand
def pushCommand( self, cmd, redo = False ):
if not cmd.hasHistory():
return cmd.redo()
if not self.canUndo():
#TODO: Warning about non-undoable action
pass
assert not hasattr( cmd, 'inStack' )
count = len( self.undoStack )
cmd.inStack = True
cmd.merged = False
if count>0:
lastCommand = self.undoStack[ count - 1 ]
if cmd.canMerge( lastCommand ):
cmd.merged = True
if count >= self.stackLimit:
self.undoStack.pop( 0 )
self.undoStack.append( cmd )
if cmd.redo() == False: #failed
self.undoStack.pop()
return False
if not redo:
signals.emit( 'command.new', cmd, self )
self.redoStack = []
else:
signals.emit( 'command.redo', cmd, self )
return True
开发者ID:cloudteampro,项目名称:juma-editor,代码行数:31,代码来源:Command.py
示例4: run
def run( self, **kwargs ):
if not self.initialized:
if not self.init( **kwargs ):
return False
hasError = False
self.resetMainLoopBudget()
try:
signals.emitNow('app.pre_start')
EditorModuleManager.get().startAllModules()
self.getProject().getAssetLibrary().scanProject()
signals.emitNow('app.start')
signals.dispatchAll()
self.saveConfig()
EditorModuleManager.get().tellAllModulesAppReady()
signals.emit('app.ready')
#main loop
while self.running:
self.doMainLoop()
except Exception, e:
#TODO: popup a alert window?
logging.exception( e )
hasError = True
开发者ID:pixpil,项目名称:gii,代码行数:29,代码来源:EditorApp.py
示例5: server_event
def server_event(server, data, prefix):
data = data.strip()
cmd_match = re.match("(?P<command>[^ ]+) (?P<params>.*)", data)
command, params = cmd_match.group('command'), cmd_match.group('params')
params = _process_params(params)
signals.emit('event %s' % command.lower(), (server, params, prefix))
开发者ID:niax,项目名称:NiaxBot,代码行数:7,代码来源:server.py
示例6: _on_collection_changed
def _on_collection_changed(self, r):
if not r.iserror():
v = r.value()
signals.emit('xmms-collection-changed',
v['name'],
v['type'],
v.get('namespace'),
v.get('newname'))
开发者ID:GunioRobot,项目名称:ccx2,代码行数:8,代码来源:xmms.py
示例7: unloadModule
def unloadModule( self, m ):
self.moduleChanged = True
if m.isDependentUnloaded():
signals.emit('module.unload',m)
m.unload()
return True
else:
return False
开发者ID:cloudteampro,项目名称:juma-editor,代码行数:8,代码来源:EditorModule.py
示例8: _on_playlist_changed
def _on_playlist_changed(self, r):
if not r.iserror():
v = r.value()
signals.emit('xmms-playlist-changed',
v['name'],
v['type'],
v.get('id'),
v.get('position'),
v.get('newposition'))
开发者ID:GunioRobot,项目名称:ccx2,代码行数:9,代码来源:xmms.py
示例9: _update
def _update(self):
self.ctx['status'] = HeaderBar.status_desc[self.status]
self.ctx['elapsed'] = util.humanize_time(self.time)
if 'duration' in self.info:
self.ctx['total'] = util.humanize_time(self.info['duration'])
self.text.set_text(self.parser.eval(self.ctx))
self._invalidate()
signals.emit('need-redraw')
开发者ID:GunioRobot,项目名称:ccx2,代码行数:9,代码来源:main.py
示例10: _namelist
def _namelist(self, server, params, prefix):
if server == self.server and params[-2] == self.name: # params[0] is the channel
nicks = [] #TODO: Make this do things
for user in self.namelist_split.finditer(params[-1]):
nick = user.group('nick')
if nick in self.nicks:
continue # Ignore this nick
self.nicks[nick] = Nick(server, nick, mode=user.group('mode'))
signals.emit('channel name reply', (server, self, nicks))
开发者ID:niax,项目名称:NiaxBot,代码行数:9,代码来源:messaging.py
示例11: on_xmms_collection_changed
def on_xmms_collection_changed(self, pls, type, namespace, newname):
if namespace == 'Playlists' and type != xmmsclient.COLLECTION_CHANGED_UPDATE:
if pls == self.cur_active:
self.cur_active = newname
self.clear_attrs()
self._set_active_attr(None, self.cur_active)
signals.emit('need-redraw')
开发者ID:GunioRobot,项目名称:ccx2,代码行数:9,代码来源:playlist.py
示例12: on_medialib_entry_changed
def on_medialib_entry_changed(self, mid):
if mid in self.song_widgets:
del self.song_widgets[mid]
for pos in self.feeder.id_positions(mid):
try:
del self.row_widgets[pos]
except KeyError:
pass
signals.emit('need-redraw')
开发者ID:GunioRobot,项目名称:ccx2,代码行数:9,代码来源:playlist.py
示例13: unregisterModule
def unregisterModule(self, m):
if m.alive:
if m.isDependentUnloaded():
self.moduleChanged = True
m.unload()
del self.modules[m.getName()]
self.moduleQueue.remove(m)
signals.emit( 'module.unregister', m )
else:
return False
开发者ID:cloudteampro,项目名称:juma-editor,代码行数:10,代码来源:EditorModule.py
示例14: run
def run(self):
self.lyrics.set_info("searching...")
signals.emit('need-redraw')
results = lyricwiki.get_google_results(self.query)
if self.abort:
return
self.lyrics.show_results(results)
开发者ID:GunioRobot,项目名称:ccx2,代码行数:10,代码来源:lyrics.py
示例15: queue_current
def queue_current(self):
item = super(AlbumWalker, self)._get_raw(self.focus)
if item is None:
return None
song_id = None
for song in self.mpc.find('artist', self.artist, 'album', item['album']):
sid = self.mpc.addid(song['file'])
if song_id is None:
song_id = sid
signals.emit('user_notification', 'Adding album "%s" - %s' % (item['album'], self.artist))
return song_id
开发者ID:sporkexec,项目名称:urmpc,代码行数:11,代码来源:ui_lists.py
示例16: registerAssetNode
def registerAssetNode( self, node ):
path = node.getNodePath()
logging.info( 'register: %s' % repr(node) )
if self.assetTable.has_key(path):
raise Exception( 'unclean path: %s', path)
self.assetTable[path] = node
signals.emit( 'asset.register', node )
for child in node.getChildren():
self.registerAssetNode(child)
node.restoreMetaData()
return node
开发者ID:tommo,项目名称:gii,代码行数:13,代码来源:asset.py
示例17: undoCommand
def undoCommand( self, popCommandOnly = False ):
count = len( self.undoStack )
if count>0:
cmd = self.undoStack[ count-1 ]
if not popCommandOnly:
if cmd.undo() == False:
return False
self.undoStack.pop()
self.redoStack.append( cmd )
signals.emit( 'command.undo', cmd, self )
if cmd.merged:
return self.undoCommand( popCommandOnly )
else:
return True
return False
开发者ID:cloudteampro,项目名称:juma-editor,代码行数:15,代码来源:Command.py
示例18: main_loop
def main_loop(self):
self.size = self.ui.get_cols_rows()
xmmsfd = self.xs.xmms.get_fd()
stdinfd = sys.stdin.fileno()
while True:
if self.need_redraw:
self.redraw()
input_keys = None
w = self.xs.xmms.want_ioout() and [xmmsfd] or []
try:
(i, o, e) = select.select([xmmsfd, stdinfd, self._pipe[0]], w, [])
except select.error:
i = [xmmsfd, stdinfd]
if not self.xs.connected:
print >> sys.stderr, "disconnected from server"
sys.exit(0) # TODO
for fd in i:
if fd == xmmsfd:
self.xs.ioin()
elif fd == stdinfd:
input_keys = self.ui.get_input()
elif fd == self._pipe[0]:
os.read(self._pipe[0], 1)
if o and o[0] == xmmsfd:
self.xs.ioout()
if not input_keys:
continue
self.statusarea.clear_message()
for k in input_keys:
if self.show_key:
signals.emit('show-message', 'key: %s' % config.urwid_key_to_key(k))
self.show_key = False
continue
try:
if k == 'window resize':
self.size = self.ui.get_cols_rows()
signals.emit('window-resized', self.size)
elif self.view.keypress(self.size, k) is None:
continue
elif self.cm.run_key(k, self.view.body.get_contexts() + [self]):
continue
elif k == ':':
self.show_command_prompt()
else:
signals.emit('show-message', "unbound key: %s" % k, 'error')
except commands.CommandError, e:
signals.emit('show-message', "command error: %s" % e, 'error')
开发者ID:GunioRobot,项目名称:ccx2,代码行数:58,代码来源:main.py
示例19: show_results
def show_results(self, results):
try:
self.lock.acquire()
if self.widget_list[-1] != self.rlb:
self.widget_list[-1] = self.rlb
self.set_focus(self.rlb)
if results:
self.rlb.set_rows([widgets.LyricResultWidget(r[0], r[1]) for r in results])
self.set_info()
else:
self.set_info("no results found :/")
self._invalidate()
signals.emit('need-redraw')
finally:
self.lock.release()
开发者ID:GunioRobot,项目名称:ccx2,代码行数:18,代码来源:lyrics.py
示例20: cmd_save
def cmd_save(self, args):
# TODO: playlists and playlist types/options
args = args.strip()
if not args:
raise commands.CommandError, 'need some args'
name = args
q = self.input.edit_text
if q and not coll_parser_pattern_rx.search(q):
q = ' '.join(['~'+s for s in q.split()])
try:
c = coll.coll_parse(q)
except ValueError:
raise commands.CommandError, 'invalid collection'
self.xs.coll_save(c, name, 'Collections', sync=False)
signals.emit('show-message',
"saved collection %s with pattern %s" % (name, q))
开发者ID:GunioRobot,项目名称:ccx2,代码行数:19,代码来源:search.py
注:本文中的signals.emit函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论