FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Python-Funscript-Editor/funscript_editor/utils/watchdog.py at main · feilong123/Python-Funscript-Editor · GitHub
feilong123
Python-Funscript-Editor
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Python-Funscript-Editor
/
funscript_editor
/
utils
/
watchdog.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
25 lines (20 loc) · 704 Bytes
Breadcrumbs
Python-Funscript-Editor
/
funscript_editor
/
utils
/
watchdog.py
Copy path
File metadata and controls
25 lines (20 loc) · 704 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from
threading
import
Timer
class
Watchdog
(
Exception
):
def
__init__
(
self
,
timeout_in_seconds
,
userHandler
=
None
):
self
.
timeout
=
timeout_in_seconds
self
.
handler
=
userHandler
if
userHandler
is
not
None
else
self
.
defaultHandler
self
.
timer
=
Timer
(
self
.
timeout
,
self
.
handler
)
self
.
started
=
False
def
start
(
self
):
if
not
self
.
started
:
self
.
started
=
True
self
.
timer
.
start
()
def
trigger
(
self
):
self
.
timer
.
cancel
()
self
.
timer
=
Timer
(
self
.
timeout
,
self
.
handler
)
self
.
timer
.
start
()
def
stop
(
self
):
try
:
self
.
timer
.
cancel
()
except
:
pass
def
defaultHandler
(
self
):
raise
self
Back
|
FazBrowse Home
|
New Git URL