master
Theophile Terraz 2025-09-23 14:55:31 +02:00
parent 80ae4c36ad
commit e7b63fe270
3 changed files with 17 additions and 6 deletions

View File

@ -227,7 +227,10 @@ class TableModel(PamhyrTableModel):
line.startswith("*") or
line.startswith("$")):
line = line.split()
data0.append(float(line[0]) * mult)
if bctype == "ZD":
data0.append(float(line[0]))
else:
data0.append(old_pamhyr_date_to_timestamp(line[0]))
data1.append(line[1])
self.replace_data(data0, data1)

View File

@ -19,7 +19,7 @@
import logging
import traceback
from tools import trace, timer
from tools import trace, timer, old_pamhyr_date_to_timestamp
from PyQt5.QtCore import (
Qt, QVariant, QAbstractTableModel,
@ -310,12 +310,17 @@ class TableModel(PamhyrTableModel):
if line[0] == "$":
current_reach = int(line[1]) - 1
if (current_reach <= len(self._data.enable_edges()) and
current_reach > 0) :
current_reach >= 0) :
data.append([self._data.enable_edges()[current_reach], float(line[2]), float(line[3])])
else:
if (current_reach <= len(self._data.enable_edges()) and
current_reach > 0) :
data[-1].append([float(line[0]), float(line[1])])
current_reach >= 0) :
data[-1].append(
[
old_pamhyr_date_to_timestamp(line[0]),
float(line[1])
]
)
self.layoutAboutToBeChanged.emit()

View File

@ -260,7 +260,10 @@ def date_dmy_to_timestamp(date: str):
def old_pamhyr_date_to_timestamp(date: str):
v = date.split(":")
if len(v) != 4:
return 0
if len(v) == 1: # minutes
return int(float(v[0]) * 60) # Minute to sec
else:
return 0
m = [
(24 * 60 * 60), # Day to sec