Пример #1
0
 def unsubscribe(self, receiver):
     """Stop notifying a receiver about any criteria."""
     for signal in self._criteria_signals.itervalues():
         try:
             louie.disconnect(receiver, signal)
         except louie.error.DispatcherKeyError:
             pass
Пример #2
0
 def _on_active_world_change(self, active_world):
     """Refresh a tree view with the new root element."""
     if active_world!=self._active_world:
         self._active_world = active_world
         model = self.model()
         # disconnect for previous world selection events
         if model is not None and model.metaworld_tree is not None:
             old_world = model.metaworld_tree.world
             louie.disconnect( self._on_selection_change, metaworldui.WorldSelectionChanged,
                               old_world )
         # connect to new world selection events & refresh tree view
         if model is None or active_world is None:
             model.set_metaworld_tree( None )
             #self.clear()
         else:
             model_tree = active_world.find_tree( model.meta_tree )
             if model_tree is not None:
                 louie.connect( self._on_selection_change, metaworldui.WorldSelectionChanged,
                                active_world )
                 model.set_metaworld_tree( model_tree )
                 self._expand_roots()
                 self.resizeColumnToContents(0)
                 self.show()
             else: # the new world has no tree of the type of the view
                 self.hide()
Пример #3
0
    def set_metaworld_tree( self, tree ):
        #assert tree is not None
        #assert tree.meta == self._meta_tree, (tree.meta, self._meta_tree)
        # setup event listener for the tree
# Notes: somehow the tree remain empty if we do not allow setting twice. To investigate...
#        if tree == self._metaworld_tree:
#            return
        if self._metaworld_tree is not None:
            self._metaworld_tree.disconnect_from_element_events( 
                self._onElementAdded, self._onElementUpdated,
                self._onElementAboutToBeRemoved )
            louie.disconnect( self._on_element_issues_updated, 
                              metaworldui.ElementIssuesUpdated,
                              self._metaworld_tree.world )
        self._metaworld_tree = tree
        self._issue_tracker = tree is not None and tree.world or None
        if tree is not None:
            self._metaworld_tree.connect_to_element_events( 
                self._onElementAdded, self._onElementUpdated,
                self._onElementAboutToBeRemoved )
            louie.connect( self._on_element_issues_updated, 
                           metaworldui.ElementIssuesUpdated,
                           self._metaworld_tree.world )
            self._refreshTreeRoot()
        else:
            self.clear()
Пример #4
0
 def cmd_search_delete(self, idOfFilter):
     for sf in self.searchFilters:
         if id(sf) == idOfFilter:
             louie.disconnect(self.onSearchResult, 'search:result', sf)
             sf.cancel()                
             self.searchFilters.remove(sf)
             break
Пример #5
0
    def deactivate(self, shell):
        self.info("Coherence UPnP plugin deactivated")
        if self.coherence is None:
            return

        self.coherence.shutdown()

        try:
            louie.disconnect(self.detected_media_server,
                    'Coherence.UPnP.ControlPoint.MediaServer.detected',
                    louie.Any)
        except louie.error.DispatcherKeyError:
            pass
        try:
            louie.disconnect(self.removed_media_server,
                    'Coherence.UPnP.ControlPoint.MediaServer.removed',
                    louie.Any)
        except louie.error.DispatcherKeyError:
            pass

        del self.shell
        del self.coherence

        for usn, source in self.sources.iteritems():
            source.delete_thyself()
        del self.sources
Пример #6
0
 def test_Exact(self):
     a = Dummy()
     signal = 'this'
     louie.connect(x, signal, a)
     expected = [(x, a)]
     result = louie.send('this', a, a=a)
     assert result == expected, (
         "Send didn't return expected result:\n\texpected:{0}\n\tgot:{1}"
             .format(expected, result))
     louie.disconnect(x, signal, a)
     assert len(list(louie.get_all_receivers(a, signal))) == 0
     self._isclean()
