Ticket #4157: 0001-Snowflake-layout-fix-the-requisition-and-allocation-.patch

File 0001-Snowflake-layout-fix-the-requisition-and-allocation-.patch, 2.6 KB (added by manuq, 11 years ago)

Fix requisition and allocation of Snowflakes in mesh.

  • src/jarabe/desktop/favoriteslayout.py

    From 37a27aef664c82e6d5ff3a20e45c7699c045c545 Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <manuq@laptop.org>
    Date: Fri, 9 Nov 2012 10:21:11 -0300
    Subject: [PATCH shell] Snowflake layout: fix the requisition and allocation -
     SL #4157
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    Mail-Followup-To: <sugar-devel@lists.sugarlabs.org>
    
    Same as commit c5582856, size_request is deprecated and the
    get_preferred* should be used instead.  So we need to implement
    do_get_preferred* instead of do_size_request.
    
    Signed-off-by: Manuel Quiñones <manuq@laptop.org>
    ---
     src/jarabe/desktop/favoriteslayout.py | 7 ++++---
     src/jarabe/desktop/snowflakelayout.py | 9 ++++++---
     2 files changed, 10 insertions(+), 6 deletions(-)
    
    diff --git a/src/jarabe/desktop/favoriteslayout.py b/src/jarabe/desktop/favoriteslayout.py
    index 5f3b560..b4c83c3 100644
    a b class SpreadLayout(ViewLayout): 
    175175                width, height = self._get_child_grid_size(child)
    176176                self._grid.add(child, width, height, None, None, locked=False)
    177177
    178             requisition = child.size_request()
     178            new_width = child.get_preferred_width()[0]
     179            new_height = child.get_preferred_height()[1]
    179180            rect = self._grid.get_child_rect(child)
    180181            child_allocation = Gdk.Rectangle()
    181182            child_allocation.x = int(round(rect.x * _CELL_SIZE))
    182183            child_allocation.y = int(round(rect.y * _CELL_SIZE)) + allocation.y
    183             child_allocation.width = requisition.width
    184             child_allocation.height = requisition.height
     184            child_allocation.width = new_width
     185            child_allocation.height = new_height
    185186            child.size_allocate(child_allocation)
    186187
    187188
  • src/jarabe/desktop/snowflakelayout.py

    diff --git a/src/jarabe/desktop/snowflakelayout.py b/src/jarabe/desktop/snowflakelayout.py
    index 5ad5f26..cf195fa 100644
    a b class SnowflakeLayout(Gtk.Container): 
    7171        del self._children[child]
    7272        self.remove(child)
    7373
    74     def do_size_request(self, requisition):
     74    def do_get_preferred_width(self):
    7575        size = self._calculate_size()
    76         requisition.width = size
    77         requisition.height = size
     76        return (size, size)
     77
     78    def do_get_preferred_height(self):
     79        size = self._calculate_size()
     80        return (size, size)
    7881
    7982    def do_size_allocate(self, allocation):
    8083        self.set_allocation(allocation)