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
| def etat():
tmps.sleep(0.5)
while not dict_thread['End'].is_set():
try:
dict_global['r_ip'] = requests.get(f'{(maj_IP()[1])}LinkState', timeout=2)
dict_global['r'] = requests.get(f'{(maj_IP()[1])}TransportCommand', timeout=2)
dict_global['r_value'] = dict_global['r'].json().get('value')
tmps.sleep(0.2)
root.after(0,lambda:dict_ig['l_ip'].configure(image=dict_ig['photo_VOYANT_V']))
dict_global['AJA_linked'] = True
except requests.exceptions.RequestException:
root.after(0,lambda:dict_ig['l_ip'].configure(image=dict_ig['photo_VOYANT_R']))
dict_global['AJA_linked'] = False
if dict_global['r_value'] == '3' and dict_global['heure_SET']== False and dict_global['AJA_linked'] == True :
root.after(0,lambda:dict_ig['b_record'].config(image=dict_ig['photo_STOP'], text='Stop', command=lambda: stop()))
elif dict_global['r_value'] == '4' and dict_global['heure_SET']== False and dict_global['AJA_linked'] == True:
root.after(0,lambda:dict_ig['b_record'].config(image=dict_ig['photo_REC'], text='Record', command=lambda: record()))
elif dict_global['r_value'] == '3' and dict_global['heure_SET']== True and dict_global['AJA_linked'] == True:
root.after(0,lambda:dict_ig['b_record'].config(image=dict_ig['photo_REC_GRIS'], text='Stop\n'f"{dict_global['heure']}:{dict_global['minutes']}", command=lambda: stop()))
elif dict_global['r_value'] == '4' and dict_global['heure_SET']== True and dict_global['AJA_linked'] == True:
root.after(0,lambda:dict_ig['b_record'].config(image=dict_ig['photo_STOP_GRIS'], text='Record\n'f"{dict_global['heure']}:{dict_global['minutes']}", command=lambda: record()))
elif dict_global['r_value'] == '3' and dict_global['heure_SET']== False and dict_global['AJA_linked'] == False :
root.after(0,lambda:dict_ig['b_record'].config(image=dict_ig['photo_REC'], text='Record', command=lambda: record()))
elif dict_global['r_value'] == '4' and dict_global['heure_SET']== False and dict_global['AJA_linked'] == False :
root.after(0,lambda:dict_ig['b_record'].config(image=dict_ig['photo_REC'], text='Record', command=lambda: record()))
else:
pass |
Partager