Пример #7
0
 def test_AnonymousSend(self):
     a = Dummy()
     signal = 'this'
     louie.connect(x, signal)
     expected = [(x, a)]
     result = louie.send(signal, None, a=a)
     assert result == expected, (
         "Send didn't return expected result:\n\texpected:%s\n\tgot:%s" %
         (expected, result))
     louie.disconnect(x, signal)
     assert len(list(louie.get_all_receivers(None, signal))) == 0
     self._isclean()
 def test_AnonymousSend(self):
     a = Dummy()
     signal = 'this'
     louie.connect(x, signal)
     expected = [(x, a)]
     result = louie.send(signal, None, a=a)
     assert result == expected, (
         "Send didn't return expected result:\n\texpected:%s\n\tgot:%s"
         % (expected, result))
     louie.disconnect(x, signal)
     assert len(list(louie.get_all_receivers(None, signal))) == 0
     self._isclean()
 def test_AllRegistration(self):
     a = Dummy()
     signal = 'this'
     louie.connect(x, louie.All, a)
     expected = [(x, a)]
     result = louie.send('this', a, a=a)
     assert result == expected, (
         "Send didn't return expected result:\n\texpected:%s\n\tgot:%s"
         % (expected, result))
     louie.disconnect(x, louie.All, a)
     assert len(list(louie.get_all_receivers(a, louie.All))) == 0
     self._isclean()
Пример #10
0
 def _resetPropertyListModel( self, element = None ):
     """Change the element displayed in the property list.
        Subscribe to update event for the element and unsubscribe from the old one.
     """
     self.clear()
     self.setHorizontalHeaderLabels( [self.tr('Name'), self.tr('Value')] )
     if self._element_tree is not None:
         louie.disconnect( self.__on_element_updated, metaworld.AttributeUpdated, 
                           self._element_tree )
         self._element_tree = None
     self._element = element
     if element is not None:
         self._element_tree = element.tree
         louie.connect( self.__on_element_updated, metaworld.AttributeUpdated, 
                        self._element_tree )
Пример #11
0
 def test_AnyRegistration(self):
     a = Dummy()
     signal = 'this'
     louie.connect(x, signal, louie.Any)
     expected = [(x, a)]
     result = louie.send('this', object(), a=a)
     assert result == expected, (
         "Send didn't return expected result:\n\texpected:%s\n\tgot:%s" %
         (expected, result))
     louie.disconnect(x, signal, louie.Any)
     expected = []
     result = louie.send('this', object(), a=a)
     assert result == expected, (
         "Send didn't return expected result:\n\texpected:%s\n\tgot:%s" %
         (expected, result))
     assert len(list(louie.get_all_receivers(louie.Any, signal))) == 0
     self._isclean()
Пример #12
0
 def test_AnyRegistration(self):
     a = Dummy()
     signal = "this"
     louie.connect(x, signal, louie.Any)
     expected = [(x, a)]
     result = louie.send(signal, object(), a=a)
     assert (
         result == expected
     ), f"Send didn't return expected result:\n\texpected:{expected}\n\tgot:{result}"
     louie.disconnect(x, signal, louie.Any)
     expected = []
     result = louie.send(signal, object(), a=a)
     assert (
         result == expected
     ), f"Send didn't return expected result:\n\texpected:{expected}\n\tgot:{result}"
     assert len(list(louie.get_all_receivers(louie.Any, signal))) == 0
     self._isclean()
Пример #13
0
 def _on_active_world_change(self, active_world):
   if self._active_world!=active_world:
     if self._active_world is not None:
         louie.disconnect( self._on_selection_change, metaworldui.WorldSelectionChanged, 
                           self._active_world )
         louie.disconnect( self._on_element_issues_updated, 
                           metaworldui.ElementIssuesUpdated,
                           self._active_world )
     self._active_world = active_world
     if active_world is not None:
         louie.connect( self._on_selection_change, metaworldui.WorldSelectionChanged, 
                        active_world )
         louie.connect( self._on_element_issues_updated, 
                        metaworldui.ElementIssuesUpdated,
                        self._active_world )
         louie.send( metaworldui.WorldSelectionChanged, active_world,
                     active_world.selected_elements,
                     active_world.selected_elements, None )
     else:
         self.clear()
Пример #14
0
 def receiver1():
     if disconnect_receiver1:
         louie.disconnect(receiver1, signal)
     return 1
