start work on log support
This commit is contained in:
@@ -41,11 +41,21 @@ class Application(QtWidgets.QMainWindow, MainWindow):
|
|||||||
if url.isLocalFile():
|
if url.isLocalFile():
|
||||||
if url.toLocalFile().endswith(".json"):
|
if url.toLocalFile().endswith(".json"):
|
||||||
self.data_source.setText(url.toLocalFile())
|
self.data_source.setText(url.toLocalFile())
|
||||||
|
elif url.toLocalFile().endswith(".log"):
|
||||||
|
msg = QtWidgets.QMessageBox()
|
||||||
|
msg.setIcon(QtWidgets.QMessageBox.Icon.Information)
|
||||||
|
msg.setText("Not yet supported") #TODO add support for log files
|
||||||
|
msg.setWindowTitle("Parse Log File?")
|
||||||
|
msg.exec()
|
||||||
|
# if msg.clickedButton().text() == "Yes":
|
||||||
|
# self.data_source.setText(url.toLocalFile())
|
||||||
|
# else:
|
||||||
|
# continue
|
||||||
else:
|
else:
|
||||||
# Show error message in dialog
|
# Show error message in dialog
|
||||||
msg = QtWidgets.QMessageBox()
|
msg = QtWidgets.QMessageBox()
|
||||||
msg.setIcon(QtWidgets.QMessageBox.Icon.Warning)
|
msg.setIcon(QtWidgets.QMessageBox.Icon.Warning)
|
||||||
msg.setText("Only JSON files are supported")
|
msg.setText("Only JSON and log files are supported")
|
||||||
msg.setWindowTitle("Error")
|
msg.setWindowTitle("Error")
|
||||||
msg.exec()
|
msg.exec()
|
||||||
|
|
||||||
@@ -134,7 +144,7 @@ class Application(QtWidgets.QMainWindow, MainWindow):
|
|||||||
data = self.dataTable.item(self.dataTable.currentRow(), 2).text()
|
data = self.dataTable.item(self.dataTable.currentRow(), 2).text()
|
||||||
# convert data to dict
|
# convert data to dict
|
||||||
data = ast.literal_eval(data)
|
data = ast.literal_eval(data)
|
||||||
labels[sensor] = alias
|
labels[sensor] = alias if alias else sensor
|
||||||
graph_data = {
|
graph_data = {
|
||||||
alias if alias else sensor: {"x": data["x"], "y": data["y"]}
|
alias if alias else sensor: {"x": data["x"], "y": data["y"]}
|
||||||
}
|
}
|
||||||
@@ -158,7 +168,7 @@ class Application(QtWidgets.QMainWindow, MainWindow):
|
|||||||
row_data = {
|
row_data = {
|
||||||
alias if alias else sensor: {"x": data["x"], "y": data["y"]}
|
alias if alias else sensor: {"x": data["x"], "y": data["y"]}
|
||||||
}
|
}
|
||||||
labels[sensor] = alias
|
labels[sensor] = alias if alias else sensor
|
||||||
graph_data.append(row_data)
|
graph_data.append(row_data)
|
||||||
#replace the keys from self.sensor_data with the alias from labels
|
#replace the keys from self.sensor_data with the alias from labels
|
||||||
print(labels)
|
print(labels)
|
||||||
|
|||||||
Reference in New Issue
Block a user