Merge presence window and chat in one window
This commit is contained in:
parent
326f372f54
commit
cc66d7d4df
@ -8,7 +8,8 @@ sugar_PYTHON = \
|
|||||||
Emulator.py \
|
Emulator.py \
|
||||||
Owner.py \
|
Owner.py \
|
||||||
HomeWindow.py \
|
HomeWindow.py \
|
||||||
PresenceWindow.py \
|
PeopleWindow.py \
|
||||||
|
PresenceView.py \
|
||||||
Process.py \
|
Process.py \
|
||||||
Session.py \
|
Session.py \
|
||||||
Shell.py
|
Shell.py
|
||||||
|
28
shell/PeopleWindow.py
Normal file
28
shell/PeopleWindow.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import gtk
|
||||||
|
|
||||||
|
from sugar.chat.ActivityChat import ActivityChat
|
||||||
|
from PresenceView import PresenceView
|
||||||
|
|
||||||
|
class PeopleWindow(gtk.Window):
|
||||||
|
def __init__(self, shell, activity):
|
||||||
|
gtk.Window.__init__(self)
|
||||||
|
|
||||||
|
self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
|
||||||
|
self.set_skip_taskbar_hint(True)
|
||||||
|
self.set_decorated(False)
|
||||||
|
self.set_default_size(620, 460)
|
||||||
|
|
||||||
|
hbox = gtk.HBox(False, 12)
|
||||||
|
hbox.set_border_width(12)
|
||||||
|
|
||||||
|
presence_view = PresenceView(shell)
|
||||||
|
presence_view.set_activity(activity)
|
||||||
|
hbox.pack_start(presence_view, False)
|
||||||
|
presence_view.show()
|
||||||
|
|
||||||
|
chat = ActivityChat(activity)
|
||||||
|
hbox.pack_start(chat)
|
||||||
|
chat.show()
|
||||||
|
|
||||||
|
self.add(hbox)
|
||||||
|
hbox.show()
|
@ -10,14 +10,14 @@ from sugar.chat.BuddyChat import BuddyChat
|
|||||||
|
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
class PresenceWindow(gtk.Window):
|
class PresenceView(gtk.VBox):
|
||||||
_MODEL_COL_NICK = 0
|
_MODEL_COL_NICK = 0
|
||||||
_MODEL_COL_ICON = 1
|
_MODEL_COL_ICON = 1
|
||||||
_MODEL_COL_BUDDY = 2
|
_MODEL_COL_BUDDY = 2
|
||||||
_MODEL_COL_VISIBLE = 3
|
_MODEL_COL_VISIBLE = 3
|
||||||
|
|
||||||
def __init__(self, shell):
|
def __init__(self, shell):
|
||||||
gtk.Window.__init__(self)
|
gtk.VBox.__init__(self, False, 6)
|
||||||
|
|
||||||
self._activity = None
|
self._activity = None
|
||||||
self._shell = shell
|
self._shell = shell
|
||||||
@ -55,12 +55,11 @@ class PresenceWindow(gtk.Window):
|
|||||||
self._share_button.set_sensitive(False)
|
self._share_button.set_sensitive(False)
|
||||||
|
|
||||||
def _setup_ui(self):
|
def _setup_ui(self):
|
||||||
vbox = gtk.VBox(False, 6)
|
self.set_size_request(120, -1)
|
||||||
vbox.set_border_width(12)
|
|
||||||
|
|
||||||
label = gtk.Label(_("Who's around:"))
|
label = gtk.Label(_("Who's around:"))
|
||||||
label.set_alignment(0.0, 0.5)
|
label.set_alignment(0.0, 0.5)
|
||||||
vbox.pack_start(label, False)
|
self.pack_start(label, False)
|
||||||
label.show()
|
label.show()
|
||||||
|
|
||||||
self._buddy_store = gtk.ListStore(gobject.TYPE_STRING,
|
self._buddy_store = gtk.ListStore(gobject.TYPE_STRING,
|
||||||
@ -95,7 +94,7 @@ class PresenceWindow(gtk.Window):
|
|||||||
column.set_expand(True);
|
column.set_expand(True);
|
||||||
self._buddy_list_view.append_column(column)
|
self._buddy_list_view.append_column(column)
|
||||||
|
|
||||||
vbox.pack_start(sw)
|
self.pack_start(sw)
|
||||||
sw.show()
|
sw.show()
|
||||||
|
|
||||||
button_box = gtk.HButtonBox()
|
button_box = gtk.HButtonBox()
|
||||||
@ -105,12 +104,9 @@ class PresenceWindow(gtk.Window):
|
|||||||
button_box.pack_start(self._share_button)
|
button_box.pack_start(self._share_button)
|
||||||
self._share_button.show()
|
self._share_button.show()
|
||||||
|
|
||||||
vbox.pack_start(button_box, False)
|
self.pack_start(button_box, False)
|
||||||
button_box.show()
|
button_box.show()
|
||||||
|
|
||||||
self.add(vbox)
|
|
||||||
vbox.show()
|
|
||||||
|
|
||||||
def _share_button_clicked_cb(self, button):
|
def _share_button_clicked_cb(self, button):
|
||||||
self._shell.get_current_activity().publish()
|
self._shell.get_current_activity().publish()
|
||||||
|
|
@ -12,8 +12,7 @@ from HomeWindow import HomeWindow
|
|||||||
from sugar import keybindings
|
from sugar import keybindings
|
||||||
from sugar import env
|
from sugar import env
|
||||||
from sugar.activity import Activity
|
from sugar.activity import Activity
|
||||||
from PresenceWindow import PresenceWindow
|
from PeopleWindow import PeopleWindow
|
||||||
from sugar.chat.ActivityChat import ActivityChat
|
|
||||||
from Owner import ShellOwner
|
from Owner import ShellOwner
|
||||||
|
|
||||||
class ShellDbusService(dbus.service.Object):
|
class ShellDbusService(dbus.service.Object):
|
||||||
@ -61,13 +60,7 @@ class Shell:
|
|||||||
keybindings.setup_global_keys(self._home_window, self)
|
keybindings.setup_global_keys(self._home_window, self)
|
||||||
self._home_window.show()
|
self._home_window.show()
|
||||||
|
|
||||||
self._presence_window = PresenceWindow(self)
|
self._people_windows = {}
|
||||||
self._presence_window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
|
|
||||||
self._presence_window.set_skip_taskbar_hint(True)
|
|
||||||
self._presence_window.set_decorated(False)
|
|
||||||
keybindings.setup_global_keys(self._presence_window, self)
|
|
||||||
|
|
||||||
self._chat_windows = {}
|
|
||||||
|
|
||||||
def _toggle_window_visibility(self, window):
|
def _toggle_window_visibility(self, window):
|
||||||
if window.get_property('visible'):
|
if window.get_property('visible'):
|
||||||
@ -103,28 +96,15 @@ class Shell:
|
|||||||
if activity:
|
if activity:
|
||||||
activity_id = activity.get_id()
|
activity_id = activity.get_id()
|
||||||
|
|
||||||
if not self._chat_windows.has_key(activity_id):
|
if not self._people_windows.has_key(activity_id):
|
||||||
window = gtk.Window()
|
window = PeopleWindow(self, activity)
|
||||||
window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
|
|
||||||
window.set_skip_taskbar_hint(True)
|
|
||||||
window.set_decorated(False)
|
|
||||||
keybindings.setup_global_keys(window, self)
|
keybindings.setup_global_keys(window, self)
|
||||||
chat = ActivityChat(activity)
|
self._people_windows[activity_id] = window
|
||||||
window.add(chat)
|
|
||||||
chat.show()
|
|
||||||
self._chat_windows[activity_id] = window
|
|
||||||
else:
|
else:
|
||||||
window = self._chat_windows[activity_id]
|
window = self._people_windows[activity_id]
|
||||||
|
|
||||||
window.move(210, 10)
|
|
||||||
window.resize(380, 440)
|
|
||||||
self._toggle_window_visibility(window)
|
self._toggle_window_visibility(window)
|
||||||
|
|
||||||
self._presence_window.move(10, 10)
|
|
||||||
self._presence_window.resize(180, 440)
|
|
||||||
self._presence_window.set_activity(activity)
|
|
||||||
self._toggle_window_visibility(self._presence_window)
|
|
||||||
|
|
||||||
def toggle_console(self):
|
def toggle_console(self):
|
||||||
self._toggle_window_visibility(self._console.get_window())
|
self._toggle_window_visibility(self._console.get_window())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user