- if not selection.path_is_selected(path):
- # Undo the user's changing of the selection
- selection.select_path(path)
+ if not self._treeView.get_selection().path_is_selected(path):
+ self._treeView.get_selection().select_path(path)
+
+ def _scroll_to_row(self):
+ if self._isDestroyed:
+ return
+ rowIndex = self._get_current_row()
+ if rowIndex < 0:
+ return
+
+ path = (rowIndex, )
+ self._treeView.scroll_to_cell(path)
+
+ treeViewHeight = self._treeView.get_allocation().height
+ viewportHeight = self._viewport.get_allocation().height
+
+ viewsPerPort = treeViewHeight / float(viewportHeight)
+ maxRows = len(self._programmingModel)
+ percentThrough = rowIndex / float(maxRows)
+ dxByIndex = int(viewsPerPort * percentThrough * viewportHeight)
+
+ dxMax = max(treeViewHeight - viewportHeight, 0)
+
+ dx = min(dxByIndex, dxMax)
+ adjustment = self._treeScroller.get_vadjustment()
+ adjustment.value = dx