Closed multiSnow closed 3 years ago
I've been trying to solve this issue for a while now as well, but no luck. Does this approach work?
Yes, and I am already using it.
The 'scroll to selection' used to be done in '_apply_sort_function', but the 'sorting' is done in '_generate_sort_data'. The '_flush_queue', '_update_item_details_by_name' and '_update_item_attributes_by_name' are all using '_generate_sort_data' but not '_apply_sort_function', so scrolling not work.
This PR simply move the 'scroll to selection' operation from '_apply_sort_function' to '_generate_sort_data', so that 'scrolling' will be always done together with 'sorting'.
Yes it's a clever fix, I am just wondering if it works. I tried similar approaches and added scroll_to_cell
and similar calls but nothing worked for some reason.
Since https://github.com/MeanEYE/Sunflower/commit/43d93a9beac236d5a6c43bfb1de0b62b697b0a8f, individual sorting method is used instead of 'Gtk.TreeSortable.set_sort_func'. It means that pygi/gtk does not manage the scrolling after sorting, so that the selected item may scrolled out of the 'view part' (e.g. large numbers of items add and sorted before the selected item).
This PR try to fix this problem by doing scroll after each sorting operation.