Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2006-09-28 22:24:12 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2006-09-28 22:24:12 (GMT)
commit1e750071610c988324ea5848598823eefe7dfaea (patch)
tree5311770ed2b8128fa6dad9ebe50f66ea9e3c306b /shell
parent4f2b8b3e31ed29c5eece4126f224216c0d30b04c (diff)
parentba05afdc535278101b134d6c1c66e8ab0fe482be (diff)
Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar
Diffstat (limited to 'shell')
-rw-r--r--shell/view/ActivityHost.py47
-rw-r--r--shell/view/BuddyMenu.py2
-rw-r--r--shell/view/Shell.py17
-rw-r--r--shell/view/frame/Frame.py9
4 files changed, 72 insertions, 3 deletions
diff --git a/shell/view/ActivityHost.py b/shell/view/ActivityHost.py
index 0845448..a9d55ea 100644
--- a/shell/view/ActivityHost.py
+++ b/shell/view/ActivityHost.py
@@ -7,10 +7,25 @@ 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.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.set_position(gtk.WIN_POS_CENTER_ALWAYS)
+ self.set_default_size(600, 450)
+
+ self.add(chat_widget)
class ActivityHost:
def __init__(self, shell, window):
self._shell = shell
+
self._window = window
self._xid = window.get_xid()
self._pservice = PresenceService.get_instance()
@@ -28,6 +43,13 @@ 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)
+
+ self._frame_was_visible = False
+ self._shell.connect('activity-changed', self._activity_changed_cb)
+ self._shell.connect('activity-closed', self._activity_closed_cb)
+
def get_id(self):
return self._id
@@ -49,6 +71,7 @@ class ActivityHost:
def share(self):
self._activity.share()
+ self._chat_widget.share()
def invite(self, buddy):
if not self.get_shared():
@@ -76,3 +99,27 @@ class ActivityHost:
def show_dialog(self, dialog):
dialog.show()
dialog.window.set_transient_for(self._gdk_window)
+
+ def chat_show(self, frame_was_visible):
+ self._chat_window.show_all()
+ self._frame_was_visible = frame_was_visible
+
+ def chat_hide(self):
+ self._chat_window.hide()
+ wasvis = self._frame_was_visible
+ self._frame_was_visible = False
+ return wasvis
+
+ 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()
+ self._frame_was_visible = False
+
+ def _activity_closed_cb(self, shell, activity):
+ if activity == self:
+ self.chat_hide()
+ self._frame_was_visible = False
+
diff --git a/shell/view/BuddyMenu.py b/shell/view/BuddyMenu.py
index 25d64d1..3b8752a 100644
--- a/shell/view/BuddyMenu.py
+++ b/shell/view/BuddyMenu.py
@@ -1,7 +1,7 @@
from sugar.canvas.Menu import Menu
from sugar.canvas.IconItem import IconItem
from sugar.presence import PresenceService
-import gtk
+import gtk, gobject
import goocanvas
_ICON_SIZE = 75
diff --git a/shell/view/Shell.py b/shell/view/Shell.py
index 0b54e19..c9a2c4d 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,17 @@ 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 not act:
+ return
+ is_visible = self._frame.is_visible()
+ if act.is_chat_visible():
+ frame_was_visible = act.chat_hide()
+ if not frame_was_visible:
+ self._frame.do_slide_out()
+ else:
+ if not is_visible:
+ self._frame.do_slide_in()
+ act.chat_show(is_visible)
diff --git a/shell/view/frame/Frame.py b/shell/view/frame/Frame.py
index ef0077a..0206080 100644
--- a/shell/view/frame/Frame.py
+++ b/shell/view/frame/Frame.py
@@ -210,14 +210,19 @@ class Frame:
if self._mode == Frame.TEMPORARY:
self._timeline.play('before_slide_out', 'slide_out')
- def do_slide_in(self, current, n_frames):
+ def do_slide_in(self, current=0, n_frames=0):
if not self._windows[0].props.visible:
for panel in self._windows:
panel.show()
self._event_frame.hide()
- def do_slide_out(self, current, n_frames):
+ def do_slide_out(self, current=0, n_frames=0):
if self._windows[0].props.visible:
for panel in self._windows:
panel.hide()
self._event_frame.show()
+
+ def is_visible(self):
+ if self._windows[0].props.visible:
+ return True
+ return False