Skip to content

Commit 2281acd

Browse files
优化python例子
1 parent e95cbb5 commit 2281acd

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

samples/python/wxwork.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,27 +55,30 @@ class CallbackHandler:
5555

5656
def CONNECT_CALLBACK(in_class=False):
5757
def decorator(f):
58-
wraps(f)
59-
f._wx_connect_handled = True
60-
if not in_class:
58+
wraps(f)
59+
if in_class:
60+
f._wx_connect_handled = True
61+
else:
6162
_GLOBAL_CONNECT_CALLBACK_LIST.append(f)
6263
return f
6364
return decorator
6465

6566
def RECV_CALLBACK(in_class=False):
6667
def decorator(f):
6768
wraps(f)
68-
f._wx_recv_handled = True
69-
if not in_class:
70-
_GLOBAL_RECV_CALLBACK_LIST.append(f)
69+
if in_class:
70+
f._wx_recv_handled = True
71+
else:
72+
_GLOBAL_RECV_CALLBACK_LIST.append(f)
7173
return f
7274
return decorator
7375

7476
def CLOSE_CALLBACK(in_class=False):
7577
def decorator(f):
76-
wraps(f)
77-
f._wx_close_handled = True
78-
if not in_class:
78+
wraps(f)
79+
if in_class:
80+
f._wx_close_handled = True
81+
else:
7982
_GLOBAL_CLOSE_CALLBACK_LIST.append(f)
8083
return f
8184
return decorator

0 commit comments

Comments
 (0)