8 import logging |
8 import logging |
9 from threading import Lock |
9 from threading import Lock |
10 |
10 |
11 INACTIVE=0 |
11 INACTIVE=0 |
12 ACTIVE=1 |
12 ACTIVE=1 |
13 ERRORS=2 |
13 OFFLINE=2 |
|
14 ERRORS=3 |
14 |
15 |
15 traynames={INACTIVE: 'B.', ACTIVE: 'B!', ERRORS: 'B?'} |
16 traynames={ |
|
17 INACTIVE: 'B.', |
|
18 ACTIVE: 'B!', |
|
19 OFFLINE: 'B⦙', |
|
20 ERRORS: 'B?' |
|
21 } |
16 |
22 |
17 def combine_state(state1, state2): |
23 def combine_state(state1, state2): |
18 if state1==ERRORS or state2==ERRORS: |
24 return max(state1, state2) |
19 return ERRORS |
|
20 elif state1==ACTIVE or state2==ACTIVE: |
|
21 return ACTIVE |
|
22 else: |
|
23 return INACTIVE |
|
24 |
25 |
25 def make_title(status): |
26 def make_title(status): |
26 state=INACTIVE |
27 state=INACTIVE |
27 |
28 |
28 if status['type']=='scheduled': |
29 if status['type']=='scheduled': |