On Thu, Jan 15, 2009 at 6:25 PM, Steve Borho <[email protected]> wrote:

> On Thu, Jan 15, 2009 at 6:18 PM, Steve Borho <[email protected]> wrote:
>
>>
>> I've got this sort of working and I agree it doesn't look all that great.
>>
>> I'm also considering whether to do all the diffs up front and display
>> them all at once, just like the changeset viewer does.  Clicking on
>> a file name causes the diff pane to jump to that file's diffs.  This would
>> fix the problem of losing selections when changing files since the
>> diff chunk list would not change.
>>
>
> gtk.CellRenderText has a strikethrough attribute that can be read from
> the data model.   That might be a winner.  I'll post some patches in a
> few minutes.
>

Attached is a patch that shows what the strikethrough looks like.  You
have to "activate" rows to change their status.  IE: dbl-click or hit
return.

This patch breaks the shelve feature since it changes the meaning of
the store, so only use this to preview the selection method.

Obviously this is meant to be applied on top of the hgshelve patch.
It might require a bit of fuzz, as well, since i have a number of patches
in the middle in my queue.

--
Steve
diff --git a/hggtk/status.py b/hggtk/status.py
--- a/hggtk/status.py
+++ b/hggtk/status.py
@@ -304,11 +304,14 @@
         self.diff_text.modify_font(pango.FontDescription(self.fontdiff))
 
         # use treeview to diff hunks
+        # rejected, difftext, !isheader
         self.diff_model = gtk.ListStore(bool, str, 'gboolean')
         self.diff_tree = gtk.TreeView(self.diff_model)
         self.diff_tree.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
         self.diff_tree.modify_font(pango.FontDescription(self.fontlist))
         self.diff_tree.set_property('enable-grid-lines', True)
+        self.diff_tree.connect('row-activated',
+                self._diff_tree_row_act)
         self.diff_tree.connect('button-press-event', 
                 self._diff_tree_button_press)
         
@@ -317,6 +320,8 @@
         diffcol = gtk.TreeViewColumn('diff', diff_hunk_cell, markup=1,
                 cell_background_set=2)
         diffcol.set_resizable(True)
+        diffcol.add_attribute(diff_hunk_cell, "strikethrough", 0)
+        diffcol.add_attribute(diff_hunk_cell, "strikethrough-set", 2)
         self.diff_tree.append_column(diffcol)
         
         scroller.add(self.diff_tree)
@@ -648,6 +653,9 @@
                 self._show_diff_hunks(files)
         return False
 
+    def _diff_tree_row_act(self, tree, path, column):
+        self.diff_model[path][0] = not self.diff_model[path][0]
+
     def _diff_tree_button_press(self, widget, event):
         if event.button == 1:
             tup = widget.get_path_at_pos(int(event.x), int(event.y))
@@ -760,7 +768,7 @@
                     chunk.pretty(fp)
                     markedup = markup(fp)
                     isheader = isinstance(chunk, hgshelve.header)
-                    self.diff_model.append([True, markedup, isheader])
+                    self.diff_model.append([False, markedup, not isheader])
             finally:
                 difftext.close()
 
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Tortoisehg-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to