Ticket #3989: 0002-Port-icons-in-canvas-from-EventIcon-to-CanvasIcon-fo.patch

File 0002-Port-icons-in-canvas-from-EventIcon-to-CanvasIcon-fo.patch, 8.3 KB (added by manuq, 10 years ago)

Shell second patch.

  • extensions/cpsection/aboutme/view.py

    From d4987131efeef4ec98bc971ad59e842d7f2f3f0a Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <manuq@laptop.org>
    Date: Wed, 10 Oct 2012 17:07:46 -0300
    Subject: [PATCH shell 2/2] Port icons in canvas from EventIcon to CanvasIcon
     for press and hover feedback - SL #3989
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    Mail-Followup-To: <sugar-devel@lists.sugarlabs.org>
    
    Except for the pulsing icon EventPulsingIcon that is informatinal
    only.
    
    Signed-off-by: Manuel Quiñones <manuq@laptop.org>
    ---
     extensions/cpsection/aboutme/view.py |  8 ++++----
     src/jarabe/desktop/favoritesview.py  |  6 +++---
     src/jarabe/desktop/friendview.py     |  4 ++--
     src/jarabe/desktop/meshbox.py        |  9 +++++----
     src/jarabe/journal/expandedentry.py  | 10 +++++-----
     src/jarabe/view/buddyicon.py         | 12 +++++++-----
     6 files changed, 26 insertions(+), 23 deletions(-)
    
    diff --git a/extensions/cpsection/aboutme/view.py b/extensions/cpsection/aboutme/view.py
    index 293923d..3cbd93e 100644
    a b from gettext import gettext as _ 
    2121
    2222from sugar3.graphics import style
    2323from sugar3.graphics.xocolor import XoColor, colors
    24 from sugar3.graphics.icon import EventIcon
     24from sugar3.graphics.icon import CanvasIcon
    2525
    2626from jarabe.controlpanel.sectionview import SectionView
    2727from jarabe.controlpanel.inlinealert import InlineAlert
    _NEXT_STROKE_COLOR = 3 
    111111_PREVIOUS_STROKE_COLOR = 4
    112112
    113113
    114 class ColorPicker(EventIcon):
     114class ColorPicker(CanvasIcon):
    115115    __gsignals__ = {
    116116        'color-changed': (GObject.SignalFlags.RUN_FIRST,
    117117                          None,
    class ColorPicker(EventIcon): 
    119119        }
    120120
    121121    def __init__(self, picker):
    122         EventIcon.__init__(self, icon_name='computer-xo',
    123                            pixel_size=style.XLARGE_ICON_SIZE)
     122        CanvasIcon.__init__(self, icon_name='computer-xo',
     123                            pixel_size=style.XLARGE_ICON_SIZE)
    124124        self._picker = picker
    125125        self._color = None
    126126
  • src/jarabe/desktop/favoritesview.py

    diff --git a/src/jarabe/desktop/favoritesview.py b/src/jarabe/desktop/favoritesview.py
    index d16b95e..056a4aa 100644
    a b from gi.repository import GdkPixbuf 
    2828
    2929from sugar3.graphics import style
    3030from sugar3.graphics.icon import Icon
    31 from sugar3.graphics.icon import EventIcon
    3231from sugar3.graphics.icon import CanvasIcon
    3332from sugar3.graphics.menuitem import MenuItem
    3433from sugar3.graphics.alert import Alert
    class FavoritePalette(ActivityPalette): 
    540539            self.emit('entry-activate', entry)
    541540
    542541
    543 class CurrentActivityIcon(EventIcon):
     542class CurrentActivityIcon(CanvasIcon):
    544543    def __init__(self):
    545         EventIcon.__init__(self, icon_name='activity-journal',
     544        CanvasIcon.__init__(self, icon_name='activity-journal',
    546545                            pixel_size=style.STANDARD_ICON_SIZE, cache=True)
    547546        self._home_model = shell.get_model()
    548547        self._home_activity = self._home_model.get_active_activity()
    class CurrentActivityIcon(EventIcon): 
    574573            palette = JournalPalette(self._home_activity)
    575574        else:
    576575            palette = CurrentActivityPalette(self._home_activity)
     576        self.connect_palette_pop_events(palette)
    577577        return palette
    578578
    579579    def __active_activity_changed_cb(self, home_model, home_activity):
  • src/jarabe/desktop/friendview.py

    diff --git a/src/jarabe/desktop/friendview.py b/src/jarabe/desktop/friendview.py
    index 77f4b6e..3d2249b 100644
    a b  
    1818from gi.repository import Gtk
    1919
    2020from sugar3.graphics import style
    21 from sugar3.graphics.icon import EventIcon
     21from sugar3.graphics.icon import CanvasIcon
    2222
    2323from jarabe.view.buddyicon import BuddyIcon
    2424from jarabe.model import bundleregistry
    class FriendView(Gtk.VBox): 
    3838        self.add(self._buddy_icon)
    3939        self._buddy_icon.show()
    4040
    41         self._activity_icon = EventIcon(pixel_size=size)
     41        self._activity_icon = CanvasIcon(pixel_size=size)
    4242        self._update_activity()
    4343
    4444        self._buddy.connect('notify::current-activity',
  • src/jarabe/desktop/meshbox.py

    diff --git a/src/jarabe/desktop/meshbox.py b/src/jarabe/desktop/meshbox.py
    index 24d445c..0b1c43d 100644
    a b from gi.repository import Gtk 
    2727from gi.repository import GConf
    2828
    2929from sugar3.graphics.icon import Icon
    30 from sugar3.graphics.icon import EventIcon
     30from sugar3.graphics.icon import CanvasIcon
    3131from sugar3.graphics import style
    3232from sugar3.graphics import palette
    3333from sugar3.graphics.menuitem import MenuItem
    _OLPC_MESH_ICON_NAME = 'network-mesh' 
    5555_FILTERED_ALPHA = 0.33
    5656
    5757
    58 class _ActivityIcon(EventIcon):
     58class _ActivityIcon(CanvasIcon):
    5959    def __init__(self, model, file_name, xo_color,
    6060                 size=style.STANDARD_ICON_SIZE):
    61         EventIcon.__init__(self, file_name=file_name,
    62                            xo_color=xo_color, pixel_size=size)
     61        CanvasIcon.__init__(self, file_name=file_name,
     62                            xo_color=xo_color, pixel_size=size)
    6363        self._model = model
    6464        self.connect('button-release-event',
    6565                     self.__button_release_event_cb)
    class _ActivityIcon(EventIcon): 
    8989            item.show()
    9090            p.menu.append(item)
    9191
     92        self.connect_palette_pop_events(p)
    9293        return p
    9394
    9495    def __button_release_event_cb(self, widget, event):
  • src/jarabe/journal/expandedentry.py

    diff --git a/src/jarabe/journal/expandedentry.py b/src/jarabe/journal/expandedentry.py
    index 8144980..21c0672 100644
    a b import simplejson 
    2929
    3030from sugar3.graphics import style
    3131from sugar3.graphics.xocolor import XoColor
    32 from sugar3.graphics.icon import EventIcon
     32from sugar3.graphics.icon import CanvasIcon
    3333from sugar3.util import format_size
    3434
    3535from jarabe.journal.keepicon import KeepIcon
    class BuddyList(Gtk.Alignment): 
    5151        hbox = Gtk.HBox()
    5252        for buddy in buddies:
    5353            nick_, color = buddy
    54             icon = EventIcon(icon_name='computer-xo',
    55                              xo_color=XoColor(color),
    56                              pixel_size=style.STANDARD_ICON_SIZE)
     54            icon = CanvasIcon(icon_name='computer-xo',
     55                              xo_color=XoColor(color),
     56                              pixel_size=style.STANDARD_ICON_SIZE)
    5757            icon.set_palette(BuddyPalette(buddy))
    5858            hbox.pack_start(icon, True, True, 0)
    5959        self.add(hbox)
    class ExpandedEntry(Gtk.EventBox): 
    171171        return keep_icon
    172172
    173173    def _create_icon(self):
    174         icon = EventIcon(file_name=misc.get_icon_name(self._metadata))
     174        icon = CanvasIcon(file_name=misc.get_icon_name(self._metadata))
    175175        icon.connect_after('button-release-event',
    176176                           self._icon_button_release_event_cb)
    177177
  • src/jarabe/view/buddyicon.py

    diff --git a/src/jarabe/view/buddyicon.py b/src/jarabe/view/buddyicon.py
    index e28fc14..fc7213a 100644
    a b  
    1616
    1717from sugar3.graphics import style
    1818from sugar3.graphics.palette import Palette
    19 from sugar3.graphics.icon import EventIcon
     19from sugar3.graphics.icon import CanvasIcon
    2020
    2121from jarabe.view.buddymenu import BuddyMenu
    2222from jarabe.util.normalize import normalize_string
    from jarabe.util.normalize import normalize_string 
    2525_FILTERED_ALPHA = 0.33
    2626
    2727
    28 class BuddyIcon(EventIcon):
     28class BuddyIcon(CanvasIcon):
    2929    def __init__(self, buddy, pixel_size=style.STANDARD_ICON_SIZE):
    30         EventIcon.__init__(self, icon_name='computer-xo',
    31                            pixel_size=pixel_size)
     30        CanvasIcon.__init__(self, icon_name='computer-xo',
     31                            pixel_size=pixel_size)
    3232
    3333        self._filtered = False
    3434        self._buddy = buddy
    class BuddyIcon(EventIcon): 
    4242        self._update_color()
    4343
    4444    def create_palette(self):
    45         return BuddyMenu(self._buddy)
     45        palette = BuddyMenu(self._buddy)
     46        self.connect_palette_pop_events(palette)
     47        return palette
    4648
    4749    def __button_release_event_cb(self, icon, event):
    4850        self.props.palette.popup(immediate=True, state=Palette.SECONDARY)