-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.py
More file actions
36 lines (30 loc) · 924 Bytes
/
common.py
File metadata and controls
36 lines (30 loc) · 924 Bytes
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
26
27
28
29
30
31
32
33
34
35
36
import time
def set_ind_red(widget):
if widget.styleSheet() != "background: \"red\";":
widget.setStyleSheet("background: \"red\";")
widget.update()
def set_ind_yellow(widget):
if widget.styleSheet() != "background: \"yellow\";":
widget.setStyleSheet("background: \"yellow\";")
widget.update()
def set_ind_green(widget):
if widget.styleSheet() != "background: \"lightgreen\";":
widget.setStyleSheet("background: \"lightgreen\";")
widget.update()
def set_ind_condition(ind, cond):
if cond:
set_ind_green(ind)
else:
set_ind_red(ind)
def set_ind_threeway(ind, cond1, cond2):
if cond1:
if cond2:
set_ind_green(ind)
else:
set_ind_yellow(ind)
else:
set_ind_red(ind)
def thread_delta_sleep(before, window):
delta = time.time() - before
if delta < window:
time.sleep(window - delta)