def deactivate(self):
        super(StatusIconPlugin, self).deactivate()

        graph.unregister_provider(TrayIcon)
        disconnect_events(self.menu)

        self.hide()
Example #2
0
    def deactivate(self):
        super(StatusIconPlugin, self).deactivate()

        graph.unregister_provider(TrayIcon)
        disconnect_events(self.menu)

        self.hide()
Example #3
0
    def test_should_not_call_menu_after_deactivate(self, trayicon_menu):
        assert len(Events.View.receivers) == 0

        connect_events(trayicon_menu)

        assert len(Events.View.receivers) == 2

        disconnect_events(trayicon_menu)

        result = Events.View.send(State.hid)

        assert len(result) == 0
Example #4
0
    def test_should_not_call_menu_after_deactivate(self, trayicon_menu):
        assert len(Events.View.receivers) == 0
        Events.View.receivers.clear()

        connect_events(trayicon_menu)

        assert len(Events.View.receivers) == 2

        disconnect_events(trayicon_menu)

        result = Events.View.send(State.hid)

        assert len(result) == 0
Example #5
0
def test_should_disconnect_bind_events(mocker):
    mock_event_a = mocker.Mock()
    mock_event_b = mocker.Mock()

    class Subject(Subscriber):
        @on(mock_event_a, [State.finished, State.stopped])
        @on(mock_event_b, [State.changed])
        def bar(self, sender):
            return sender

    subject = Subject()

    disconnect_events(subject)

    mock_event_a.disconnect.assert_any_call(subject.bar, sender=State.finished)
    mock_event_a.disconnect.assert_any_call(subject.bar, sender=State.stopped)
    mock_event_b.disconnect.assert_called_with(subject.bar,
                                               sender=State.changed)