Ticket #4343: 0002-CellRendererIcon-improve-point_in_cell_renderer-SL-4.patch

File 0002-CellRendererIcon-improve-point_in_cell_renderer-SL-4.patch, 1.5 KB (added by manuq, 8 years ago)
  • src/sugar3/graphics/icon.py

    From c4ccf4ac9f14cc4d7bf8f0fe063b1767380cdb4f Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <manuq@laptop.org>
    Date: Wed, 20 Mar 2013 22:04:14 -0300
    Subject: [PATCH 2/5] CellRendererIcon: improve point_in_cell_renderer - SL
     #4343
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    Mail-Followup-To: <sugar-devel@lists.sugarlabs.org>
    
    Call Gtk.TreeViewColumn.cell_get_position() early and return if the
    cell was not found in the column.  This is when it returns None [1] .
    
    [1] https://developer.gnome.org/gtk3/stable/GtkTreeViewColumn.html#gtk-tree-view-column-cell-get-position
    
    Signed-off-by: Manuel Quiñones <manuq@laptop.org>
    ---
     src/sugar3/graphics/icon.py | 7 ++++++-
     1 file changed, 6 insertions(+), 1 deletion(-)
    
    diff --git a/src/sugar3/graphics/icon.py b/src/sugar3/graphics/icon.py
    index 6ee9838..7c428b7 100644
    a b class CellRendererIcon(Gtk.CellRenderer): 
    892892            return False
    893893
    894894        path_, column, x, y_ = pos
     895        result = column.cell_get_position(self)
    895896
     897        # If this cell was not found in the column:
     898        if result is None:
     899            return False
     900
     901        cell_x, cell_width = result
    896902        for cell_renderer in column.get_cells():
    897903            if cell_renderer == self:
    898                 cell_x, cell_width = column.cell_get_position(cell_renderer)
    899904                if x > cell_x and x < (cell_x + cell_width):
    900905                    return True
    901906                return False