Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar
This commit is contained in:
commit
bcbab5612f
@ -48,7 +48,7 @@ class Buddy(dbus.service.Object):
|
|||||||
|
|
||||||
self._icon_cache = icon_cache
|
self._icon_cache = icon_cache
|
||||||
|
|
||||||
self._handle = handle
|
self.handles = {} # tp client -> handle
|
||||||
|
|
||||||
self._nick_name = None
|
self._nick_name = None
|
||||||
self._color = None
|
self._color = None
|
||||||
|
@ -80,6 +80,7 @@ class PresenceService(dbus.service.Object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def _contact_online(self, tp, handle, key):
|
def _contact_online(self, tp, handle, key):
|
||||||
|
new_buddy = False
|
||||||
buddy = self._buddies.get(key)
|
buddy = self._buddies.get(key)
|
||||||
|
|
||||||
if not buddy:
|
if not buddy:
|
||||||
@ -89,21 +90,30 @@ class PresenceService(dbus.service.Object):
|
|||||||
buddy.set_key(key)
|
buddy.set_key(key)
|
||||||
print "create buddy"
|
print "create buddy"
|
||||||
self._buddies[key] = buddy
|
self._buddies[key] = buddy
|
||||||
|
new_buddy = True
|
||||||
|
|
||||||
buddies = self._handles[tp]
|
buddies = self._handles[tp]
|
||||||
buddies[handle] = buddy
|
buddies[handle] = buddy
|
||||||
|
|
||||||
self.BuddyAppeared(buddy.object_path())
|
# store the handle of the buddy for this CM
|
||||||
|
buddy.handles[tp] = handle
|
||||||
|
|
||||||
|
if new_buddy:
|
||||||
|
self.BuddyAppeared(buddy.object_path())
|
||||||
|
|
||||||
def _contact_offline(self, tp, handle):
|
def _contact_offline(self, tp, handle):
|
||||||
buddy = self._handles[tp].pop(handle)
|
buddy = self._handles[tp].pop(handle)
|
||||||
key = buddy.get_key()
|
key = buddy.get_key()
|
||||||
|
|
||||||
# TODO: check if we don't see this buddy using the other CM
|
# the handle of the buddy for this CM is not valid anymore
|
||||||
self._buddies.pop(key)
|
buddy.handles.pop(tp)
|
||||||
print "remove buddy"
|
|
||||||
|
|
||||||
self.BuddyDisappeared(buddy.object_path())
|
if not buddy.handles:
|
||||||
|
# we remove the last handle of the buddy, so we don't see
|
||||||
|
# it anymore.
|
||||||
|
self._buddies.pop(key)
|
||||||
|
print "remove buddy"
|
||||||
|
self.BuddyDisappeared(buddy.object_path())
|
||||||
|
|
||||||
def _get_next_object_id(self):
|
def _get_next_object_id(self):
|
||||||
"""Increment and return the object ID counter."""
|
"""Increment and return the object ID counter."""
|
||||||
|
@ -190,7 +190,6 @@ class ServerPlugin(gobject.GObject):
|
|||||||
not self._ever_connected:
|
not self._ever_connected:
|
||||||
# Hmm; probably aren't registered on the server, try reconnecting
|
# Hmm; probably aren't registered on the server, try reconnecting
|
||||||
# and registering
|
# and registering
|
||||||
self.disconnect()
|
|
||||||
del self._conn
|
del self._conn
|
||||||
self._conn = self._init_connection(register=True)
|
self._conn = self._init_connection(register=True)
|
||||||
self.start()
|
self.start()
|
||||||
|
@ -39,7 +39,7 @@ class Entry(hippo.CanvasBox, hippo.CanvasItem):
|
|||||||
'button-activated': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([int]))
|
'button-activated': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([int]))
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, text=''):
|
||||||
hippo.CanvasBox.__init__(self, orientation=hippo.ORIENTATION_HORIZONTAL)
|
hippo.CanvasBox.__init__(self, orientation=hippo.ORIENTATION_HORIZONTAL)
|
||||||
self.props.yalign = hippo.ALIGNMENT_CENTER
|
self.props.yalign = hippo.ALIGNMENT_CENTER
|
||||||
|
|
||||||
@ -51,6 +51,7 @@ class Entry(hippo.CanvasBox, hippo.CanvasItem):
|
|||||||
|
|
||||||
self._entry = self.create_entry()
|
self._entry = self.create_entry()
|
||||||
self._entry.props.has_frame = False
|
self._entry.props.has_frame = False
|
||||||
|
self._entry.props.text = text
|
||||||
self._update_colors(focused=False)
|
self._update_colors(focused=False)
|
||||||
self._entry.modify_text(gtk.STATE_SELECTED,
|
self._entry.modify_text(gtk.STATE_SELECTED,
|
||||||
color.BLACK.get_gdk_color())
|
color.BLACK.get_gdk_color())
|
||||||
|
@ -3,7 +3,8 @@ import pango
|
|||||||
from sugar.graphics import units
|
from sugar.graphics import units
|
||||||
|
|
||||||
_system_fonts = {
|
_system_fonts = {
|
||||||
'default' : 'Bitstream Vera Sans %d' % units.points_to_pixels(9)
|
'default' : 'Bitstream Vera Sans %d' % units.points_to_pixels(9),
|
||||||
|
'default-bold' : 'Bitstream Vera Sans bold %d' % units.points_to_pixels(9)
|
||||||
}
|
}
|
||||||
|
|
||||||
class Font(object):
|
class Font(object):
|
||||||
@ -21,3 +22,4 @@ class SystemFont(Font):
|
|||||||
Font.__init__(self, _system_fonts[font_id])
|
Font.__init__(self, _system_fonts[font_id])
|
||||||
|
|
||||||
DEFAULT = SystemFont('default')
|
DEFAULT = SystemFont('default')
|
||||||
|
DEFAULT_BOLD = SystemFont('default-bold')
|
||||||
|
@ -1,9 +1,14 @@
|
|||||||
import gobject
|
import gobject
|
||||||
import hippo
|
import hippo
|
||||||
|
|
||||||
|
from sugar.graphics import units
|
||||||
|
|
||||||
class Toolbar(hippo.CanvasBox):
|
class Toolbar(hippo.CanvasBox):
|
||||||
__gtype_name__ = 'Toolbar'
|
__gtype_name__ = 'Toolbar'
|
||||||
|
|
||||||
def __init__(self, orientation=hippo.ORIENTATION_HORIZONTAL):
|
def __init__(self, orientation=hippo.ORIENTATION_HORIZONTAL):
|
||||||
hippo.CanvasBox.__init__(self, orientation=orientation,
|
hippo.CanvasBox.__init__(self, orientation=orientation,
|
||||||
background_color=0x414141ff)
|
background_color=0x414141ff,
|
||||||
|
box_height=units.grid_to_pixels(1),
|
||||||
|
spacing=units.points_to_pixels(5)
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user