mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Timeseries: fix problem with copy/paste data in timeseries for the date mode
This commit is contained in:
1 parent
2d2f83436c
commit
8d2c18b6af
7 files changed
+44
-33
No files matched your search
@@ -531,7 +531,7 @@ class BoundaryConditionAdisTS(SQLSubModel):
|
|||||||
new_0 = self._types[0](data[0].replace(",", "."))
|
new_0 = self._types[0](data[0].replace(",", "."))
|
||||||
new_1 = self._types[1](data[1].replace(",", "."))
|
new_1 = self._types[1](data[1].replace(",", "."))
|
||||||
|
|
||||||
return (new_0, new_1)
|
return Data(new_0, new_1, types=self._types, status=self._status)
|
||||||
|
|
||||||
def add(self, index: int):
|
def add(self, index: int):
|
||||||
value = Data(
|
value = Data(
|
||||||
@@ -543,6 +543,9 @@ class BoundaryConditionAdisTS(SQLSubModel):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
def insert(self, index: int, value):
|
def insert(self, index: int, value):
|
||||||
|
if value in self._data:
|
||||||
|
value.set_as_not_deleted()
|
||||||
|
else:
|
||||||
self._data.insert(index, value)
|
self._data.insert(index, value)
|
||||||
self.modified()
|
self.modified()
|
||||||
|
|
||||||
|
|||||||
@@ -419,7 +419,7 @@ class BoundaryConditionTemperature(SQLSubModel):
|
|||||||
new_0 = self._types[0](data[0].replace(",", "."))
|
new_0 = self._types[0](data[0].replace(",", "."))
|
||||||
new_1 = self._types[1](data[1].replace(",", "."))
|
new_1 = self._types[1](data[1].replace(",", "."))
|
||||||
|
|
||||||
return (new_0, new_1)
|
return Data(new_0, new_1, types=self._types, status=self._status)
|
||||||
|
|
||||||
def add(self, index: int):
|
def add(self, index: int):
|
||||||
value = Data(
|
value = Data(
|
||||||
@@ -431,6 +431,9 @@ class BoundaryConditionTemperature(SQLSubModel):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
def insert(self, index: int, value):
|
def insert(self, index: int, value):
|
||||||
|
if value in self._data:
|
||||||
|
value.set_as_not_deleted()
|
||||||
|
else:
|
||||||
self._data.insert(index, value)
|
self._data.insert(index, value)
|
||||||
self.modified()
|
self.modified()
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ from datetime import date, time, datetime, timedelta
|
|||||||
from tools import (
|
from tools import (
|
||||||
trace, timer,
|
trace, timer,
|
||||||
timestamp_to_old_pamhyr_date,
|
timestamp_to_old_pamhyr_date,
|
||||||
old_pamhyr_date_to_timestamp, format_datetime
|
old_pamhyr_date_to_timestamp, format_datetime, parse_datetime
|
||||||
)
|
)
|
||||||
|
|
||||||
from View.Tools.PamhyrTable import PamhyrTableModel
|
from View.Tools.PamhyrTable import PamhyrTableModel
|
||||||
@@ -238,17 +238,18 @@ class TableModel(PamhyrTableModel):
|
|||||||
if len(data) == 0:
|
if len(data) == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
rows = [self._data.new_from_data(header, d) for d in data]
|
||||||
|
except (ValueError, TypeError, IndexError) as error:
|
||||||
|
logger.warning(error)
|
||||||
|
return False
|
||||||
|
|
||||||
self.layoutAboutToBeChanged.emit()
|
self.layoutAboutToBeChanged.emit()
|
||||||
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
PasteCommand(
|
PasteCommand(
|
||||||
self._data, row,
|
self._data, row,
|
||||||
list(
|
rows
|
||||||
map(
|
|
||||||
lambda d: self._data.new_from_data(header, d),
|
|
||||||
data
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -169,17 +169,18 @@ class TableModel(PamhyrTableModel):
|
|||||||
if len(data) == 0:
|
if len(data) == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
rows = [self._data.new_from_data(header, d) for d in data]
|
||||||
|
except (ValueError, TypeError, IndexError) as error:
|
||||||
|
logger.warning(error)
|
||||||
|
return False
|
||||||
|
|
||||||
self.layoutAboutToBeChanged.emit()
|
self.layoutAboutToBeChanged.emit()
|
||||||
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
PasteCommand(
|
PasteCommand(
|
||||||
self._data, row,
|
self._data, row,
|
||||||
list(
|
rows
|
||||||
map(
|
|
||||||
lambda d: self._data.new_from_data(header, d),
|
|
||||||
data
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -169,17 +169,18 @@ class TableModel(PamhyrTableModel):
|
|||||||
if len(data) == 0:
|
if len(data) == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
rows = [self._data.new_from_data(header, d) for d in data]
|
||||||
|
except (ValueError, TypeError, IndexError) as error:
|
||||||
|
logger.warning(error)
|
||||||
|
return False
|
||||||
|
|
||||||
self.layoutAboutToBeChanged.emit()
|
self.layoutAboutToBeChanged.emit()
|
||||||
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
PasteCommand(
|
PasteCommand(
|
||||||
self._data, row,
|
self._data, row,
|
||||||
list(
|
rows
|
||||||
map(
|
|
||||||
lambda d: self._data.new_from_data(header, d),
|
|
||||||
data
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -184,17 +184,18 @@ class TableModel(PamhyrTableModel):
|
|||||||
if len(data) == 0:
|
if len(data) == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
rows = [self._data.new_from_data(header, d) for d in data]
|
||||||
|
except (ValueError, TypeError, IndexError) as error:
|
||||||
|
logger.warning(error)
|
||||||
|
return False
|
||||||
|
|
||||||
self.layoutAboutToBeChanged.emit()
|
self.layoutAboutToBeChanged.emit()
|
||||||
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
PasteCommand(
|
PasteCommand(
|
||||||
self._data, row,
|
self._data, row,
|
||||||
list(
|
rows
|
||||||
map(
|
|
||||||
lambda d: self._data.new_from_data(header, d),
|
|
||||||
data
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -175,17 +175,18 @@ class TableModel(PamhyrTableModel):
|
|||||||
if len(data) == 0:
|
if len(data) == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
rows = [self._data.new_from_data(header, d) for d in data]
|
||||||
|
except (ValueError, TypeError, IndexError) as error:
|
||||||
|
logger.warning(error)
|
||||||
|
return False
|
||||||
|
|
||||||
self.layoutAboutToBeChanged.emit()
|
self.layoutAboutToBeChanged.emit()
|
||||||
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
PasteCommand(
|
PasteCommand(
|
||||||
self._data, row,
|
self._data, row,
|
||||||
list(
|
rows
|
||||||
map(
|
|
||||||
lambda d: self._data.new_from_data(header, d),
|
|
||||||
data
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user