Tray size allocation fixes.
This commit is contained in:
parent
0512ae5853
commit
710f3eba00
@ -54,7 +54,7 @@ class ActivitiesBox(hippo.CanvasBox):
|
|||||||
self._invites = self._shell_model.get_invites()
|
self._invites = self._shell_model.get_invites()
|
||||||
|
|
||||||
self.tray = HTray()
|
self.tray = HTray()
|
||||||
self.append(hippo.CanvasWidget(widget=self.tray))
|
self.append(hippo.CanvasWidget(widget=self.tray), hippo.PACK_EXPAND)
|
||||||
self.tray.show()
|
self.tray.show()
|
||||||
|
|
||||||
registry = activity.get_registry()
|
registry = activity.get_registry()
|
||||||
@ -87,8 +87,7 @@ class ActivitiesBox(hippo.CanvasBox):
|
|||||||
self.remove_invite(invite)
|
self.remove_invite(invite)
|
||||||
|
|
||||||
def _activity_removed_cb(self, item):
|
def _activity_removed_cb(self, item):
|
||||||
index = self.tray.get_item_index(item)
|
self.tray.remove_item(item)
|
||||||
self.tray.remove_item(index)
|
|
||||||
|
|
||||||
def _activity_added_cb(self, activity_registry, activity_info):
|
def _activity_added_cb(self, activity_registry, activity_info):
|
||||||
self.add_activity(activity_info)
|
self.add_activity(activity_info)
|
||||||
|
@ -222,7 +222,7 @@ class Frame(object):
|
|||||||
panel = self._create_panel(gtk.POS_BOTTOM)
|
panel = self._create_panel(gtk.POS_BOTTOM)
|
||||||
|
|
||||||
box = ActivitiesBox(self._shell)
|
box = ActivitiesBox(self._shell)
|
||||||
panel.append(box)
|
panel.append(box, hippo.PACK_EXPAND)
|
||||||
|
|
||||||
return panel
|
return panel
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
import gobject
|
import gobject
|
||||||
import gtk
|
import gtk
|
||||||
|
|
||||||
|
from sugar.graphics import style
|
||||||
from sugar.graphics.toolbutton import ToolButton
|
from sugar.graphics.toolbutton import ToolButton
|
||||||
from sugar.graphics.icon import Icon
|
from sugar.graphics.icon import Icon
|
||||||
|
|
||||||
@ -51,6 +52,11 @@ class _TrayViewport(gtk.Viewport):
|
|||||||
new_value = adj.value - self.allocation.width
|
new_value = adj.value - self.allocation.width
|
||||||
adj.value = max(adj.lower, new_value)
|
adj.value = max(adj.lower, new_value)
|
||||||
|
|
||||||
|
def do_size_request(self, requisition):
|
||||||
|
child_requisition = self.child.size_request()
|
||||||
|
requisition[0] = 0
|
||||||
|
requisition[1] = child_requisition[1]
|
||||||
|
|
||||||
def do_get_property(self, pspec):
|
def do_get_property(self, pspec):
|
||||||
if pspec.name == 'can-scroll':
|
if pspec.name == 'can-scroll':
|
||||||
return self._can_scroll
|
return self._can_scroll
|
||||||
@ -66,18 +72,24 @@ class _TrayViewport(gtk.Viewport):
|
|||||||
self._can_scroll = can_scroll
|
self._can_scroll = can_scroll
|
||||||
self.notify('can-scroll')
|
self.notify('can-scroll')
|
||||||
|
|
||||||
|
class _TrayScrollButton(gtk.Button):
|
||||||
|
def __init__(self, icon_name):
|
||||||
|
gobject.GObject.__init__(self)
|
||||||
|
|
||||||
|
self.set_relief(gtk.RELIEF_NONE)
|
||||||
|
self.set_size_request(style.GRID_CELL_SIZE, style.GRID_CELL_SIZE)
|
||||||
|
|
||||||
|
icon = Icon(icon_name = icon_name,
|
||||||
|
icon_size=gtk.ICON_SIZE_SMALL_TOOLBAR)
|
||||||
|
self.set_image(icon)
|
||||||
|
icon.show()
|
||||||
|
|
||||||
class HTray(gtk.HBox):
|
class HTray(gtk.HBox):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
gobject.GObject.__init__(self, **kwargs)
|
gobject.GObject.__init__(self, **kwargs)
|
||||||
|
|
||||||
self._scroll_left = gtk.Button()
|
self._scroll_left = _TrayScrollButton('go-left')
|
||||||
self._scroll_left.set_relief(gtk.RELIEF_NONE)
|
|
||||||
self._scroll_left.connect('clicked', self._scroll_left_cb)
|
self._scroll_left.connect('clicked', self._scroll_left_cb)
|
||||||
|
|
||||||
icon = Icon(icon_name='go-left', icon_size=gtk.ICON_SIZE_MENU)
|
|
||||||
self._scroll_left.set_image(icon)
|
|
||||||
icon.show()
|
|
||||||
|
|
||||||
self.pack_start(self._scroll_left, False)
|
self.pack_start(self._scroll_left, False)
|
||||||
|
|
||||||
self._viewport = _TrayViewport()
|
self._viewport = _TrayViewport()
|
||||||
@ -86,14 +98,8 @@ class HTray(gtk.HBox):
|
|||||||
self.pack_start(self._viewport)
|
self.pack_start(self._viewport)
|
||||||
self._viewport.show()
|
self._viewport.show()
|
||||||
|
|
||||||
self._scroll_right = gtk.Button()
|
self._scroll_right = _TrayScrollButton('go-right')
|
||||||
self._scroll_right.set_relief(gtk.RELIEF_NONE)
|
|
||||||
self._scroll_right.connect('clicked', self._scroll_right_cb)
|
self._scroll_right.connect('clicked', self._scroll_right_cb)
|
||||||
|
|
||||||
icon = Icon(icon_name='go-right', icon_size=gtk.ICON_SIZE_MENU)
|
|
||||||
self._scroll_right.set_image(icon)
|
|
||||||
icon.show()
|
|
||||||
|
|
||||||
self.pack_start(self._scroll_right, False)
|
self.pack_start(self._scroll_right, False)
|
||||||
|
|
||||||
def _viewport_can_scroll_changed_cb(self, viewport, pspec):
|
def _viewport_can_scroll_changed_cb(self, viewport, pspec):
|
||||||
|
Loading…
Reference in New Issue
Block a user