Merge branch 'master' of git+ssh://dcbw@crank.laptop.org/git/sugar

This commit is contained in:
Dan Williams 2006-06-23 13:13:32 -04:00
commit a8c9f4301b
4 changed files with 37 additions and 39 deletions

View File

@ -50,6 +50,8 @@ class PresenceWindow(gtk.Window):
else: else:
self._share_button.set_sensitive(True) self._share_button.set_sensitive(True)
self._activity.connect('shared', lambda w: self._share_button.set_sensitive(False)) self._activity.connect('shared', lambda w: self._share_button.set_sensitive(False))
else:
self._share_button.set_sensitive(False)
def _setup_ui(self): def _setup_ui(self):
vbox = gtk.VBox(False, 6) vbox = gtk.VBox(False, 6)

View File

@ -6,12 +6,12 @@ import gobject
SM_SPACE_PROPORTIONAL = 0 SM_SPACE_PROPORTIONAL = 0
SM_STEP = 1 SM_STEP = 1
SLIDING_TIMEOUT = 50 #SLIDING_TIMEOUT = 50
SLIDING_MODE = SM_SPACE_PROPORTIONAL #SLIDING_MODE = SM_SPACE_PROPORTIONAL
#SLIDING_TIMEOUT = 10 SLIDING_TIMEOUT = 10
#SLIDING_MODE = SM_STEP SLIDING_MODE = SM_STEP
#SLIDING_STEP = 0.05 SLIDING_STEP = 0.05
class WindowManager: class WindowManager:
__managers_list = [] __managers_list = []
@ -48,6 +48,12 @@ class WindowManager:
if wm._position == WindowManager.TOP: if wm._position == WindowManager.TOP:
manager = wm manager = wm
if event.keyval == gtk.keysyms.Down and \
event.state & gtk.gdk.CONTROL_MASK:
for wm in WindowManager.__managers_list:
if wm._position == WindowManager.BOTTOM:
manager = wm
if manager and manager._window.get_property('visible'): if manager and manager._window.get_property('visible'):
manager.slide_window_out() manager.slide_window_out()
elif manager: elif manager:
@ -87,6 +93,9 @@ class WindowManager:
elif self._position is WindowManager.TOP: elif self._position is WindowManager.TOP:
self._x = int((screen_width - width) / 2) self._x = int((screen_width - width) / 2)
self._y = - int((1.0 - self._sliding_pos) * height) self._y = - int((1.0 - self._sliding_pos) * height)
elif self._position is WindowManager.BOTTOM:
self._x = int((screen_width - width) / 2)
self._y = screen_height - int(self._sliding_pos * height)
self._real_width = width self._real_width = width
self._real_height = height self._real_height = height

View File

