Very nice!!

On Sun, Nov 29, 2009 at 08:08, Adrian Buehlmann <adr...@cadifra.com> wrote:
> I've started experimenting a bit on using icons for the file status in the log
> viewer.
>
> Screenshot of my hackery:
>
> http://cdn.bitbucket.org/abuehl/thg-abuehl/downloads/thg-log-status-with-icons.png
>
>
> This was done using the following (far from finished) patch:
>
>
> diff --git a/tortoisehg/hgtk/changeset.py b/tortoisehg/hgtk/changeset.py
> --- a/tortoisehg/hgtk/changeset.py
> +++ b/tortoisehg/hgtk/changeset.py
> @@ -15,7 +15,7 @@ import Queue
>  from mercurial import cmdutil, util, patch, mdiff
>
>  from tortoisehg.util.i18n import _
> -from tortoisehg.util import shlib, hglib
> +from tortoisehg.util import shlib, hglib, paths
>
>  from tortoisehg.hgtk import csinfo, gdialog, gtklib, hgcmd, statusbar
>
> @@ -147,22 +147,29 @@ class ChangeSet(gdialog.GDialog):
>                 if wfile:
>                     pats.append(wfile)
>
> +        width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_SMALL_TOOLBAR)
> +        def get_pixbuf(iconfilename):
> +            iconpath = paths.get_tortoise_icon(iconfilename)
> +            # print iconpath
> +            return gtk.gdk.pixbuf_new_from_file_at_size(
> +                iconpath, width, height)
> +
>         self._filelist.clear()
> -        self._filelist.append(('*', _('[All Files]'), ''))
> +        self._filelist.append((None, _('[All Files]'), ''))
>         modified, added, removed = self.repo.status(parent, ctx.node())[:3]
>         selrow = None
>         for f in modified:
>             if f in pats:
>                 selrow = len(self._filelist)
> -            self._filelist.append(('M', hglib.toutf(f), f))
> +            self._filelist.append((None, hglib.toutf(f), f))
>         for f in added:
>             if f in pats:
>                 selrow = len(self._filelist)
> -            self._filelist.append(('A', hglib.toutf(f), f))
> +            self._filelist.append((get_pixbuf('menuadd.ico'), 
> hglib.toutf(f), f))
>         for f in removed:
>             if f in pats:
>                 selrow = len(self._filelist)
> -            self._filelist.append(('R', hglib.toutf(f), f))
> +            self._filelist.append((get_pixbuf('menudelete.ico'), 
> hglib.toutf(f), f))
>         self.curnodes = (parent, ctx.node())
>         if selrow is not None:
>             self._filesel.select_path((selrow,))
> @@ -659,12 +666,12 @@ class ChangeSet(gdialog.GDialog):
>         filelist_tree.connect('thg-diff', self.thgdiff)
>
>         self._filelist = gtk.ListStore(
> -                gobject.TYPE_STRING,   # MAR status
> +                gtk.gdk.Pixbuf,        # MAR status
>                 gobject.TYPE_STRING,   # filename (utf-8 encoded)
>                 gobject.TYPE_STRING,   # filename
>                 )
>         filelist_tree.set_model(self._filelist)
> -        column = gtk.TreeViewColumn(_('Stat'), gtk.CellRendererText(), 
> text=0)
> +        column = gtk.TreeViewColumn(_('Stat'), gtk.CellRendererPixbuf(), 
> pixbuf=0)
>         filelist_tree.append_column(column)
>         column = gtk.TreeViewColumn(_('Files'), gtk.CellRendererText(), 
> text=1)
>         filelist_tree.append_column(column)
>
>
> I ran this on Windows XP.
>
> If course the icons are probably not yet ideal (I just used what is already 
> there).
>
> I currently think "modified" wouldn't need an icon at all (only deleted and 
> added).
>
> Early feedback / suggestions / opinions (rotten tomatoes :) welcome.
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Tortoisehg-develop mailing list
> Tortoisehg-develop@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop
>



-- 
Yuki KODAMA

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to