[phases] basic support (closes #86349)

  • Use different shape for phase other than public.
  • Use a red outline for current changeset on phase we don't have icon for yet.
authorPierre-Yves David <pierre-yves.david@logilab.fr>
changeset6f0ca886050d
branchdefault
phasepublic
hiddenno
parent revision#1fccd403dbb0 [hidden] fix infinite loop when hidden changeset.
child revision#8bea07afcf24 [phases] watch phase files for update (closes #86349)
files modified by this revision
hgviewlib/qt4/hgrepomodel.py
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@logilab.fr>
# Date 1324305249 -3600
# Mon Dec 19 15:34:09 2011 +0100
# Node ID 6f0ca886050df49fdf586a53fe360267e80e68cf
# Parent 1fccd403dbb0d9124d5640422eedd9348a0286a2
[phases] basic support (closes #86349)

* Use different shape for phase other than public.

* Use a red outline for current changeset on phase we don't have icon for yet.

diff --git a/hgviewlib/qt4/hgrepomodel.py b/hgviewlib/qt4/hgrepomodel.py
@@ -42,10 +42,12 @@
1             "darkcyan", "gray", "yellow", ]
2  COLORS = [str(QtGui.QColor(x).name()) for x in COLORS]
3  #COLORS = [str(color) for color in QtGui.QColor.colorNames()]
4 
5 
6 +PUBLIC_PHASE, DRAFT_PHASE, SECRET_PHASE = 0, 1, 2
7 +
8  def cvrt_date(date):
9      """
10      Convert a date given the hg way, ie. couple (date, tz), into a
11      formatted QString
12      """
@@ -272,23 +274,41 @@
13                      atwd = True
14                      status = self.wd_status[self.wd_revs.index(gnode.rev)]
15                      if [True for st in status if st]:
16                          modified = True
17 
18 +                phase = getattr(ctx, 'phase', lambda : PUBLIC_PHASE)()
19 +
20                  if gnode.rev is None:
21                      # WD is displayed only if there are local
22                      # modifications, so let's use the modified icon
23                      icn = geticon('modified')
24                  elif tags.intersection(self.mqueues):
25                      icn = geticon('mqpatch')
26                  #elif modified:
27                  #    icn = geticon('modified')
28                  elif atwd:
29 -                    icn = geticon('clean')
30 +                    if phase > PUBLIC_PHASE:
31 +                        pen_color = QtCore.Qt.red
32 +                        pen = QtGui.QPen(pen_color)
33 +                        pen.setWidth(penradius)
34 +                        painter.setPen(pen)
35 +                    else:
36 +                        icn = geticon('clean')
37 +
38 
39                  if icn:
40                      icn.paint(painter, dot_x-5, dot_y-5, 17, 17)
41 +                elif phase == DRAFT_PHASE:
42 +                    painter.drawRect(dot_x, dot_y, radius, radius)
43 +                elif phase == SECRET_PHASE:
44 +                    P = QtCore.QPointF
45 +                    painter.drawPolygon(
46 +                        P(dot_x + (radius//2), dot_y),
47 +                        P(dot_x, dot_y + radius),
48 +                        P(dot_x + radius, dot_y+radius)
49 +                        )
50                  else:
51                      painter.drawEllipse(dot_x, dot_y, radius, radius)
52                  painter.end()
53                  ret = QtCore.QVariant(pix)
54                  return ret