BC: Edit: Fix paste command for old pamhyr time format.

mesh
Pierre-Antoine Rouby 2023-05-10 12:00:35 +02:00
parent 7b93f62a64
commit 4039182689
3 changed files with 14 additions and 7 deletions

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from tools import trace, timer
from tools import trace, timer, old_pamhyr_date_to_timestamp
from Model.Except import NotImplementedMethodeError
@ -22,6 +22,13 @@ class BoundaryCondition(object):
def compatibility(cls):
return ["liquid", "solid", "suspenssion"]
@classmethod
def time_convert(cls, data):
if type(data) == str and data.count(":") == 3:
return old_pamhyr_date_to_timestamp(data)
return int(data)
@property
def name(self):
return self._name
@ -78,9 +85,9 @@ class BoundaryCondition(object):
for j in range(len(header)):
if self._header[i] == header[j]:
if i == 0:
new_0 = self._types[i](data[j])
new_0 = self._types[i](data[j].replace(",", "."))
else:
new_1 = self._types[i](data[j])
new_1 = self._types[i](data[j].replace(",", "."))
else:
new_0 = self._types[0](data[0])
new_1 = self._types[1](data[1])

View File

@ -22,7 +22,7 @@ class PonctualContribution(BoundaryCondition):
self._type = "PC"
self._header = ["time", "debit"]
self._types = [int, float]
self._types = [PonctualContribution.time_convert, float]
@classmethod
def compatibility(cls):
@ -34,7 +34,7 @@ class TimeOverZ(BoundaryCondition):
self._type = "TZ"
self._header = ["time", "z"]
self._types = [int, float]
self._types = [TimeOverZ.time_convert, float]
@classmethod
def compatibility(cls):
@ -46,7 +46,7 @@ class TimeOverDebit(BoundaryCondition):
self._type = "TD"
self._header = ["time", "debit"]
self._types = [int, float]
self._types = [TimeOverDebit.time_convert, float]
@classmethod
def compatibility(cls):

View File

@ -121,7 +121,7 @@ class TableModel(QAbstractTableModel):
self._undo.push(
SortCommand(
self._data, False
self._data, _reverse
)
)