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			\
 | ||||
| 	Owner.py			\
 | ||||
| 	HomeWindow.py			\
 | ||||
| 	PresenceWindow.py		\
 | ||||
| 	PeopleWindow.py			\
 | ||||
| 	PresenceView.py			\
 | ||||
| 	Process.py			\
 | ||||
| 	Session.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 _ | ||||
| 
 | ||||
| class PresenceWindow(gtk.Window): | ||||
| class PresenceView(gtk.VBox): | ||||
| 	_MODEL_COL_NICK = 0 | ||||
| 	_MODEL_COL_ICON = 1 | ||||
| 	_MODEL_COL_BUDDY = 2 | ||||
| 	_MODEL_COL_VISIBLE = 3 | ||||
| 		 | ||||
| 	def __init__(self, shell): | ||||
| 		gtk.Window.__init__(self) | ||||
| 		gtk.VBox.__init__(self, False, 6) | ||||
| 		 | ||||
| 		self._activity = None | ||||
| 		self._shell = shell | ||||
| @ -55,12 +55,11 @@ class PresenceWindow(gtk.Window): | ||||
| 			self._share_button.set_sensitive(False) | ||||
| 
 | ||||
| 	def _setup_ui(self): | ||||
| 		vbox = gtk.VBox(False, 6) | ||||
| 		vbox.set_border_width(12) | ||||
| 		 | ||||
| 		self.set_size_request(120, -1) | ||||
| 
 | ||||
| 		label = gtk.Label(_("Who's around:")) | ||||
| 		label.set_alignment(0.0, 0.5) | ||||
| 		vbox.pack_start(label, False) | ||||
| 		self.pack_start(label, False) | ||||
| 		label.show() | ||||
| 
 | ||||
| 		self._buddy_store = gtk.ListStore(gobject.TYPE_STRING, | ||||
| @ -95,7 +94,7 @@ class PresenceWindow(gtk.Window): | ||||
| 		column.set_expand(True); | ||||
| 		self._buddy_list_view.append_column(column) | ||||
| 
 | ||||
| 		vbox.pack_start(sw) | ||||
| 		self.pack_start(sw) | ||||
| 		sw.show() | ||||
| 
 | ||||
| 		button_box = gtk.HButtonBox() | ||||
| @ -105,11 +104,8 @@ class PresenceWindow(gtk.Window): | ||||
| 		button_box.pack_start(self._share_button) | ||||
| 		self._share_button.show() | ||||
| 
 | ||||
| 		vbox.pack_start(button_box, False) | ||||
| 		self.pack_start(button_box, False) | ||||
| 		button_box.show() | ||||
| 
 | ||||
| 		self.add(vbox) | ||||
| 		vbox.show() | ||||
| 	 | ||||
| 	def _share_button_clicked_cb(self, button): | ||||
| 		self._shell.get_current_activity().publish() | ||||
| @ -12,8 +12,7 @@ from HomeWindow import HomeWindow | ||||
| from sugar import keybindings | ||||
| from sugar import env | ||||
| from sugar.activity import Activity | ||||
| from PresenceWindow import PresenceWindow | ||||
| from sugar.chat.ActivityChat import ActivityChat | ||||
| from PeopleWindow import PeopleWindow | ||||
| from Owner import ShellOwner | ||||
| 
 | ||||
| class ShellDbusService(dbus.service.Object): | ||||
| @ -61,13 +60,7 @@ class Shell: | ||||
| 		keybindings.setup_global_keys(self._home_window, self) | ||||
| 		self._home_window.show() | ||||
| 
 | ||||
| 		self._presence_window = PresenceWindow(self) | ||||
| 		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 = {} | ||||
| 		self._people_windows = {} | ||||
| 
 | ||||
| 	def _toggle_window_visibility(self, window): | ||||
| 		if window.get_property('visible'): | ||||
| @ -103,28 +96,15 @@ class Shell: | ||||
| 		if activity: | ||||
| 			activity_id = activity.get_id() | ||||
| 
 | ||||
| 			if not self._chat_windows.has_key(activity_id): | ||||
| 				window = gtk.Window() | ||||
| 				window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG) | ||||
| 				window.set_skip_taskbar_hint(True) | ||||
| 				window.set_decorated(False) | ||||
| 			if not self._people_windows.has_key(activity_id): | ||||
| 				window = PeopleWindow(self, activity) | ||||
| 				keybindings.setup_global_keys(window, self) | ||||
| 				chat = ActivityChat(activity) | ||||
| 				window.add(chat) | ||||
| 				chat.show() | ||||
| 				self._chat_windows[activity_id] = window | ||||
| 				self._people_windows[activity_id] = window | ||||
| 			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._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): | ||||
| 		self._toggle_window_visibility(self._console.get_window()) | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Marco Pesenti Gritti
						Marco Pesenti Gritti