Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorDan Williams <dcbw@localhost.localdomain>2006-09-28 19:52:56 (GMT)
committer Dan Williams <dcbw@localhost.localdomain>2006-09-28 19:52:56 (GMT)
commit5a6a0d2d7d13613b2cb312bca41c36dc608ea032 (patch)
treebe33abf1682ea7d68923d172c28ad68453500dd2 /shell
parente95e6c2a4e9a721b03e7ba16f9f14d8f00750005 (diff)
Start making activity chat work; hit F9 to activate
Diffstat (limited to 'shell')
-rw-r--r--shell/view/ActivityHost.py37
-rw-r--r--shell/view/Shell.py11
2 files changed, 48 insertions, 0 deletions
diff --git a/shell/view/ActivityHost.py b/shell/view/ActivityHost.py
index 0845448..4524f56 100644
--- a/shell/view/ActivityHost.py
+++ b/shell/view/ActivityHost.py
@@ -7,10 +7,26 @@ from sugar.presence import PresenceService
from sugar.canvas.IconColor import IconColor
from sugar.p2p import Stream
from sugar.p2p import network
+from sugar.chat import ActivityChat
+
+class ActivityChatWindow(gtk.Window):
+ def __init__(self, gdk_window, chat_widget):
+ gtk.Window.__init__(self)
+
+ self.set_decorated(False)
+ self.realize()
+ self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
+ self.window.set_accept_focus(True)
+ self.window.set_transient_for(gdk_window)
+
+ self.add(chat_widget)
class ActivityHost:
def __init__(self, shell, window):
self._shell = shell
+ self._shell.connect('activity-changed', self._activity_changed_cb)
+ self._shell.connect('activity-closed', self._activity_closed_cb)
+
self._window = window
self._xid = window.get_xid()
self._pservice = PresenceService.get_instance()
@@ -28,6 +44,9 @@ class ActivityHost:
info = registry.get_activity(self._type)
self._icon_name = info.get_icon()
+ self._chat_widget = ActivityChat.ActivityChat(self)
+ self._chat_window = ActivityChatWindow(self._gdk_window, self._chat_widget)
+
def get_id(self):
return self._id
@@ -76,3 +95,21 @@ class ActivityHost:
def show_dialog(self, dialog):
dialog.show()
dialog.window.set_transient_for(self._gdk_window)
+
+ def chat_show(self):
+ self._chat_window.show_all()
+
+ def chat_hide(self):
+ self._chat_window.hide()
+
+ def is_chat_visible(self):
+ return self._chat_window.get_property('visible')
+
+ def _activity_changed_cb(self, shell, activity):
+ if activity != self:
+ self.chat_hide()
+
+ def _activity_closed_cb(self, shell, activity):
+ if activity == self:
+ self.chat_hide()
+
diff --git a/shell/view/Shell.py b/shell/view/Shell.py
index 0b54e19..e5274b8 100644
--- a/shell/view/Shell.py
+++ b/shell/view/Shell.py
@@ -41,6 +41,7 @@ class Shell(gobject.GObject):
self._key_grabber.grab('F4')
self._key_grabber.grab('F5')
self._key_grabber.grab('F6')
+ self._key_grabber.grab('F9')
self._home_window = HomeWindow(self)
self._home_window.show()
@@ -67,6 +68,8 @@ class Shell(gobject.GObject):
self._frame.notify_key_press()
elif key == 'F6':
self.start_activity('org.sugar.Terminal')
+ elif key == 'F9':
+ self._show_hide_activity_chat()
def __global_key_released_cb(self, grabber, key):
if key == 'F5':
@@ -147,3 +150,11 @@ class Shell(gobject.GObject):
if host.get_id() == activity_id:
return host
return None
+
+ def _show_hide_activity_chat(self):
+ act = self.get_current_activity()
+ if act:
+ if act.is_chat_visible():
+ act.chat_hide()
+ else:
+ act.chat_show()