Пример #15
0
    def connectionLost(self, reason):
        #FIXME: There's got to be a better way than this
        louie.disconnect(self.translator, 'hub:status')
        louie.disconnect(self.translator, 'hub:name')
        louie.disconnect(self.translator, 'hub:global_to')
        louie.disconnect(self.translator, 'hub:to')
        louie.disconnect(self.translator, 'hub:chat_room')
        louie.disconnect(self.translator, 'hub:sent_to')

        louie.disconnect(self.translator, 'hub:user:new')
        louie.disconnect(self.translator, 'hub:user:update')
        louie.disconnect(self.translator, 'hub:user:quit')

        louie.disconnect(self.translator, 'peer:new')
        louie.disconnect(self.translator, 'peer:quit')
        louie.disconnect(self.translator, 'peer:upload:start')
        louie.disconnect(self.translator, 'peer:upload:progress')
        louie.disconnect(self.translator, 'peer:upload:end')
        louie.disconnect(self.translator, 'peer:download:start')
        louie.disconnect(self.translator, 'peer:download:progress')
        louie.disconnect(self.translator, 'peer:download:end')

        louie.disconnect(self.translator, 'share_store:walking')
        louie.disconnect(self.translator, 'share_store:walking:done')
        louie.disconnect(self.translator, 'share_store:hashing')
        louie.disconnect(self.translator, 'share_store:hashed')
        louie.disconnect(self.translator, 'share_store:size')
        louie.disconnect(self.translator, 'share_store:indexer:finished')
Пример #16
0
    def _cleanUp(self):
        louie.disconnect(self.onPeerTransferStart, 'peer:download:start')
        louie.disconnect(self.onPeerTransferStart, 'peer:upload:start')

        louie.disconnect(self.onPeerTransferEnd, 'peer:download:end')
        louie.disconnect(self.onPeerTransferEnd, 'peer:upload:end')
Пример #17
0
 def receiver1():
     if disconnect_receiver1:
         louie.disconnect(receiver1, signal)
     return 1
Пример #18
0
 def disconnect(self, signal, receiver):
     """Reverse of ``connect``."""
     louie.disconnect(receiver, signal, self)
     self.__receivers.remove((receiver, signal))
Пример #19
0
 def stopService(self):
     service.Service.stopService(self)
     louie.disconnect(self.onHubUserNew, 'hub:user:new')
     louie.disconnect(self.onDownloadQueued, 'download:queued')
     louie.disconnect(self.onDownloaderFinished, 'downloader:finished')
     louie.disconnect(self.onDownloaderStatus, 'downloader:status')
     louie.disconnect(self.onPeerIdle, 'peer:idle')
     louie.disconnect(self.onHubConnected, 'hub:connected')
     louie.disconnect(self.onHubQuit, 'hub:quit')
     self.log('stopping addMoreDownloaderCall')
     for dl in self.downloaders.values():
         try:
             dl.cancel()
         except Exception, ee:
             log.err(ee)
Пример #20
0
 def stopService(self):
     louie.disconnect(self.onDownloadFinished, 'download:finished')
     if self.updateSizeDelayedCall and self.updateSizeDelayedCall.active():
         self.updateSizeDelayedCall.cancel()
         self.updateSizeDelayedCall = None
     yield service.Service.stopService(self)
Пример #21
0
    def stopService(self):
        service.Service.stopService(self)
        louie.disconnect(self.onPeerNew, 'peer:new')
        louie.disconnect(self.onPeerQuit, 'peer:quit')

        louie.disconnect(self.onHubUserUpdate, 'hub:user:update')
        louie.disconnect(self.onHubUserQuit, 'hub:user:quit')
        louie.disconnect(self.onSearchResultRaw, 'search:result:raw')
        louie.disconnect(self.onPeerTimeout, 'peer:timeout')
        louie.disconnect(self.onPeerMaxedOut, 'peer:maxed_out')

        for peer, waiting in self._waitingForConnection.items():
            waiting['connectedTimeoutDelayCall'].cancel()
        
        for delayedCall in self._waitingToConnect.values():
            if delayedCall.active(): delayedCall.cancel()
        
        for connection in self.connections:
            connection.transport.loseConnection()
 def killBeforeAfter(self): #{{{
     louie.disconnect(base_before, 'before_after', base_signal)
     louie.disconnect(base_signal, 'before_after', base_signal)
     louie.disconnect(base_after, 'before_after', base_signal)
Пример #23
0
 def _(peer, sent_at, msg):
     louie.disconnect(_, "hub:to")
     self.assertEqual(message, msg)
Пример #24
0
 def cancel(self, deferred=None):
     log.msg('CANCELING %r' % (self,))
     louie.disconnect(self.filter, 'search:result:raw')
     for dd in self.deferreds:
         dd.cancel()
Пример #25
0
 def remove(self, item):
     if item in self.items:
         self.items.remove(item)
         disconnect(self.markdirty, item.changed)
         disconnect(item.mouseclick, self.mouseclick)
         self.needs_update = True