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

Merge with steve

Changeset b6edf218cbf7

Parents 142f381158d7

Parents cd95c6cb5b9c

by Adrian Buehlmann

Changes to 4 files · Browse files at b6edf218cbf7 Showing diff from parent 142f381158d7 cd95c6cb5b9c Diff from another changeset...

 
76
77
78
79
 
80
81
82
 
76
77
78
 
79
80
81
82
@@ -76,7 +76,7 @@
  matcher = cmdutil.matchall(repo)   diffopts = mdiff.diffopts(git=True, nodates=True)   try: - node1, node2 = repo['tip'].node(), repo['tip'].parents()[0].node() + node2, node1 = repo['tip'].node(), repo['tip'].parents()[0].node()   for s in patch.diff(repo, node1, node2, match=matcher, opts=diffopts):   fp.writelines(s.splitlines(True))   except (IOError, error.RepoError, error.LookupError, util.Abort), e:
 
10
11
12
 
 
13
14
15
 
88
89
90
91
 
 
92
93
94
 
 
95
96
97
98
99
100
101
 
 
 
 
 
 
 
 
 
102
103
104
105
 
106
107
108
109
 
 
 
 
 
110
111
112
 
10
11
12
13
14
15
16
17
 
90
91
92
 
93
94
95
 
 
96
97
98
 
 
 
 
 
 
99
100
101
102
103
104
105
106
107
108
109
110
 
111
112
 
 
 
113
114
115
116
117
118
119
120
@@ -10,6 +10,8 @@
 from PyQt4.QtCore import *  from PyQt4.QtGui import *   +from tortoisehg.hgqt import qtlib +  class HtmlModel(QAbstractListModel):     def __init__(self, strings): @@ -88,25 +90,31 @@
  QItemDelegate.__init__(self, parent)     def paint(self, painter, option, index): - options = QStyleOptionViewItemV4(option) + text = index.model().data(index, Qt.DisplayRole).toString() + palette = QApplication.palette()   doc = QTextDocument() - doc.setHtml(index.data().toString()) - + doc.setDefaultFont(option.font) + doc.setDefaultStyleSheet(qtlib.thgstylesheet)   painter.save() - if options.widget: - options.widget.style().drawControl(QStyle.CE_ItemViewItem, - options, painter) - painter.translate(options.rect.left(), options.rect.top()) - clip = QRectF(0, 0, options.rect.width(), options.rect.height()) - doc.drawContents(painter, clip) + if option.state & QStyle.State_Selected: + doc.setHtml('<font color=%s>%s</font>' % ( + palette.highlightedText().color().name(), text)) + bgcolor = palette.highlight().color() + painter.fillRect(option.rect, bgcolor) + else: + doc.setHtml(text) + painter.translate(option.rect.left(), option.rect.top()) + doc.drawContents(painter)   painter.restore()     def sizeHint(self, option, index): - options = QStyleOptionViewItemV4(option) + text = index.model().data(index, Qt.DisplayRole).toString()   doc = QTextDocument() - doc.setHtml(index.data().toString()) - doc.setTextWidth(options.rect.width()) - return QSize(doc.idealWidth(), doc.size().height()) + doc.setDefaultStyleSheet(qtlib.thgstylesheet) + doc.setDefaultFont(option.font) + doc.setHtml(text) + doc.setTextWidth(option.rect.width()) + return QSize(doc.idealWidth() + 5, doc.size().height())      if __name__ == "__main__":
 
8
9
10
 
11
12
13
 
34
35
36
 
 
37
38
39
40
41
 
42
43
44
 
59
60
61
 
 
8
9
10
11
12
13
14
 
35
36
37
38
39
40
 
 
 
 
41
42
43
44
 
59
60
61
62
@@ -8,6 +8,7 @@
 import os    from mercurial import ui +from PyQt4 import QtCore  from tortoisehg.hgqt import qtlib  from tortoisehg.util import hglib   @@ -34,11 +35,10 @@
    def label(self, msg, label):   msg = hglib.tounicode(msg) + msg = QtCore.Qt.escape(msg) + msg = msg.replace('\n', '<br />')   style = qtlib.geteffect(label) - if style: - return '<pre style="%s">%s</pre>' % (style, msg) - else: - return '<pre>%s</pre>' % msg + return '<font style="%s">%s</font>' % (style, msg)     def popbuffer(self, labeled=False):   b = self._buffers.pop() @@ -59,3 +59,4 @@
  u = htmlui()   repo = hg.repository(u)   repo.status() + print u.getdata()[0]
 
21
22
23
 
 
24
25
26
 
21
22
23
24
25
26
27
28
@@ -21,6 +21,8 @@
  'underline': 'text-decoration: underline',  }   +thgstylesheet = '* { white-space: pre; font-family: monospace; }' +  def configstyles(ui):   # extensions may provide more labels and default effects   for name, ext in extensions.extensions():