by
Changes to 2 files · Browse files at df80bd602a1f Showing diff from parent bc508a3590e9 d533e14e006b Diff from another changeset...
@@ -349,8 +349,23 @@ self.expand()
self._pendingReloadModel = False
- def expand(self):
- self.tview.expandToDepth(0)
+ def expand(self, it=None):
+ if not it:
+ self.tview.expandToDepth(0)
+ else:
+ # Create a list of ancestors (including the selected item)
+ from repotreeitem import RepoGroupItem
+ itchain = [it]
+ while(not isinstance(itchain[-1], RepoGroupItem)):
+ itchain.append(itchain[-1].parent())
+
+ # Starting from the topmost ancestor (a root item), expand the
+ # ancestors one by one
+ m = self.tview.model()
+ idx = self.tview.rootIndex()
+ for it in reversed(itchain):
+ idx = m.index(it.row(), 0, idx)
+ self.tview.expand(idx)
def addRepo(self, root):
'workbench has opened a new repowidget, ensure it is in the registry'
@@ -376,6 +391,9 @@ it.setActive(True)
self.tview.dataChanged(QModelIndex(), QModelIndex())
+ # Make sure that the active tab is visible by expanding its parent
+ self.expand(it.parent())
+
def showPaths(self, show):
self.tview.setColumnHidden(1, not show)
self.tview.setHeaderHidden(not show)
|
Loading...