Commit 097bed52 authored by Adrian Georgescu's avatar Adrian Georgescu

Replace implements with @implementer(IObserver) decorator

parent 99c35027
......@@ -10,7 +10,7 @@ from application.notification import IObserver, NotificationCenter, Notification
from application.python import Null
from application.system import host, makedirs
from eventlib import api
from zope.interface import implements
from zope.interface import implementer
from sipsimple.account import Account, AccountManager, BonjourAccount
from sipsimple.addressbook import Contact, Group
......@@ -88,8 +88,8 @@ class IPAddressMonitor(object):
self.greenlet = None
@implementer(IObserver)
class Blink(QApplication, metaclass=QSingleton):
implements(IObserver)
def __init__(self):
super(Blink, self).__init__(sys.argv)
......
......@@ -20,7 +20,7 @@ from application.system import makedirs
from collections import defaultdict
from gnutls.crypto import X509Certificate, X509PrivateKey
from gnutls.errors import GNUTLSError
from zope.interface import implements
from zope.interface import implementer
from sipsimple.account import Account, AccountManager, BonjourAccount
from sipsimple.configuration import DuplicateIDError
......@@ -92,8 +92,8 @@ class AccountInfo(object):
return not self.__eq__(other)
@implementer(IObserver)
class AccountModel(QAbstractListModel):
implements(IObserver)
def __init__(self, parent=None):
super(AccountModel, self).__init__(parent)
......@@ -199,8 +199,8 @@ class ActiveAccountModel(QSortFilterProxyModel):
return account_info.account.enabled
@implementer(IObserver)
class AccountSelector(QComboBox):
implements(IObserver)
def __init__(self, parent=None):
super(AccountSelector, self).__init__(parent)
......@@ -234,8 +234,8 @@ class AccountSelector(QComboBox):
ui_class, base_class = uic.loadUiType(Resources.get('add_account.ui'))
@implementer(IObserver)
class AddAccountDialog(base_class, ui_class, metaclass=QSingleton):
implements(IObserver)
def __init__(self, parent=None):
super(AddAccountDialog, self).__init__(parent)
......@@ -561,8 +561,8 @@ class ServerToolsAccountModel(QSortFilterProxyModel):
return bool(account_info.account is not BonjourAccount() and account_info.account.enabled and account_info.account.server.settings_url)
@implementer(IObserver)
class ServerToolsWebView(QWebView):
implements(IObserver)
def __init__(self, parent=None):
super(ServerToolsWebView, self).__init__(parent)
......@@ -668,8 +668,8 @@ class ServerToolsWebView(QWebView):
ui_class, base_class = uic.loadUiType(Resources.get('server_tools.ui'))
@implementer(IObserver)
class ServerToolsWindow(base_class, ui_class, metaclass=QSingleton):
implements(IObserver)
def __init__(self, model, parent=None):
super(ServerToolsWindow, self).__init__(parent)
......
import locale
import os
import re
......@@ -25,7 +23,7 @@ from itertools import count
from lxml import etree, html
from lxml.html.clean import autolink
from weakref import proxy
from zope.interface import implements
from zope.interface import implementer
from sipsimple.account import AccountManager
from sipsimple.application import SIPApplication
......@@ -617,8 +615,8 @@ class FileDescriptor(object):
ui_class, base_class = uic.loadUiType(Resources.get('chat_widget.ui'))
@implementer(IObserver)
class ChatWidget(base_class, ui_class):
implements(IObserver)
default_user_icon = IconDescriptor(Resources.get('icons/default-avatar.png'))
......@@ -880,8 +878,8 @@ class VideoToolButton(QToolButton):
ui_class, base_class = uic.loadUiType(Resources.get('video_widget.ui'))
@implementer(IObserver)
class VideoWidget(VideoSurface, ui_class):
implements(IObserver)
def __init__(self, session_item, parent=None):
super(VideoWidget, self).__init__(parent)
......@@ -1428,8 +1426,8 @@ class NoSessionsLabel(QLabel):
ui_class, base_class = uic.loadUiType(Resources.get('chat_window.ui'))
@implementer(IObserver)
class ChatWindow(base_class, ui_class, ColorHelperMixin):
implements(IObserver)
sliding_panels = True
......
......@@ -33,7 +33,7 @@ from oauth2client.client import OAuth2WebServerFlow, AccessTokenRefreshError
from oauth2client.file import Storage
from operator import attrgetter
from threading import Event
from zope.interface import implements
from zope.interface import implementer
from sipsimple import addressbook
from sipsimple.account import AccountManager, BonjourAccount
......@@ -55,8 +55,8 @@ from blink.widgets.util import ContextMenuActions
__all__ = ['Group', 'Contact', 'ContactModel', 'ContactSearchModel', 'ContactListView', 'ContactSearchListView', 'ContactEditorDialog', 'URIUtils']
@implementer(IObserver)
class VirtualGroupManager(object, metaclass=Singleton):
implements(IObserver)
__groups__ = []
......@@ -183,8 +183,8 @@ class AllContactsList(object):
__hash__ = None
@implementer(IObserver)
class AllContactsGroup(VirtualGroup):
implements(IObserver)
__id__ = 'all_contacts'
......@@ -349,8 +349,8 @@ class BonjourNeighboursList(object):
return self._contact_map.pop(contact.id, None)
@implementer(IObserver)
class BonjourNeighboursManager(object, metaclass=Singleton):
implements(IObserver)
contacts = WriteOnceAttribute()
......@@ -399,8 +399,8 @@ class BonjourNeighboursManager(object, metaclass=Singleton):
notification.center.post_notification('BonjourNeighboursManagerDidUpdateContact', sender=self, data=NotificationData(contact=contact))
@implementer(IObserver)
class BonjourNeighboursGroup(VirtualGroup):
implements(IObserver)
__id__ = 'bonjour_neighbours'
......@@ -775,8 +775,8 @@ class GoogleAuthorization(object):
notification_center.post_notification('GoogleAuthorizationWasRejected', sender=self)
@implementer(IObserver)
class GoogleContactsManager(object, metaclass=Singleton):
implements(IObserver)
def __init__(self):
self.contacts = GoogleContactsList()
......@@ -972,8 +972,8 @@ class GoogleContactsManager(object, metaclass=Singleton):
self._stop()
@implementer(IObserver)
class GoogleContactsGroup(VirtualGroup):
implements(IObserver)
__id__ = 'google_contacts'
......@@ -1077,8 +1077,8 @@ class RelocationInfo(object):
self.successor = successor
@implementer(IObserver)
class Group(object):
implements(IObserver)
size_hint = QSize(200, 18)
......@@ -1201,8 +1201,8 @@ class ContactIconDescriptor(object):
raise AttributeError("attribute cannot be deleted")
@implementer(IObserver)
class Contact(object):
implements(IObserver)
size_hint = QSize(200, 36)
......@@ -1379,8 +1379,8 @@ class Contact(object):
notification.center.post_notification('BlinkContactDidChange', sender=self)
@implementer(IObserver)
class ContactDetail(object):
implements(IObserver)
size_hint = QSize(200, 36)
......@@ -1535,8 +1535,8 @@ class ContactDetail(object):
notification.center.post_notification('BlinkContactDetailDidChange', sender=self)
@implementer(IObserver)
class ContactURI(object):
implements(IObserver)
size_hint = QSize(200, 24)
......@@ -2246,8 +2246,8 @@ class ItemList(list):
self.__groupmap__.pop(item.settings, None)
@implementer(IObserver)
class ContactModel(QAbstractListModel):
implements(IObserver)
itemsAdded = pyqtSignal(list)
itemsRemoved = pyqtSignal(list)
......@@ -2905,8 +2905,8 @@ class ContactSearchModel(QSortFilterProxyModel):
return True
@implementer(IObserver)
class ContactDetailModel(QAbstractListModel):
implements(IObserver)
contactDeleted = pyqtSignal()
......@@ -3089,8 +3089,8 @@ class ContactDetailModel(QAbstractListModel):
self.dataChanged.emit(index, index)
@implementer(IObserver)
class ContactListView(QListView):
implements(IObserver)
def __init__(self, parent=None):
super(ContactListView, self).__init__(parent)
......@@ -3561,8 +3561,8 @@ class ContactListView(QListView):
self.actions.transfer_call.setEnabled(contact.uri is not None and active_session is not None and active_session.state == 'connected')
@implementer(IObserver)
class ContactSearchListView(QListView):
implements(IObserver)
def __init__(self, parent=None):
super(ContactSearchListView, self).__init__(parent)
......@@ -3897,8 +3897,8 @@ class ContactSearchListView(QListView):
self.actions.transfer_call.setEnabled(contact.uri is not None and active_session is not None and active_session.state == 'connected')
@implementer(IObserver)
class ContactDetailView(QListView):
implements(IObserver)
def __init__(self, contact_list):
super(ContactDetailView, self).__init__(contact_list.parent())
......@@ -4539,8 +4539,8 @@ class ContactURITableView(QTableView):
ui_class, base_class = uic.loadUiType(Resources.get('contact_editor.ui'))
@implementer(IObserver)
class ContactEditorDialog(base_class, ui_class):
implements(IObserver)
def __init__(self, parent=None):
super(ContactEditorDialog, self).__init__(parent)
......
......@@ -9,7 +9,7 @@ from PyQt5.QtWidgets import QAction, QMenu
from application.notification import IObserver, NotificationCenter
from application.python import Null
from application.system import makedirs
from zope.interface import implements
from zope.interface import implementer
from blink.configuration.settings import BlinkSettings
from blink.resources import Resources
......@@ -23,8 +23,8 @@ __all__ = ['FileTransferWindow']
ui_class, base_class = uic.loadUiType(Resources.get('filetransfer_window.ui'))
@implementer(IObserver)
class FileTransferWindow(base_class, ui_class):
implements(IObserver)
def __init__(self, parent=None):
super(FileTransferWindow, self).__init__(parent)
......
......@@ -10,7 +10,7 @@ from application.python import Null
from application.python.types import Singleton
from datetime import date
from dateutil.tz import tzlocal
from zope.interface import implements
from zope.interface import implementer
from sipsimple.account import BonjourAccount
from sipsimple.addressbook import AddressbookManager
......@@ -24,8 +24,8 @@ from blink.util import run_in_gui_thread
__all__ = ['HistoryManager']
@implementer(IObserver)
class HistoryManager(object, metaclass=Singleton):
implements(IObserver)
history_size = 20
......
......@@ -12,7 +12,7 @@ from application.python.queue import EventQueue
from application.python import Null
from application.python.types import Singleton
from application.system import makedirs
from zope.interface import implements
from zope.interface import implementer
from sipsimple.configuration.settings import SIPSimpleSettings
......@@ -22,8 +22,8 @@ from blink.resources import ApplicationData
__all__ = ['LogManager']
@implementer(IObserver)
class NotificationQueue(object):
implements(IObserver)
def __init__(self):
self.notifications = deque()
......@@ -70,8 +70,8 @@ class LogFile(object):
file.close()
@implementer(IObserver)
class LogManager(object, metaclass=Singleton):
implements(IObserver)
def __init__(self):
self.name = os.path.basename(sys.argv[0]).rsplit('.py', 1)[0]
......
......@@ -12,7 +12,7 @@ from PyQt5.QtWidgets import QAction, QActionGroup, QApplication, QFileDialog, QM
from application.notification import IObserver, NotificationCenter
from application.python import Null, limit
from application.system import makedirs
from zope.interface import implements
from zope.interface import implementer
from sipsimple.account import Account, AccountManager, BonjourAccount
from sipsimple.application import SIPApplication
......@@ -40,8 +40,8 @@ __all__ = ['MainWindow']
ui_class, base_class = uic.loadUiType(Resources.get('blink.ui'))
@implementer(IObserver)
class MainWindow(base_class, ui_class):
implements(IObserver)
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
......
......@@ -12,7 +12,7 @@ from application.notification import IObserver, NotificationCenter
from application.python import Null, limit
from gnutls.crypto import X509Certificate, X509PrivateKey
from gnutls.errors import GNUTLSError
from zope.interface import implements
from zope.interface import implementer
from sipsimple.account import AccountManager, BonjourAccount
from sipsimple.application import SIPApplication
......@@ -178,8 +178,8 @@ class UnspecifiedMSRPRelay(object):
ui_class, base_class = uic.loadUiType(Resources.get('preferences.ui'))
@implementer(IObserver)
class PreferencesWindow(base_class, ui_class, metaclass=QSingleton):
implements(IObserver)
def __init__(self, account_model, parent=None):
super(PreferencesWindow, self).__init__(parent)
......
......@@ -16,7 +16,7 @@ from eventlib.green import urllib2
from itertools import chain
from twisted.internet import reactor
from twisted.internet.error import ConnectionLost
from zope.interface import implements
from zope.interface import implementer
from sipsimple import addressbook
from sipsimple.account import AccountManager, BonjourAccount
......@@ -150,8 +150,8 @@ class BlinkPresenceState(object):
return doc
@implementer(IObserver)
class PresencePublicationHandler(object):
implements(IObserver)
def __init__(self):
self._should_set_offline_status = set()
......@@ -327,8 +327,8 @@ class ContactIcon(object):
return None
@implementer(IObserver)
class PresenceSubscriptionHandler(object):
implements(IObserver)
sip_prefix_re = re.compile("^sips?:")
......
......@@ -27,7 +27,7 @@ from application.python import Null, limit
from application.python.types import MarkerType, Singleton
from application.python.weakref import weakobjectmap, defaultweakobjectmap
from eventlib.proc import spawn
from zope.interface import implements
from zope.interface import implementer
from sipsimple.account import Account, AccountManager, BonjourAccount
from sipsimple.application import SIPApplication
......@@ -442,8 +442,8 @@ class BlinkSessionBase(object, metaclass=BlinkSessionType):
pass
@implementer(IObserver)
class BlinkSession(BlinkSessionBase):
implements(IObserver)
streams = StreamListDescriptor()
items = SessionItemsDescriptor()
......@@ -1199,8 +1199,8 @@ class SMPVerification(Enum):
Failed = 'Failed'
@implementer(IObserver)
class SMPVerificationHandler(object):
implements(IObserver)
question = 'What is the ZRTP authentication string?'.encode('utf-8')
......@@ -1312,8 +1312,8 @@ class ClientConference(object):
self.audio_conference.unhold()
@implementer(IObserver)
class ConferenceParticipant(object):
implements(IObserver)
def __init__(self, contact, contact_uri):
self.contact = contact
......@@ -1384,8 +1384,8 @@ class ConferenceParticipant(object):
notification.center.post_notification('ConferenceParticipantDidChange', sender=self)
@implementer(IObserver)
class ServerConference(object):
implements(IObserver)
sip_prefix_re = re.compile('^sips?:')
......@@ -1819,8 +1819,8 @@ class DraggedAudioSessionWidget(base_class, ui_class):
del ui_class, base_class
@implementer(IObserver)
class AudioSessionItem(object):
implements(IObserver)
def __init__(self, session):
assert session.items.audio is None
......@@ -2238,8 +2238,8 @@ class AudioSessionDelegate(QStyledItemDelegate):
selection_model.select(model.index(model.sessions.index(session)), selection_model.ClearAndSelect)
@implementer(IObserver)
class AudioSessionModel(QAbstractListModel):
implements(IObserver)
sessionAboutToBeAdded = pyqtSignal(AudioSessionItem)
sessionAboutToBeRemoved = pyqtSignal(AudioSessionItem)
......@@ -2645,8 +2645,8 @@ class AudioSessionModel(QAbstractListModel):
session.widget.mute_button.show()
@implementer(IObserver)
class AudioSessionListView(QListView):
implements(IObserver)
def __init__(self, parent=None):
super(AudioSessionListView, self).__init__(parent)
......@@ -3062,8 +3062,8 @@ class ChatSessionWidget(base_class, ui_class):
del ui_class, base_class
@implementer(IObserver)
class ChatSessionItem(object):
implements(IObserver)
size_hint = QSize(200, 36)
......@@ -3330,8 +3330,8 @@ class ChatSessionDelegate(QStyledItemDelegate, ColorHelperMixin):
return index.data(Qt.SizeHintRole)
@implementer(IObserver)
class ChatSessionModel(QAbstractListModel):
implements(IObserver)
sessionAboutToBeAdded = pyqtSignal(ChatSessionItem)
sessionAboutToBeRemoved = pyqtSignal(ChatSessionItem)
......@@ -3451,8 +3451,8 @@ class ChatSessionModel(QAbstractListModel):
self.sessionRemoved.emit(session)
@implementer(IObserver)
class ChatSessionListView(QListView):
implements(IObserver)
def __init__(self, chat_window):
super(ChatSessionListView, self).__init__(chat_window.session_panel)
......@@ -3800,8 +3800,8 @@ class FileSizeFormatter(object):
return "%d bytes" % size
@implementer(IObserver)
class BlinkFileTransfer(BlinkSessionBase):
implements(IObserver)
def __init__(self):
self.id = None
......@@ -4302,8 +4302,8 @@ class FileTransferItemWidget(base_class, ui_class):
del ui_class, base_class
@implementer(IObserver)
class FileTransferItem(object):
implements(IObserver)
def __init__(self, transfer):
self.transfer = transfer
......@@ -4528,8 +4528,8 @@ class TransferHistory(object):
self._pending_items = items
@implementer(IObserver)
class FileTransferModel(QAbstractListModel):
implements(IObserver)
itemAboutToBeAdded = pyqtSignal(FileTransferItem)
itemAboutToBeRemoved = pyqtSignal(FileTransferItem)
......@@ -4638,8 +4638,8 @@ class ConferenceParticipantWidget(ChatSessionWidget):
self.screen_sharing_icon.setVisible('screen-sharing' in participant.active_media)
@implementer(IObserver)
class ConferenceParticipantItem(object):
implements(IObserver)
size_hint = QSize(200, 36)
......@@ -4783,8 +4783,8 @@ class ConferenceParticipantDelegate(QStyledItemDelegate, ColorHelperMixin):
return index.data(Qt.SizeHintRole)
@implementer(IObserver)
class ConferenceParticipantModel(QAbstractListModel):
implements(IObserver)
participantAboutToBeAdded = pyqtSignal(ConferenceParticipantItem)
participantAboutToBeRemoved = pyqtSignal(ConferenceParticipantItem)
......@@ -5529,8 +5529,8 @@ class RequestList(list):
return [item for item in self if item.session is key]
@implementer(IObserver)
class SessionManager(object, metaclass=Singleton):
implements(IObserver)
class PrimaryRingtone(metaclass=MarkerType): pass
class SecondaryRingtone(metaclass=MarkerType): pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment