[qt] prevent hgview from getting slower and slower at each reload (closes #114970)

Some callbacks for the UI were reconnected at each reload, resulting in the very same content to be refreshed <number-of-reload> each time a revision were selected.

authorPierre-Yves David <pierre-yves.david@logilab.fr>
changeseteaf7079c90ee
branchstable
phasepublic
hiddenno
parent revision#d616e2b37fb1 [qt] drop the infamous yellow color (closes #113385)
child revision#5adac93dd205 merge with future 1.7.1, #3bfa63d249de merge with stable
files modified by this revision
hgviewlib/qt4/hgrepoviewer.py
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@logilab.fr>
# Date 1356012916 -3600
# Thu Dec 20 15:15:16 2012 +0100
# Branch stable
# Node ID eaf7079c90ee54472dbae812b6694147808a9f77
# Parent d616e2b37fb18fb189c8179322deab9157d3d928
[qt] prevent hgview from getting slower and slower at each reload (closes #114970)

Some callbacks for the UI were reconnected at each reload, resulting in the very
same content to be refreshed <number-of-reload> each time a revision were
selected.

diff --git a/hgviewlib/qt4/hgrepoviewer.py b/hgviewlib/qt4/hgrepoviewer.py
@@ -77,10 +77,21 @@
1 
2          # setup tables and views
3          self.setupHeaderTextview()
4          self.setupBranchCombo()
5          self.setupModels(fromhead)
6 +
7 +        if self.cfg.getFileDescriptionView() == 'asfile':
8 +            fileselcallback = self.displaySelectedFile
9 +        else:
10 +            fileselcallback = self.textview_status.displayFile
11 +        connect(self.tableView_filelist, SIGNAL('fileSelected'),
12 +                fileselcallback)
13 +
14 +        connect(self.textview_status, SIGNAL('revForDiffChanged'),
15 +                self.textview_header.setDiffRevision)
16 +
17          if fromhead:
18              self.startrev_entry.setText(str(fromhead))
19          self.setupRevisionTable()
20 
21          self._repodate = self._getrepomtime()
@@ -344,19 +355,10 @@
22          self.tableView_revisions.setModel(self.repomodel)
23          self.tableView_filelist.setModel(self.filelistmodel)
24          self.textview_status.setModel(self.repomodel)
25          self.find_toolbar.setModel(self.repomodel)
26 
27 -        if self.cfg.getFileDescriptionView() == 'asfile':
28 -            fileselcallback = self.displaySelectedFile
29 -        else:
30 -            fileselcallback = self.textview_status.displayFile
31 -        connect(self.tableView_filelist, SIGNAL('fileSelected'),
32 -                fileselcallback)
33 -
34 -        connect(self.textview_status, SIGNAL('revForDiffChanged'),
35 -                self.textview_header.setDiffRevision)
36 
37      def displaySelectedFile(self, filename=None, rev=None):
38          if filename == '':
39              self.textview_status.hide()
40              self.textview_header.show()