@ -33,6 +33,8 @@ class ActivityHostSignalHelper(gobject.GObject):
class ActivityHost(dbus.service.Object): class ActivityHost(dbus.service.Object):
def __init__(self, activity_container, activity_name, default_type, activity_id = None): def __init__(self, activity_container, activity_name, default_type, activity_id = None):
self.peer_service = None
self.activity_name = activity_name self.activity_name = activity_name
self.ellipsize_tab = False self.ellipsize_tab = False
self._shared = False self._shared = False
@ -99,6 +101,13 @@ class ActivityHost(dbus.service.Object):
def _create_chat(self): def _create_chat(self):
self._activity_chat = ActivityChat(self) self._activity_chat = ActivityChat(self)
def got_focus(self):
if self.peer_service != None:
self.peer_service.got_focus()
def lost_focus(self):
self.peer_service.lost_focus()
def get_chat(self): def get_chat(self):
return self._activity_chat return self._activity_chat
@ -365,12 +374,6 @@ class ActivityContainer(dbus.service.Object):
def show(self): def show(self):
self.window.show() self.window.show()
def __focus_reply_cb(self):
pass
def __focus_error_cb(self, error):
pass
def set_current_activity(self, activity): def set_current_activity(self, activity):
self.current_activity = activity self.current_activity = activity
self._presence_window.set_activity(activity) self._presence_window.set_activity(activity)
@ -388,23 +391,12 @@ class ActivityContainer(dbus.service.Object):
new_activity = notebook.get_nth_page(page_number).get_data("sugar-activity") new_activity = notebook.get_nth_page(page_number).get_data("sugar-activity")
if self.current_activity != None: if self.current_activity != None:
if self.has_activity(self.current_activity): self.current_activity.lost_focus()
self.current_activity.peer_service.lost_focus(reply_handler = self.__focus_reply_cb, error_handler = self.__focus_error_cb)
#if self.has_activity(new_activity):
self.set_current_activity(new_activity) self.set_current_activity(new_activity)
if self.current_activity != None: if self.current_activity != None:
if self.has_activity(self.current_activity): self.current_activity.got_focus()
self.current_activity.peer_service.got_focus(reply_handler = self.__focus_reply_cb, error_handler = self.__focus_error_cb)
def has_activity(self, activity_to_check_for):
for owner, activity in self.activities[:]:
if activity_to_check_for == activity:
return True
return False
def name_owner_changed(self, service_name, old_service_name, new_service_name): def name_owner_changed(self, service_name, old_service_name, new_service_name):
#print "in name_owner_changed: svc=%s oldsvc=%s newsvc=%s"%(service_name, old_service_name, new_service_name) #print "in name_owner_changed: svc=%s oldsvc=%s newsvc=%s"%(service_name, old_service_name, new_service_name)
@ -466,7 +458,9 @@ class ConsoleLogger(dbus.service.Object):
self._window = gtk.Window() self._window = gtk.Window()
self._window.set_title("Console") self._window.set_title("Console")
self._window.set_default_size(640, 480) self._window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DOCK)
self._window.set_decorated(False)
self._window.set_skip_taskbar_hint(True)
self._window.connect("delete_event", lambda w, e: w.hide_on_delete()) self._window.connect("delete_event", lambda w, e: w.hide_on_delete())
self._nb = gtk.Notebook() self._nb = gtk.Notebook()
@ -475,17 +469,12 @@ class ConsoleLogger(dbus.service.Object):
self._consoles = {} self._consoles = {}
def set_parent_window(self, window): console_wm = WindowManager(self._window)
window.connect("key-press-event", self.__key_press_event_cb)
self._window.connect("key-press-event", self.__key_press_event_cb)
def __key_press_event_cb(self, window, event): console_wm.set_width(0.7, WindowManager.SCREEN_RELATIVE)
if event.keyval == gtk.keysyms.d and \ console_wm.set_height(0.9, WindowManager.SCREEN_RELATIVE)
event.state & gtk.gdk.CONTROL_MASK: console_wm.set_position(WindowManager.BOTTOM)
if self._window.get_property('visible'): console_wm.manage()
self._window.hide()
else:
self._window.show()
def _create_console(self, application): def _create_console(self, application):
sw = gtk.ScrolledWindow() sw = gtk.ScrolledWindow()
@ -543,8 +532,6 @@ class Shell(gobject.GObject):
wm.show() wm.show()
wm.manage() wm.manage()
console.set_parent_window(activity_container.window)
def __activity_container_destroy_cb(self, activity_container): def __activity_container_destroy_cb(self, activity_container):
self.emit('close') self.emit('close')

View File

@ -69,7 +69,7 @@ else:
add_to_python_path(os.path.join(sugar.env.get_data_dir(), 'shell')) add_to_python_path(os.path.join(sugar.env.get_data_dir(), 'shell'))
print 'Running the installed sugar...' print 'Running the installed sugar...'
print 'Redirecting output to the console, press ctrl+d to open it.' print 'Redirecting output to the console, press Ctrl+Down to open it.'
from session.session import Session from session.session import Session