Skip to content

Commit

Permalink
select last row inserted
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienPeillet committed Aug 20, 2024
1 parent 521bac5 commit a5ce9e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/gui/attribute_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,19 @@ def refresh(

view = table.findChild(QTableView, "mTableView")
view.resizeColumnsToContents()
if layerName.casefold() in [
SIGHTINGS_TABLE,
FOLLOWERS_TABLE,
]:
if layerName.casefold() == SIGHTINGS_TABLE:
for i in range(view.model().columnCount()):
if view.model().headerData(i, 1) == "species":
index = view.model().index(0, i)
elif layerName.casefold() == ENVIRONMENT_TABLE:
for i in range(view.model().columnCount()):
if view.model().headerData(i, 1) == "routeType":
index = view.model().index(0, i)
elif layerName.casefold() == FOLLOWERS_TABLE:
for i in range(view.model().columnCount()):
if view.model().headerData(i, 1) == "species":
print(view.model().rowCount())
index = view.model().index(view.model().rowCount() - 1, i)

if not focus:
return
Expand Down
2 changes: 1 addition & 1 deletion src/gui/followers.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def refresh(self):
filterExpr = (
f"epoch(\"dateTime\") = epoch(to_datetime('{self.datetime}'))"
)
SammoAttributeTable.refresh(self.table, "Followers", filterExpr)
SammoAttributeTable.refresh(self.table, "Followers", filterExpr, True)

def eventFilter(self, obj, event):
if type(event) is QKeyEvent:
Expand Down

0 comments on commit a5ce9e5

Please sign in to comment.