# timestamps=[self.table_widget.item(row,0).text() for row in range(self.table_widget.rowCount())] #exportation des données dans le tableau pour en faire des graphes
# humidity=[self.table_widget.item(row,1).text() for row in range(self.table_widget.rowCount())]
super(GraphWindow,self).__init__()#config de la nouvelle fenetre
self.setWindowTitle("Graphs Window")
self.setGeometry(200,200,1000,1000)
central_widget=QWidget()
self.setCentralWidget(central_widget)
Vlayout=QVBoxLayout(central_widget)
#Config lien vers Grafana
self.link_label=QLabel('<a href="http://localhost:3000/d/cdfk1ap9jf8jkb/monitoring?orgId=1&refresh=5s&from=1710346802826&to=1710346822354">Lien vers les graphes</a>')
self.link_label.setOpenExternalLinks(True)#permet d'ouvrir le lien dans le navigateur
influx_query=f"SELECT RTC, System_temperature, Outside_temperature, Humidity, Luminosity FROM {influxdb_measurement} WHERE Photo =1"#requete influxdb pour avoir les données quand photo=1
defsavePictures(self):#Fonction pour sauvegarder les images+données
file_path,_=QFileDialog.getSaveFileName(self,"Save the picture","","HTML File (*.html)")# boite de dialogue
iffile_path:
document=self.data_textbox.document()
html_writer=QTextDocumentWriter(file_path)
success=html_writer.write(document)
ifsuccess:
msg=QMessageBox()
msg.setWindowTitle('Success')
msg.setText('Picture and data have been saved successfully.')
msg.exec_()
else:
msg=QMessageBox()
msg.setWindowTitle('Fail')
msg.setText('Saving process failed, retry the operation. Be certain that the name you chose is like "name.html".')
msg.exec_()
classDangerWindow(QMainWindow):
def__init__(self):
super(DangerWindow,self).__init__()#config de la nouvelle fenetre
self.setWindowTitle("What to do in case of danger")
self.setGeometry(200,200,250,250)
central_widget=QWidget()
self.setCentralWidget(central_widget)
Vlayout=QVBoxLayout(central_widget)
paragraph_mouv="""
<h1>Movement alert</h1>
<p>The system has moved over the limit. The pictures angle might be abnormal. You need to go to the system, collect the pictures SD card, and reset the system.</p>
<h1>Temperature alert</h1>
<p>The system's temperature exceeded the threshold, if the problem is persistent (3 alerts), you will need to check the system's functionning by collecting the pictures and data SD cards</p>