From 1d86e54e3944af434c4c15a746d4e6092c18fd07 Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 1 Oct 2019 11:36:28 +0100 Subject: [PATCH] Plot update now works properly. Logging level changed to display when the listen function connects successfully and receives VOEvents. --- GWalarm_screens.kv | 4 ++++ GWalarm_screens.py | 32 ++++++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/GWalarm_screens.kv b/GWalarm_screens.kv index 6c0b647..2d47192 100644 --- a/GWalarm_screens.kv +++ b/GWalarm_screens.kv @@ -1165,6 +1165,7 @@ rows:2 padding:15,1 AsyncImage: + id:image source:root.imsource size_hint_y:0.8 ScrollView: @@ -1259,12 +1260,15 @@ direction:'right' size_hint_y:0.8 PlotContainer: + id:img1 imsource:root.imgsources[0] desc:root.descs[0] PlotContainer: + id:img2 imsource:root.imgsources[1] desc:root.descs[1] PlotContainer: + id:img3 imsource:root.imgsources[2] desc:root.descs[2] diff --git a/GWalarm_screens.py b/GWalarm_screens.py index 3394b64..5fd1455 100644 --- a/GWalarm_screens.py +++ b/GWalarm_screens.py @@ -18,6 +18,7 @@ Config.set('kivy','default_font',[ import threading import time +import socket from kivy.app import App from kivy.uix.button import Button from kivy.uix.gridlayout import GridLayout @@ -57,7 +58,6 @@ import math import scipy.constants import calendar - '''CHECK IF ON RASPBERRY PI FOR GPIO FUNCTIONALITY''' if os.uname()[4][:3] == 'arm': Config.set('graphics','borderless',1) @@ -268,7 +268,7 @@ class EventInfoHeader(GridLayout): renderthreads = [] def render_audio(token,num): - print(token) +# print(token) tts=gTTS(token) tts.save('readout'+num+'.mp3') @@ -337,7 +337,19 @@ class HistoryScreenv2(Screen): break def receive(): - gcn.listen(host="68.169.57.253",handler=process_gcn) + hostnames=["209.208.78.170 Atlantic_2","45.58.43.186 Atlantic_3","50.116.49.68 Linode", "68.169.57.253 eApps"] + i=0 + import logging + log = logging.getLogger('gcn.listener') + handle = logging.StreamHandler() + handle.setLevel(logging.INFO) + log.addHandler(handle) + log.setLevel(10) + try: + print('Connecting to '+hostnames[i].split()[1]+'...') + gcn.listen(host=hostnames[i].split()[0],handler=process_gcn,log=log) + except socket.timeout: + print('stopped') t4 = threading.Thread(target=receive,daemon=True,name='gcnthread') t4.start() @@ -763,6 +775,8 @@ def plotupdate(obj): global main_flag main_flag=0 while True: + print('Plot updating...') + if os.path.basename(os.getcwd()) != 'event_data': try: os.chdir("./event_data") @@ -870,7 +884,13 @@ def plotupdate(obj): obj.imgsources = paths obj.descs = descripts - waittime=3600 + + #Reload the images + for child in obj.ids: + if 'img' in str(child): + getattr(obj.ids,child).ids.image.reload() + + waittime=360 i=0 while i < waittime: if main_flag == 1: @@ -1097,7 +1117,7 @@ class MainScreenv2(Screen): def notif_off(self): self.notif_light_var = 0 - print(self.notif_light_current) +# print(self.notif_light_current) if pixels: type_notif(self.notif_light_current) @@ -1147,7 +1167,7 @@ class MainScreenv2(Screen): tokens=[InitialToken,EventTypeToken,FalseAlarmToken,DistanceLookBackToken] renderthreads = [] def render_audio(token,num): - print(token) +# print(token) tts=gTTS(token) tts.save('readout'+num+'.mp3') -- GitLab