From dff3b19c296ed40b43f5cfe07d01f98fa43811bb Mon Sep 17 00:00:00 2001 From: Chris PeBenito Date: Tue, 17 May 2016 07:14:33 -0400 Subject: [PATCH] ExcludeTypes: Keep the current scroll location when lists change. Previously, when including or excluding a type, the lists would reset to the top. Now the current scroll location is preserved while updating the lists. Closes #124 --- setoolsgui/apol/excludetypes.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/setoolsgui/apol/excludetypes.py b/setoolsgui/apol/excludetypes.py index d7a8125..3314bbc 100644 --- a/setoolsgui/apol/excludetypes.py +++ b/setoolsgui/apol/excludetypes.py @@ -69,6 +69,9 @@ class ExcludeTypes(SEToolsWidget, QDialog): self.attr.currentIndexChanged.connect(self.set_attr_filter) def include_clicked(self): + included_scroll_pos = self.included_types.verticalScrollBar().value() + excluded_scroll_pos = self.excluded_types.verticalScrollBar().value() + selected_types = [] for index in self.excluded_types.selectionModel().selectedIndexes(): source_index = self.excluded_sort.mapToSource(index) @@ -81,7 +84,13 @@ class ExcludeTypes(SEToolsWidget, QDialog): for item in selected_types: self.excluded_model.remove(item) + self.included_types.verticalScrollBar().setValue(included_scroll_pos) + self.excluded_types.verticalScrollBar().setValue(excluded_scroll_pos) + def exclude_clicked(self): + included_scroll_pos = self.included_types.verticalScrollBar().value() + excluded_scroll_pos = self.excluded_types.verticalScrollBar().value() + selected_types = [] for index in self.included_types.selectionModel().selectedIndexes(): source_index = self.included_sort.mapToSource(index) @@ -94,6 +103,9 @@ class ExcludeTypes(SEToolsWidget, QDialog): for item in selected_types: self.included_model.remove(item) + self.included_types.verticalScrollBar().setValue(included_scroll_pos) + self.excluded_types.verticalScrollBar().setValue(excluded_scroll_pos) + def set_attr_filter(self, row): index = self.attr_model.index(row) attr = self.attr_model.data(index, Qt.UserRole)