Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

repowidget: introduce titleChanged signal to update tab title

It'll also be emitted when branch filter changed.
Signal name is borrowed from QWebView.

Changeset 68879b630197

Parent 092ed4483637

by Yuya Nishihara

Changes to 2 files · Browse files at 68879b630197 Showing diff from parent 092ed4483637 Diff from another changeset...

 
42
43
44
 
 
 
45
46
47
 
122
123
124
 
 
 
 
 
 
 
 
125
126
127
 
484
485
486
487
488
489
490
491
492
493
 
 
494
495
496
 
42
43
44
45
46
47
48
49
50
 
125
126
127
128
129
130
131
132
133
134
135
136
137
138
 
495
496
497
 
 
 
 
 
 
 
498
499
500
501
502
@@ -42,6 +42,9 @@
  progress = pyqtSignal(QString, object, QString, QString, object)   makeLogVisible = pyqtSignal(bool)   + titleChanged = pyqtSignal(unicode) + """Emitted when changed the expected title for the RepoWidget tab""" +   def __init__(self, repo, workbench):   QWidget.__init__(self, acceptDrops=True)   @@ -122,6 +125,14 @@
  tb.attachFileView(d.fileview)   self.layout().addWidget(tb)   + def title(self): + """Returns the expected title for this widget [unicode]""" + branch = self.repomodel.branch() + if branch: + return '%s [%s]' % (self.repo.shortname, branch) + else: + return self.repo.shortname +   def find(self):   self.findToolbar.setVisible(True)   @@ -484,13 +495,8 @@
  'Repository is reporting its config files have changed'   self.repomodel.invalidate()   self.revDetailsWidget.reload() - branch = self.repomodel.branch() - if branch: - tabtext = '%s [%s]' % (self.repo.shortname, branch) - else: - tabtext = self.repo.shortname - idx = self.workbench.repoTabsWidget.indexOf(self) - self.workbench.repoTabsWidget.setTabText(idx, tabtext) + self.titleChanged.emit(self.title()) + # TODO: emit only if actually changed     ##   ## Workbench methods
 
555
556
557
558
 
559
 
 
560
561
562
 
555
556
557
 
558
559
560
561
562
563
564
@@ -555,8 +555,10 @@
  rw.taskTabsWidget.currentChanged.connect(self.updateTaskViewMenu)     tw = self.repoTabsWidget - index = self.repoTabsWidget.addTab(rw, repo.shortname) + index = self.repoTabsWidget.addTab(rw, rw.title())   tw.setCurrentIndex(index) + rw.titleChanged.connect( + lambda title: self.repoTabsWidget.setTabText(index, title))   self.reporegistry.addRepo(repo.root)     self.updateMenu()