mirror of https://gitlab.com/pamhyr/pamhyr2
Compare commits
2 Commits
e7b63fe270
...
7d42c164fc
| Author | SHA1 | Date |
|---|---|---|
|
|
7d42c164fc | |
|
|
1b2f98494b |
|
|
@ -277,18 +277,19 @@ class SedimentLayer(SQLSubModel):
|
||||||
"FROM sedimentary_layer "
|
"FROM sedimentary_layer "
|
||||||
)
|
)
|
||||||
|
|
||||||
for row in table:
|
if table is not None:
|
||||||
sl = cls(
|
for row in table:
|
||||||
id=row[0],
|
sl = cls(
|
||||||
name=row[1],
|
id=row[0],
|
||||||
comment=row[2],
|
name=row[1],
|
||||||
status=data['status']
|
comment=row[2],
|
||||||
)
|
status=data['status']
|
||||||
|
)
|
||||||
|
|
||||||
data["sl"] = sl.id
|
data["sl"] = sl.id
|
||||||
sl._layers = Layer._db_load(execute, data)
|
sl._layers = Layer._db_load(execute, data)
|
||||||
|
|
||||||
new.append(sl)
|
new.append(sl)
|
||||||
|
|
||||||
return new
|
return new
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -310,11 +310,16 @@ class TableModel(PamhyrTableModel):
|
||||||
if line[0] == "$":
|
if line[0] == "$":
|
||||||
current_reach = int(line[1]) - 1
|
current_reach = int(line[1]) - 1
|
||||||
if (current_reach <= len(self._data.enable_edges()) and
|
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])])
|
data.append(
|
||||||
|
[self._data.enable_edges()[current_reach],
|
||||||
|
float(line[2]),
|
||||||
|
float(line[3])
|
||||||
|
]
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
if (current_reach <= len(self._data.enable_edges()) and
|
if (current_reach <= len(self._data.enable_edges()) and
|
||||||
current_reach >= 0) :
|
current_reach >= 0):
|
||||||
data[-1].append(
|
data[-1].append(
|
||||||
[
|
[
|
||||||
old_pamhyr_date_to_timestamp(line[0]),
|
old_pamhyr_date_to_timestamp(line[0]),
|
||||||
|
|
|
||||||
|
|
@ -256,7 +256,7 @@ class ImportCommand(QUndoCommand):
|
||||||
|
|
||||||
def redo(self):
|
def redo(self):
|
||||||
self._lcs.delete_i(self._tab, self._old_rows)
|
self._lcs.delete_i(self._tab, self._old_rows)
|
||||||
if self._new_lc == None:
|
if self._new_lc is None:
|
||||||
self._new_lc = []
|
self._new_lc = []
|
||||||
for row, data in enumerate(self._data):
|
for row, data in enumerate(self._data):
|
||||||
new = LateralContrib(status=self._lcs._status)
|
new = LateralContrib(status=self._lcs._status)
|
||||||
|
|
@ -270,6 +270,7 @@ class ImportCommand(QUndoCommand):
|
||||||
for row, el in enumerate(self._new_lc):
|
for row, el in enumerate(self._new_lc):
|
||||||
self._lcs.insert(self._tab, row, el)
|
self._lcs.insert(self._tab, row, el)
|
||||||
|
|
||||||
|
|
||||||
class DuplicateCommand(QUndoCommand):
|
class DuplicateCommand(QUndoCommand):
|
||||||
def __init__(self, lcs, tab, rows, lc):
|
def __init__(self, lcs, tab, rows, lc):
|
||||||
QUndoCommand.__init__(self)
|
QUndoCommand.__init__(self)
|
||||||
|
|
|
||||||
|
|
@ -494,7 +494,7 @@ class ResultsWindow(PamhyrWindow):
|
||||||
table = self.find(QTableView, f"tableView_profile")
|
table = self.find(QTableView, f"tableView_profile")
|
||||||
indexes = table.selectedIndexes()
|
indexes = table.selectedIndexes()
|
||||||
if len(indexes) == 0:
|
if len(indexes) == 0:
|
||||||
return 0
|
return []
|
||||||
|
|
||||||
return [i.row() for i in indexes]
|
return [i.row() for i in indexes]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -260,8 +260,8 @@ def date_dmy_to_timestamp(date: str):
|
||||||
def old_pamhyr_date_to_timestamp(date: str):
|
def old_pamhyr_date_to_timestamp(date: str):
|
||||||
v = date.split(":")
|
v = date.split(":")
|
||||||
if len(v) != 4:
|
if len(v) != 4:
|
||||||
if len(v) == 1: # minutes
|
if len(v) == 1: # minutes
|
||||||
return int(float(v[0]) * 60) # Minute to sec
|
return int(float(v[0]) * 60) # Minute to sec
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue