Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1.2 and tip

stable reporegistry: Make sure that the item corresponding to the active tab is visible

This also modifies the reporegistry.expand() method so that it can receive an
optional repotreeitem that will be expanded. If no item is passed, the behaviour
is the same as before (i.e. the top level items are expanded).

Changeset d533e14e006b

Parent 0b1377c8084f

by Angel Ezquerra

Changes to one file · Browse files at d533e14e006b Showing diff from parent 0b1377c8084f Diff from another changeset...

 
348
349
350
351
352
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
353
354
355
 
375
376
377
 
 
 
378
379
380
 
631
632
633
634
 
635
636
637
 
348
349
350
 
 
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
 
390
391
392
393
394
395
396
397
398
 
649
650
651
 
652
653
654
655
@@ -348,8 +348,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' @@ -375,6 +390,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) @@ -631,7 +649,7 @@
    def removeSelected(self):   self.tview.removeSelected() - +   @pyqtSlot(QString, QString)   def shortNameChanged(self, uroot, uname):   it = self.tview.model().getRepoItem(hglib.fromunicode(uroot))