Ticket #4276: 0001-ActivityBundle-don-t-wrap-the-temporal-icon-path-in-.patch

File 0001-ActivityBundle-don-t-wrap-the-temporal-icon-path-in-.patch, 1.7 KB (added by manuq, 10 years ago)

Candidate patch.

  • src/sugar3/bundle/activitybundle.py

    From 02aa4b4b0506a1a7d15a43a1ca027f947efcb2bb Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <manuq@laptop.org>
    Date: Sat, 15 Dec 2012 16:59:00 -0300
    Subject: [PATCH toolkit] ActivityBundle: don't wrap the temporal icon path in
     a TempFilePath - SL #4276
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    Mail-Followup-To: <sugar-devel@lists.sugarlabs.org>
    In the Journal, CellRendererActivityIcon is calling its do_render
    method after the temporal file is removed.  This is because we wrap
    the icon path in a TempFilePath to control its deletion, but as we
    don't maintain any reference to it, its __del__ method deletes the
    temporal file.
    Note that returning the path directly has one disadventage: the
    temporal file is left in /tmp .
    As a comment in the get_icon method of ActivityBundle say, ideally we
    should return the icon data.  But that implies a major change in the
    Journal model and views, and in the CellRendererIcon class.
    Signed-off-by: Manuel Quiñones <manuq@laptop.org>
     src/sugar3/bundle/activitybundle.py | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    diff --git a/src/sugar3/bundle/activitybundle.py b/src/sugar3/bundle/activitybundle.py
    index 3895673..53c9da6 100644
    a b class ActivityBundle(Bundle): 
    213213                                                         suffix='.svg')
    214214            os.write(temp_file, icon_data)
    215215            os.close(temp_file)
    216             return util.TempFilePath(temp_file_path)
     216            return temp_file_path
    218218    def get_activity_version(self):
    219219        """Get the activity version"""