Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar

This commit is contained in:
Marco Pesenti Gritti 2006-10-01 19:06:09 +02:00
commit be70008c07
4 changed files with 57 additions and 5 deletions

View File

@ -397,10 +397,14 @@ class Service(gobject.GObject):
logging.debug("Will register service with name='%s', stype='%s'," \ logging.debug("Will register service with name='%s', stype='%s'," \
" domain='%s', address='%s', port=%d, info='%s'" % (self._full_name, " domain='%s', address='%s', port=%d, info='%s'" % (self._full_name,
self._stype, self._domain, self._address, self._port, info)) self._stype, self._domain, self._address, self._port, info))
self._avahi_entry_group.AddService(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, 0, try:
dbus.String(self._full_name), dbus.String(self._stype), self._avahi_entry_group.AddService(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, 0,
dbus.String(self._domain), dbus.String(""), # let Avahi figure the 'host' out dbus.String(self._full_name), dbus.String(self._stype),
dbus.UInt16(self._port), info) dbus.String(self._domain), dbus.String(""), # let Avahi figure the 'host' out
dbus.UInt16(self._port), info)
except dbus.DBusException, exc:
# Local name collision and stuff
pass
self._avahi_entry_group.connect_to_signal('StateChanged', self.__entry_group_changed_cb) self._avahi_entry_group.connect_to_signal('StateChanged', self.__entry_group_changed_cb)
self._avahi_entry_group.Commit() self._avahi_entry_group.Commit()

View File

@ -8,12 +8,14 @@ from sugar.canvas.IconColor import IconColor
from sugar.p2p import Stream from sugar.p2p import Stream
from sugar.p2p import network from sugar.p2p import network
from sugar.chat import ActivityChat from sugar.chat import ActivityChat
import OverlayWindow
class ActivityChatWindow(gtk.Window): class ActivityChatWindow(gtk.Window):
def __init__(self, gdk_window, chat_widget): def __init__(self, gdk_window, chat_widget):
gtk.Window.__init__(self) gtk.Window.__init__(self)
self.realize() self.realize()
self.set_decorated(False)
self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG) self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
self.window.set_accept_focus(True) self.window.set_accept_focus(True)
self.window.set_transient_for(gdk_window) self.window.set_transient_for(gdk_window)
@ -43,8 +45,15 @@ class ActivityHost:
info = registry.get_activity(self._type) info = registry.get_activity(self._type)
self._icon_name = info.get_icon() self._icon_name = info.get_icon()
try:
self._overlay_window = OverlayWindow.OverlayWindow(self._gdk_window)
win = self._overlay_window.window
except RuntimeError:
self._overlay_window = None
win = self._gdk_window
self._chat_widget = ActivityChat.ActivityChat(self) self._chat_widget = ActivityChat.ActivityChat(self)
self._chat_window = ActivityChatWindow(self._gdk_window, self._chat_widget) self._chat_window = ActivityChatWindow(win, self._chat_widget)
self._frame_was_visible = False self._frame_was_visible = False
self._shell.connect('activity-changed', self._activity_changed_cb) self._shell.connect('activity-changed', self._activity_changed_cb)
@ -101,11 +110,15 @@ class ActivityHost:
dialog.window.set_transient_for(self._gdk_window) dialog.window.set_transient_for(self._gdk_window)
def chat_show(self, frame_was_visible): def chat_show(self, frame_was_visible):
if self._overlay_window:
self._overlay_window.show_all()
self._chat_window.show_all() self._chat_window.show_all()
self._frame_was_visible = frame_was_visible self._frame_was_visible = frame_was_visible
def chat_hide(self): def chat_hide(self):
self._chat_window.hide() self._chat_window.hide()
if self._overlay_window:
self._overlay_window.hide()
wasvis = self._frame_was_visible wasvis = self._frame_was_visible
self._frame_was_visible = False self._frame_was_visible = False
return wasvis return wasvis

View File

@ -9,4 +9,5 @@ sugar_PYTHON = \
FirstTimeDialog.py \ FirstTimeDialog.py \
BuddyIcon.py \ BuddyIcon.py \
BuddyMenu.py \ BuddyMenu.py \
OverlayWindow.py \
Shell.py Shell.py

View File

@ -0,0 +1,34 @@
import gtk
import cairo
class OverlayWindow(gtk.Window):
def __init__(self, lower_window):
gtk.Window.__init__(self)
colormap = self.get_screen().get_rgba_colormap()
colormap=None
if not colormap:
raise RuntimeError("The window manager doesn't support compositing.")
self.set_colormap(colormap)
self.realize()
self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
self.window.set_accept_focus(False)
self.window.set_transient_for(lower_window)
self.set_decorated(False)
self.set_position(gtk.WIN_POS_CENTER_ALWAYS)
self.set_default_size(gtk.gdk.screen_width(), gtk.gdk.screen_height())
self.set_app_paintable(True)
self.connect('expose-event', self._expose_cb)
def _expose_cb(self, widget, event):
cr = widget.window.cairo_create()
cr.set_source_rgba(0.0, 0.0, 0.0, 0.4) # Transparent
cr.set_operator(cairo.OPERATOR_SOURCE)
cr.paint()
return False