[qt4] hide text area on heavy file

The message that informs the user he can force displaying the file data is now really more visible.

authorAlain Leufroy <alain@leufroy.fr>
changesetfaeefee26955
branchdefault
phasedraft
hiddenyes
parent revision#954001a84fbb [qt4] add an intuitive link to display heavy files (closes #109862)
child revision#324d7a6fbd41 [qt4] make pylint a little happier
files modified by this revision
hgviewlib/qt4/hgfileview.py
# HG changeset patch
# User Alain Leufroy <alain@leufroy.fr>
# Date 1369503444 -7200
# Sat May 25 19:37:24 2013 +0200
# Node ID faeefee26955a484acb72ec674c456109e1dd371
# Parent 954001a84fbbeb3ffc6351c9ebd0e003e755136a
[qt4] hide text area on heavy file

:related to: #109862

The message that informs the user he can force displaying the file
data is now really more visible.

diff --git a/hgviewlib/qt4/hgfileview.py b/hgviewlib/qt4/hgfileview.py
@@ -208,30 +208,34 @@
1          QtGui.QFrame.__init__(self, parent)
2          framelayout = QtGui.QVBoxLayout(self)
3          framelayout.setContentsMargins(0,0,0,0)
4          framelayout.setSpacing(0)
5 
6 -        l = QtGui.QHBoxLayout()
7 -        l.setContentsMargins(0,0,0,0)
8 -        l.setSpacing(0)
9 -
10 -        self.topLayout = QtGui.QVBoxLayout()
11 +        self.info_frame = QtGui.QFrame()
12 +        framelayout.addWidget(self.info_frame)
13 +        l = QtGui.QVBoxLayout()
14 +        self.info_frame.setLayout(l)
15          self.filenamelabel = QtGui.QLabel()
16          self.filenamelabel.setWordWrap(True)
17          self.filenamelabel.setTextInteractionFlags(
18              QtCore.Qt.TextSelectableByKeyboard|
19              QtCore.Qt.TextSelectableByMouse|
20              QtCore.Qt.LinksAccessibleByMouse)
21          self.filenamelabel.linkActivated.connect(
22              lambda link: self.displayFile(show_big_file=True))
23          self.execflaglabel = QtGui.QLabel()
24          self.execflaglabel.setWordWrap(True)
25 -        self.topLayout.addWidget(self.filenamelabel)
26 -        self.topLayout.addWidget(self.execflaglabel)
27 +        l.addWidget(self.filenamelabel)
28 +        l.addWidget(self.execflaglabel)
29          self.execflaglabel.hide()
30 -        framelayout.addLayout(self.topLayout)
31 -        framelayout.addLayout(l, 1)
32 +
33 +        self.filedata_frame = QtGui.QFrame()
34 +        framelayout.addWidget(self.filedata_frame)
35 +        l = QtGui.QHBoxLayout()
36 +        l.setContentsMargins(0,0,0,0)
37 +        l.setSpacing(0)
38 +        self.filedata_frame.setLayout(l)
39 
40          self.sci = HgQsci(self)
41          l.addWidget(self.sci, 1)
42 
43          ll = QtGui.QVBoxLayout()
@@ -371,14 +375,20 @@
44          if show_big_file:
45              flag, data = self._model.graph.filedata(filename, self._ctx.rev(), mode, maxfilesize=-1)
46          else:
47              flag, data = self._model.graph.filedata(filename, self._ctx.rev(), mode)
48          if flag == 'file too big':
49 +            self.filedata_frame.hide()
50              self.filenamelabel.setText(
51                  '%s %s' %
52 -                (data, '<a href="show-big-file">Click to display anyway <img src=":/icons/heavy_small.png" width="16" height="16" title="Display heavy file">.</a>'))
53 +                (data,
54 +                 ('<a href="show-big-file">Click to display anyway '
55 +                  '<img src=":/icons/heavy_small.png" '
56 +                  'width="16" height="16">.</a>')))
57              return
58 +        else:
59 +            self.filedata_frame.show()
60          if flag == '-':
61              return
62          if flag == '':
63              return
64