Commit 992f561e authored by Dan Pascu's avatar Dan Pascu

Post the session creation notifications after instantiation only

parent 97aa8903
...@@ -411,7 +411,21 @@ class SessionItemsDescriptor(object): ...@@ -411,7 +411,21 @@ class SessionItemsDescriptor(object):
raise AttributeError("Attribute cannot be deleted") raise AttributeError("Attribute cannot be deleted")
class BlinkSession(object): class BlinkSessionType(type):
def __call__(cls, *args, **kw):
instance = super(BlinkSessionType, cls).__call__(*args, **kw)
instance.__establish__()
return instance
class BlinkSessionBase(object):
__metaclass__ = BlinkSessionType
def __establish__(self):
pass
class BlinkSession(BlinkSessionBase):
implements(IObserver) implements(IObserver)
streams = StreamListDescriptor() streams = StreamListDescriptor()
...@@ -419,6 +433,8 @@ class BlinkSession(object): ...@@ -419,6 +433,8 @@ class BlinkSession(object):
def __init__(self): def __init__(self):
self._initialize() self._initialize()
def __establish__(self):
notification_center = NotificationCenter() notification_center = NotificationCenter()
notification_center.post_notification('BlinkSessionWasCreated', sender=self) notification_center.post_notification('BlinkSessionWasCreated', sender=self)
...@@ -3514,7 +3530,7 @@ class FileSizeFormatter(object): ...@@ -3514,7 +3530,7 @@ class FileSizeFormatter(object):
return "%d bytes" % size return "%d bytes" % size
class BlinkFileTransfer(object): class BlinkFileTransfer(BlinkSessionBase):
implements(IObserver) implements(IObserver)
def __init__(self): def __init__(self):
...@@ -3535,6 +3551,7 @@ class BlinkFileTransfer(object): ...@@ -3535,6 +3551,7 @@ class BlinkFileTransfer(object):
self._uri = None self._uri = None
self._stat = None self._stat = None
def __establish__(self):
notification_center = NotificationCenter() notification_center = NotificationCenter()
notification_center.post_notification('BlinkFileTransferWasCreated', sender=self) notification_center.post_notification('BlinkFileTransferWasCreated', sender=self)
......
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