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

status: use configured status colors

Changeset 055c63ccc8f4

Parent ce0de634832e

by Steve Borho

Changes to one file · Browse files at 055c63ccc8f4 Showing diff from parent ce0de634832e Diff from another changeset...

 
13
14
15
16
 
17
18
19
 
48
49
50
 
 
 
 
 
 
 
 
 
 
51
52
53
 
149
150
151
 
 
 
 
 
 
 
 
 
 
 
 
 
152
153
154
 
195
196
197
 
 
 
 
198
199
200
201
202
 
13
14
15
 
16
17
18
19
 
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
 
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
 
218
219
220
221
222
223
224
225
 
226
227
228
@@ -13,7 +13,7 @@
 from PyQt4.QtCore import Qt, QVariant, SIGNAL, QAbstractTableModel  from PyQt4.QtCore import QObject, QEvent  from PyQt4.QtGui import QWidget, QVBoxLayout, QSplitter, QTreeView -from PyQt4.QtGui import QTextEdit, QFont +from PyQt4.QtGui import QTextEdit, QFont, QColor    # This widget can be used as the basis of the commit tool or any other  # working copy browser. @@ -48,6 +48,16 @@
  self.repo = hg.repository(ui.ui(), path=root)   self.wctx = self.repo[None]   + # determine the user configured status colors + # (in the future, we could support full rich-text tags) + qtlib.configstyles(self.repo.ui) + for stat in color_labels.keys(): + effect = qtlib.geteffect(color_labels[stat]) + for e in effect.split(';'): + if e.startswith('color:'): + colors[stat] = QColor(e[7:]) + break +   split = QSplitter(Qt.Horizontal)   layout = QVBoxLayout()   layout.addWidget(split) @@ -149,6 +159,19 @@
  'S': _('%s is a dirty subrepo'),  }   +color_labels = { + 'M': 'status.modified', + 'A': 'status.added', + 'R': 'status.removed', + '?': 'status.unknown', + '!': 'status.deleted', + 'I': 'status.ignored', + 'C': 'status.clean', + 'S': 'status.subrepo', +} + +colors = {} +  class WctxModel(QAbstractTableModel):   def __init__(self, wctx, parent=None):   QAbstractTableModel.__init__(self, parent) @@ -195,8 +218,11 @@
  return Qt.Unchecked   elif role == Qt.DisplayRole:   return QVariant(self.rows[index.row()][index.column()]) + + checked, status, upath, path = self.rows[index.row()] + if role == Qt.TextColorRole: + return colors.get(status, QColor('black'))   elif role == Qt.ToolTipRole: - checked, status, upath, path = self.rows[index.row()]   if status in tips:   return QVariant(tips[status] % upath)   return QVariant()