start work on log support
This commit is contained in:
@@ -41,11 +41,21 @@ class Application(QtWidgets.QMainWindow, MainWindow):
|
||||
if url.isLocalFile():
|
||||
if url.toLocalFile().endswith(".json"):
|
||||
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:
|
||||
# Show error message in dialog
|
||||
msg = QtWidgets.QMessageBox()
|
||||
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.exec()
|
||||
|
||||
@@ -134,7 +144,7 @@ class Application(QtWidgets.QMainWindow, MainWindow):
|
||||
data = self.dataTable.item(self.dataTable.currentRow(), 2).text()
|
||||
# convert data to dict
|
||||
data = ast.literal_eval(data)
|
||||
labels[sensor] = alias
|
||||
labels[sensor] = alias if alias else sensor
|
||||
graph_data = {
|
||||
alias if alias else sensor: {"x": data["x"], "y": data["y"]}
|
||||
}
|
||||
@@ -158,7 +168,7 @@ class Application(QtWidgets.QMainWindow, MainWindow):
|
||||
row_data = {
|
||||
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)
|
||||
#replace the keys from self.sensor_data with the alias from labels
|
||||
print(labels)
|
||||
|
||||
Reference in New Issue
Block a user