File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -264,21 +264,24 @@ def __init__(self, *args):
264264 DeprecationWarning )
265265 self .callbacks = dict ()
266266 self ._cid = 0
267- self ._func_cid_map = WeakKeyDictionary ()
267+ self ._func_cid_map = {}
268268
269269 def connect (self , s , func ):
270270 """
271271 register *func* to be called when a signal *s* is generated
272272 func will be called
273273 """
274- if func in self ._func_cid_map :
275- return self ._func_cid_map [func ]
276- proxy = self .BoundMethodProxy (func )
274+ self ._func_cid_map .setdefault (s , WeakKeyDictionary ())
275+ if func in self ._func_cid_map [s ]:
276+ return self ._func_cid_map [s ][func ]
277+
277278 self ._cid += 1
279+ cid = self ._cid
280+ self ._func_cid_map [s ][func ] = cid
278281 self .callbacks .setdefault (s , dict ())
279- self . callbacks [ s ][ self . _cid ] = proxy
280- self ._func_cid_map [ func ] = self . _cid
281- return self . _cid
282+ proxy = self . BoundMethodProxy ( func )
283+ self .callbacks [ s ][ cid ] = proxy
284+ return cid
282285
283286 def disconnect (self , cid ):
284287 """
You can’t perform that action at this time.
0 commit comments