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

filelistmodel: get rid of some stats handling code

Changeset 8425a7e1624b

Parent 4d423c40191c

by Adrian Buehlmann

Changes to one file · Browse files at 8425a7e1624b Showing diff from parent 4d423c40191c Diff from another changeset...

 
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
 
272
273
274
 
294
295
296
297
 
298
299
 
300
301
 
302
303
304
 
230
231
232
 
 
 
 
 
 
 
233
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
235
236
237
 
257
258
259
 
260
261
 
262
263
 
264
265
266
267
@@ -230,45 +230,8 @@
    current_file_desc = self._files[row]   current_file = current_file_desc['path'] - stats = current_file_desc.get('stats') - if column == 1: - if stats is not None: - if role == QtCore.Qt.DecorationRole: - tot, add, rem = stats - w = self.diffwidth - 20 - h = 20   - np = int(w*add/tot) - nm = int(w*rem/tot) - nd = w-np-nm - - pix = QtGui.QPixmap(w+10, h) - pix.fill(QtGui.QColor(0,0,0,0)) - painter = QtGui.QPainter(pix) - - for x0,w0, color in ((0, nm, 'red'), - (nm, np, 'green'), - (nm+np, nd, 'gray')): - color = QtGui.QColor(color) - painter.setBrush(color) - painter.setPen(color) - painter.drawRect(x0+5, 0, w0, h-3) - painter.setBrush(QtGui.QColor(0,0,0,0)) - pen = QtGui.QPen(QtCore.Qt.black) - pen.setWidth(0) - painter.setPen(pen) - painter.drawRect(5, 0, w+1, h-3) - painter.end() - return QtCore.QVariant(pix) - elif role == QtCore.Qt.ToolTipRole: - tot, add, rem = stats - msg = "Diff stats:<br>" - msg += "&nbsp;<b>File:&nbsp;</b>%s lines<br>" % tot - msg += "&nbsp;<b>added lines:&nbsp;</b> %s<br>" % add - msg += "&nbsp;<b>removed lines:&nbsp;</b> %s" % rem - return QtCore.QVariant(msg) - - elif column == 0: + if column == 0:   if role in (QtCore.Qt.DisplayRole, QtCore.Qt.ToolTipRole):   return QtCore.QVariant(current_file_desc['desc'])   elif role == QtCore.Qt.DecorationRole: @@ -294,11 +257,11 @@
  def headerData(self, section, orientation, role):   if ismerge(self.current_ctx):   if self._fulllist: - header = ('File (all)', 'Diff') + header = ('File (all)', '')   else: - header = ('File (merged only)', 'Diff') + header = ('File (merged only)', '')   else: - header = ('File', 'Diff') + header = ('File','')     if orientation == QtCore.Qt.Horizontal and role == QtCore.Qt.DisplayRole:   return QtCore.QVariant(header[section])