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

hgqt: initial use of a style sheet

Next step is to investigate the use of QStyleSheet and QStyleSheetItem

Changeset cd95c6cb5b9c

Parent d029220e4b17

by Steve Borho

Changes to 3 files · Browse files at cd95c6cb5b9c Showing diff from parent d029220e4b17 Diff from another changeset...

 
10
11
12
 
 
13
14
15
 
92
93
94
 
95
96
97
 
105
106
107
108
109
110
 
111
112
113
 
10
11
12
13
14
15
16
17
 
94
95
96
97
98
99
100
 
108
109
110
 
111
112
113
114
115
116
@@ -10,6 +10,8 @@
 from PyQt4.QtCore import *  from PyQt4.QtGui import *   +from tortoisehg.hgqt import qtlib +  class HtmlModel(QAbstractListModel):     def __init__(self, strings): @@ -92,6 +94,7 @@
  palette = QApplication.palette()   doc = QTextDocument()   doc.setDefaultFont(option.font) + doc.setDefaultStyleSheet(qtlib.thgstylesheet)   painter.save()   if option.state & QStyle.State_Selected:   doc.setHtml('<font color=%s>%s</font>' % ( @@ -105,9 +108,9 @@
  painter.restore()     def sizeHint(self, option, index): - fm = option.fontMetrics   text = index.model().data(index, Qt.DisplayRole).toString()   doc = QTextDocument() + doc.setDefaultStyleSheet(qtlib.thgstylesheet)   doc.setDefaultFont(option.font)   doc.setHtml(text)   doc.setTextWidth(option.rect.width())
 
36
37
38
 
39
40
41
42
43
 
44
45
46
 
36
37
38
39
40
 
 
 
 
41
42
43
44
@@ -36,11 +36,9 @@
  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()
 
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():