Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.0, 1.0.1, and 1.0.2

browse: use pixmaps renderers for status

Just experimenting with what's possible with a treeview. It's not terribly
impressive thus far. If we continue in this approach, we'll need a new
iconset.

Changeset ba754ab1109c

Parent 4c7fa254318a

by Steve Borho

Changes to one file · Browse files at ba754ab1109c Showing diff from parent 4c7fa254318a Diff from another changeset...

 
49
50
51
 
52
53
54
55
 
 
 
 
 
 
 
56
57
58
59
60
61
62
 
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
65
66
67
68
69
 
108
109
110
 
 
 
 
 
 
111
112
113
 
125
126
127
128
129
130
131
 
132
133
134
135
136
 
137
138
139
 
49
50
51
52
53
54
55
 
56
57
58
59
60
61
62
63
64
65
66
67
68
 
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
 
94
95
96
 
135
136
137
138
139
140
141
142
143
144
145
146
 
158
159
160
 
 
 
 
161
162
163
164
 
 
165
166
167
168
@@ -49,21 +49,48 @@
  'Dialog for browsing repo.status() output'   def __init__(self, repo):   gtk.TreeView.__init__(self) + self.repo = repo   fm = gtk.TreeStore(str, # Path   bool, # Checked   str, # Path-UTF8 - str) # Status + bool, # M + bool, # A + bool, # R + bool, # ! + bool, # ? + bool, # I + bool) # C   self.set_model(fm)   self.set_reorderable(True)   if hasattr(self, 'set_rubber_banding'):   self.set_rubber_banding(True)   fontlist = repo.ui.config('gtools', 'fontlist', 'MS UI Gothic 9')   self.modify_font(pango.FontDescription(fontlist)) - col = gtk.TreeViewColumn(_('status'), gtk.CellRendererText(), text=3) + col = gtk.TreeViewColumn(_('status'))   self.append_column(col) + + iconw, iconh = gtk.icon_size_lookup(gtk.ICON_SIZE_SMALL_TOOLBAR) + def packpixmap(ico, id): + iconpath = paths.get_tortoise_icon(ico) + if iconpath == None: + raise (_("could not open icon file '%s' (check install)") % ico) + pm = gtk.gdk.pixbuf_new_from_file_at_size(iconpath, iconw, iconh) + cell = gtk.CellRendererPixbuf() + cell.set_property('pixbuf', pm) + col.pack_start(cell, expand=False) + col.add_attribute(cell, 'visible', id) + + #packpixmap('filemodify.ico', 3) # this icon does not load for me + packpixmap('menucommit.ico', 3) # M + packpixmap('fileadd.ico', 4) # A + packpixmap('filedelete.ico', 5) # R + packpixmap('detect_rename.ico', 6) # missing + packpixmap('menublame.ico', 7) # unknown + #packpixmap('ignore.ico', 8) # ignored + #packpixmap('hg.ico', 9) # clean +   col = gtk.TreeViewColumn(_('path'), gtk.CellRendererText(), text=2)   self.append_column(col) - self.repo = repo     def split(self, filename):   'Split a filename into a list of directories and the basename' @@ -108,6 +135,12 @@
  def addstatus(self, st):   self.statuses.add(st)   + def buildrow(name, stset): + return [ name, False, hglib.toutf(name), + 'M' in stset, 'A' in stset, 'R' in stset, + '!' in stset, '?' in stset, 'I' in stset, + 'C' in stset ] +   # Build tree data structure   modelroot = dirnode()   for name, filestatus in filelist: @@ -125,15 +158,11 @@
  def adddir(node, iter):   # insert subdirectories at this level (recursive)   for dname, dirnode in node.subdirs.iteritems(): - statuslist = list(dirnode.statuses) - st = ''.join(statuslist) - row = [dname, False, hglib.toutf(dname), st] - piter = model.append(iter, row) + piter = model.append(iter, buildrow(dname, dirnode.statuses))   adddir(dirnode, piter)   # insert files at this level   for fname, st in node.files: - row = [fname, False, hglib.toutf(fname), st] - model.append(iter, row) + model.append(iter, buildrow(fname, st))     # insert directory tree into TreeModel   adddir(modelroot, model.get_iter_root())