File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,6 @@ def start_monitor(
61
61
if not self ._is_active ():
62
62
# If SmartPause is already started, do not start it again
63
63
self ._set_active (True )
64
- utility .start_thread (self ._start_idle_monitor )
65
64
utility .start_thread (
66
65
self ._start_idle_monitor ,
67
66
on_idle = on_idle ,
Original file line number Diff line number Diff line change @@ -95,18 +95,29 @@ def get_resource_path(resource_name):
95
95
return resource_location
96
96
97
97
98
- def start_thread (target_function , ** args ):
98
+ P1 = typing .ParamSpec ("P1" )
99
+
100
+
101
+ def start_thread (
102
+ target_function : typing .Callable [P1 , None ], * args : P1 .args , ** kwargs : P1 .kwargs
103
+ ) -> None :
99
104
"""Execute the function in a separate thread."""
100
105
thread = threading .Thread (
101
106
target = target_function ,
102
107
name = f"WorkThread { target_function .__qualname__ } " ,
103
108
daemon = False ,
104
- kwargs = args ,
109
+ args = args ,
110
+ kwargs = kwargs ,
105
111
)
106
112
thread .start ()
107
113
108
114
109
- def execute_main_thread (target_function , * args , ** kwargs ):
115
+ P2 = typing .ParamSpec ("P2" )
116
+
117
+
118
+ def execute_main_thread (
119
+ target_function : typing .Callable [P2 , None ], * args : P2 .args , ** kwargs : P2 .kwargs
120
+ ) -> None :
110
121
"""Execute the given function in main thread."""
111
122
GLib .idle_add (lambda : target_function (* args , ** kwargs ))
112
123
You can’t perform that action at this time.
0 commit comments