File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -243,22 +243,21 @@ def __init__(self, *args):
243
243
DeprecationWarning )
244
244
self .callbacks = dict ()
245
245
self ._cid = 0
246
- self ._func_cid_map = WeakKeyDictionary ()
246
+ self ._func_cid_map = {}
247
247
248
248
def connect (self , s , func ):
249
249
"""
250
250
register *func* to be called when a signal *s* is generated
251
251
func will be called
252
252
"""
253
- if func in self ._func_cid_map :
254
- cid = self ._func_cid_map [func ]
255
- else :
256
- self ._cid += 1
257
- cid = self ._cid
258
- self ._func_cid_map [func ] = cid
253
+ self ._func_cid_map .setdefault (s , WeakKeyDictionary ())
254
+ if func in self ._func_cid_map [s ]:
255
+ return self ._func_cid_map [s ][func ]
256
+
257
+ self ._cid += 1
258
+ cid = self ._cid
259
+ self ._func_cid_map [s ][func ] = cid
259
260
self .callbacks .setdefault (s , dict ())
260
- if cid in self .callbacks [s ]:
261
- return cid
262
261
proxy = self .BoundMethodProxy (func )
263
262
self .callbacks [s ][cid ] = proxy
264
263
return cid
@@ -272,6 +271,8 @@ def disconnect(self, cid):
272
271
del callbackd [cid ]
273
272
except KeyError :
274
273
continue
274
+ else :
275
+ return
275
276
276
277
def process (self , s , * args , ** kwargs ):
277
278
"""
You can’t perform that action at this time.
0 commit comments