Commits

TK Soh committed 25e2fe1

history: convert tag column to display changeset id

  • Participants
  • Parent commits 026284b

Comments (0)

Files changed (3)

     def _view_menu(self):
         menu = gtk.Menu()
 
-        button = gtk.CheckMenuItem("Show Ids")
+        button = gtk.CheckMenuItem("Show Rev")
         button.connect("toggled", self.toggle_view_column,
                 'rev-column-visible')
         button.set_active(True)
         button.set_draw_as_radio(True)
         menu.append(button)
-        button = gtk.CheckMenuItem("Show Tags")
+        button = gtk.CheckMenuItem("Show ID")
         button.connect("toggled", self.toggle_view_column,
-                'tags-column-visible')
-        button.set_active(True)
+                'id-column-visible')
+        button.set_active(False)
         button.set_draw_as_radio(True)
         menu.append(button)
         button = gtk.CheckMenuItem("Show Date")

hggtk/vis/treemodel.py

 import re
 from time import (strftime, gmtime)
 from mercurial import util
+from mercurial.node import short
 
 # FIXME: dirty hack to import toutf() from hggtk.hglib.
 #
 TAGS = 11
 MARKED = 12
 FGCOLOR = 13
+HEXID = 14
 
 class TreeModel(gtk.GenericTreeModel):
 
         if index == TAGS: return gobject.TYPE_STRING
         if index == MARKED: return gobject.TYPE_BOOLEAN
         if index == FGCOLOR: return gobject.TYPE_STRING
+        if index == HEXID: return gobject.TYPE_STRING
 
     def on_get_iter(self, path):
         return path[0]
 
             revision = (None, node, revid, None, summary,
                     author, date, None, parents, wc_parent, head, taglist,
-                    None, color)
+                    None, color, short(node))
             self.revisions[revid] = revision
         else:
             revision = self.revisions[revid]

hggtk/vis/treeview.py

                                  gobject.PARAM_READWRITE),
         'rev-column-visible': (gobject.TYPE_BOOLEAN,
                                  'Rev',
-                                 'Show revision id column',
+                                 'Show revision number column',
                                  False,
                                  gobject.PARAM_READWRITE),
-        'tags-column-visible': (gobject.TYPE_BOOLEAN,
+        'id-column-visible': (gobject.TYPE_BOOLEAN,
                                  'Tags',
-                                 'Show tags column',
+                                 'Show revision ID column',
                                  False,
                                  gobject.PARAM_READWRITE),
     }
     def do_get_property(self, property):
         if property.name == 'date-column-visible':
             return self.date_column.get_visible()
-        elif property.name == 'tags-column-visible':
-            return self.tag_column.get_visible()
+        elif property.name == 'id-column-visible':
+            return self.id_column.get_visible()
         elif property.name == 'rev-column-visible':
             return self.rev_column.get_visible()
         elif property.name == 'repo':
     def do_set_property(self, property, value):
         if property.name == 'date-column-visible':
             self.date_column.set_visible(value)
-        elif property.name == 'tags-column-visible':
-            self.tag_column.set_visible(value)
+        elif property.name == 'id-column-visible':
+            self.id_column.set_visible(value)
         elif property.name == 'rev-column-visible':
             self.rev_column.set_visible(value)
         elif property.name == 'repo':
         self.treeview.append_column(self.rev_column)
 
         cell = gtk.CellRendererText()
-        cell.set_property("width-chars", 10)
+        cell.set_property("width-chars", 15)
         cell.set_property("ellipsize", pango.ELLIPSIZE_END)
-        self.tag_column = gtk.TreeViewColumn("Tag")
-        self.tag_column.set_visible(False)
-        self.tag_column.set_resizable(True)
-        self.tag_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
-        self.tag_column.set_fixed_width(cell.get_size(self.treeview)[2])
-        self.tag_column.pack_start(cell, expand=True)
-        self.tag_column.add_attribute(cell, "text", treemodel.TAGS)
-        self.tag_column.add_attribute(cell, "foreground", treemodel.FGCOLOR)
-        self.treeview.append_column(self.tag_column)
+        self.id_column = gtk.TreeViewColumn("ID")
+        self.id_column.set_visible(False)
+        self.id_column.set_resizable(True)
+        self.id_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
+        self.id_column.set_fixed_width(cell.get_size(self.treeview)[2])
+        self.id_column.pack_start(cell, expand=True)
+        self.id_column.add_attribute(cell, "text", treemodel.HEXID)
+        self.id_column.add_attribute(cell, "foreground", treemodel.FGCOLOR)
+        self.treeview.append_column(self.id_column)
 
         cell = gtk.CellRendererText()
         mcell = gtk.CellRendererPixbuf()