-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MLV] Add switching to first/last widget in viewport
- Loading branch information
1 parent
3a53708
commit e0c049e
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,8 @@ def __init__(self): | |
self.uiAction_goToRow.triggered.connect(self.openGoToRowWidget) | ||
self.uiAction_firstRow.triggered.connect(self.goToFirstRow) | ||
self.uiAction_lastRow.triggered.connect(self.goToLastRow) | ||
self.uiAction_firstRowInViewport.triggered.connect(self.goToFirstRowInViewport) | ||
self.uiAction_lastRowInViewport.triggered.connect(self.goToLastRowInViewport) | ||
|
||
self.uiWidget_listView.doubleClicked.connect(self.inspectLine) | ||
self.uiWidget_listView.clicked.connect(self.listViewClicked) | ||
|
@@ -124,6 +126,8 @@ def toggleUiItems(self): | |
self.uiSpinBox_goToRow.setEnabled(self.file != None) | ||
self.uiCombobox_searchInput.setEnabled(self.file != None) | ||
self.uiCombobox_filterInput.setEnabled(self.file != None) | ||
self.uiAction_lastRowInViewport.setEnabled(self.file != None) | ||
self.uiAction_firstRowInViewport.setEnabled(self.file != None) | ||
|
||
def export(self): | ||
if self.rawlog: | ||
|
@@ -628,6 +632,32 @@ def goToLastRow(self, *args): | |
self.uiWidget_listView.setCurrentRow(index) | ||
self.statusbar.showDynamicText(str("Done ✓ | Switched to last row: %d" % index)) | ||
break | ||
|
||
@catch_exceptions(logger=logger) | ||
def goToFirstRowInViewport(self, *args): | ||
lastIndex = self.uiWidget_listView.selectedIndexes()[0].row() | ||
This comment has been minimized.
Sorry, something went wrong. |
||
# Counts backwards from the current entry | ||
for index in range(self.uiWidget_listView.selectedIndexes()[0].row(), -1, -1): | ||
# The entry height is added to the Y position of the entry to see if that line is still in the viewport | ||
if self.uiWidget_listView.visualItemRect(self.rawlog[index]["uiItem"]).height() + self.uiWidget_listView.visualItemRect(self.rawlog[index]["uiItem"]).y() < 0: | ||
self.uiWidget_listView.setCurrentRow(lastIndex) | ||
self.statusbar.showDynamicText(str("Done ✓ | Switched to the first line in the viewport: %d" % lastIndex)) | ||
break | ||
else: | ||
lastIndex = index | ||
This comment has been minimized.
Sorry, something went wrong.
tmolitor-stud-tu
Member
|
||
|
||
@catch_exceptions(logger=logger) | ||
def goToLastRowInViewport(self, *args): | ||
lastIndex = self.uiWidget_listView.selectedIndexes()[0].row() | ||
This comment has been minimized.
Sorry, something went wrong. |
||
# Counts upwards from the current entry | ||
for index in range(self.uiWidget_listView.selectedIndexes()[0].row(), 32): | ||
# If the item position is larger than the listview-height, it must be the last one in our viewport | ||
if self.uiWidget_listView.visualItemRect(self.rawlog[index]["uiItem"]).y() > self.uiWidget_listView.height(): | ||
self.uiWidget_listView.setCurrentRow(lastIndex) | ||
self.statusbar.showDynamicText(str("Done ✓ | Switched to the last line in the viewport: %d" % lastIndex)) | ||
break | ||
else: | ||
lastIndex = index | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
def cancelFilter(self): | ||
for index in range(len(self.rawlog)): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
should be named
currentIndex