本文整理汇总了Python中signals.emit函数的典型用法代码示例。如果您正苦于以下问题:Python emit函数的具体用法?Python emit怎么用?Python emit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了emit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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')
示例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
示例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
示例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
示例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))
示例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'))
示例7: unloadModule
def unloadModule( self, m ):
self.moduleChanged = True
if m.isDependentUnloaded():
signals.emit('module.unload',m)
m.unload()
return True
else:
return False
示例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'))
示例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')
示例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))
示例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')
示例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')
示例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
示例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)
示例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