mirror of https://gitlab.com/pamhyr/pamhyr2
BC: Edit: Fix paste command for old pamhyr time format.
parent
7b93f62a64
commit
4039182689
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from tools import trace, timer
|
from tools import trace, timer, old_pamhyr_date_to_timestamp
|
||||||
|
|
||||||
from Model.Except import NotImplementedMethodeError
|
from Model.Except import NotImplementedMethodeError
|
||||||
|
|
||||||
|
|
@ -22,6 +22,13 @@ class BoundaryCondition(object):
|
||||||
def compatibility(cls):
|
def compatibility(cls):
|
||||||
return ["liquid", "solid", "suspenssion"]
|
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
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
return self._name
|
return self._name
|
||||||
|
|
@ -78,9 +85,9 @@ class BoundaryCondition(object):
|
||||||
for j in range(len(header)):
|
for j in range(len(header)):
|
||||||
if self._header[i] == header[j]:
|
if self._header[i] == header[j]:
|
||||||
if i == 0:
|
if i == 0:
|
||||||
new_0 = self._types[i](data[j])
|
new_0 = self._types[i](data[j].replace(",", "."))
|
||||||
else:
|
else:
|
||||||
new_1 = self._types[i](data[j])
|
new_1 = self._types[i](data[j].replace(",", "."))
|
||||||
else:
|
else:
|
||||||
new_0 = self._types[0](data[0])
|
new_0 = self._types[0](data[0])
|
||||||
new_1 = self._types[1](data[1])
|
new_1 = self._types[1](data[1])
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class PonctualContribution(BoundaryCondition):
|
||||||
|
|
||||||
self._type = "PC"
|
self._type = "PC"
|
||||||
self._header = ["time", "debit"]
|
self._header = ["time", "debit"]
|
||||||
self._types = [int, float]
|
self._types = [PonctualContribution.time_convert, float]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def compatibility(cls):
|
def compatibility(cls):
|
||||||
|
|
@ -34,7 +34,7 @@ class TimeOverZ(BoundaryCondition):
|
||||||
|
|
||||||
self._type = "TZ"
|
self._type = "TZ"
|
||||||
self._header = ["time", "z"]
|
self._header = ["time", "z"]
|
||||||
self._types = [int, float]
|
self._types = [TimeOverZ.time_convert, float]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def compatibility(cls):
|
def compatibility(cls):
|
||||||
|
|
@ -46,7 +46,7 @@ class TimeOverDebit(BoundaryCondition):
|
||||||
|
|
||||||
self._type = "TD"
|
self._type = "TD"
|
||||||
self._header = ["time", "debit"]
|
self._header = ["time", "debit"]
|
||||||
self._types = [int, float]
|
self._types = [TimeOverDebit.time_convert, float]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def compatibility(cls):
|
def compatibility(cls):
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ class TableModel(QAbstractTableModel):
|
||||||
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
SortCommand(
|
SortCommand(
|
||||||
self._data, False
|
self._data, _reverse
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue