From 1456c872bc53c9f14b0a000522449c537e977a42 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Thu, 25 Jan 2007 12:22:37 +0100 Subject: [PATCH 1/7] Split EventFrame to his own file, fixup caps --- shell/view/Shell.py | 2 +- shell/view/frame/Makefile.am | 7 +- shell/view/frame/eventframe.py | 136 ++++++++++++++++++++++++ shell/view/frame/{Frame.py => frame.py} | 119 +-------------------- 4 files changed, 142 insertions(+), 122 deletions(-) create mode 100644 shell/view/frame/eventframe.py rename shell/view/frame/{Frame.py => frame.py} (66%) diff --git a/shell/view/Shell.py b/shell/view/Shell.py index 69dc90d3..9b14b69c 100644 --- a/shell/view/Shell.py +++ b/shell/view/Shell.py @@ -25,7 +25,7 @@ from view.home.HomeWindow import HomeWindow from sugar.presence import PresenceService from view.ActivityHost import ActivityHost from sugar.activity import ActivityFactory -from view.frame.Frame import Frame +from view.frame.frame import Frame from view.keyhandler import KeyHandler from view.hardwaremanager import HardwareManager from _sugar import AudioManager diff --git a/shell/view/frame/Makefile.am b/shell/view/frame/Makefile.am index 2533fd50..1aaabd6b 100644 --- a/shell/view/frame/Makefile.am +++ b/shell/view/frame/Makefile.am @@ -5,8 +5,9 @@ sugar_PYTHON = \ clipboardbox.py \ clipboardpanelwindow.py \ FriendsBox.py \ - PanelWindow.py \ - Frame.py \ + eventframe.py \ + frame.py \ ZoomBox.py \ notificationtray.py \ - overlaybox.py + overlaybox.py \ + PanelWindow.py diff --git a/shell/view/frame/eventframe.py b/shell/view/frame/eventframe.py new file mode 100644 index 00000000..8155c679 --- /dev/null +++ b/shell/view/frame/eventframe.py @@ -0,0 +1,136 @@ +# Copyright (C) 2006, Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +import gtk +import gobject +import wnck + +class EventFrame(gobject.GObject): + __gsignals__ = { + 'enter-edge': (gobject.SIGNAL_RUN_FIRST, + gobject.TYPE_NONE, ([])), + 'enter-corner': (gobject.SIGNAL_RUN_FIRST, + gobject.TYPE_NONE, ([])), + 'leave': (gobject.SIGNAL_RUN_FIRST, + gobject.TYPE_NONE, ([])) + } + + HOVER_NONE = 0 + HOVER_CORNER = 1 + HOVER_EDGE = 2 + + def __init__(self): + gobject.GObject.__init__(self) + + self._windows = [] + self._hover = EventFrame.HOVER_NONE + self._active = False + + invisible = self._create_invisible(0, 0, gtk.gdk.screen_width(), 6) + self._windows.append(invisible) + + invisible = self._create_invisible(0, 0, 6, gtk.gdk.screen_height()) + self._windows.append(invisible) + + invisible = self._create_invisible(gtk.gdk.screen_width() - 6, 0, + gtk.gdk.screen_width(), + gtk.gdk.screen_height()) + self._windows.append(invisible) + + invisible = self._create_invisible(0, gtk.gdk.screen_height() - 6, + gtk.gdk.screen_width(), + gtk.gdk.screen_height()) + self._windows.append(invisible) + + screen = wnck.screen_get_default() + screen.connect('active-window-changed', + self._active_window_changed_cb) + + def _create_invisible(self, x, y, width, height): + invisible = gtk.Invisible() + invisible.connect('motion-notify-event', self._motion_notify_cb) + invisible.connect('enter-notify-event', self._enter_notify_cb) + invisible.connect('leave-notify-event', self._leave_notify_cb) + + invisible.drag_dest_set(0, [], 0) + invisible.connect('drag_motion', self._drag_motion_cb) + invisible.connect('drag_leave', self._drag_leave_cb) + + invisible.realize() + invisible.window.set_events(gtk.gdk.POINTER_MOTION_MASK | + gtk.gdk.ENTER_NOTIFY_MASK | + gtk.gdk.LEAVE_NOTIFY_MASK) + invisible.window.move_resize(x, y, width, height) + + return invisible + + def _enter_notify_cb(self, widget, event): + self._notify_enter(event.x, event.y) + logging.debug('EventFrame._enter_notify_cb ' + str(self._hover)) + + def _motion_notify_cb(self, widget, event): + self._notify_enter(event.x, event.y) + logging.debug('EventFrame._motion_notify_cb ' + str(self._hover)) + + def _drag_motion_cb(self, widget, drag_context, x, y, timestamp): + drag_context.drag_status(0, timestamp); + self._notify_enter(x, y) + logging.debug('EventFrame._drag_motion_cb ' + str(self._hover)) + return True + + def _notify_enter(self, x, y): + screen_w = gtk.gdk.screen_width() + screen_h = gtk.gdk.screen_height() + + if (x == 0 and y == 0) or \ + (x == 0 and y == screen_h - 1) or \ + (x == screen_w - 1 and y == 0) or \ + (x == screen_w - 1 and y == screen_h - 1): + if self._hover != EventFrame.HOVER_CORNER: + self._hover = EventFrame.HOVER_CORNER + self.emit('enter-corner') + else: + if self._hover != EventFrame.HOVER_EDGE: + self._hover = EventFrame.HOVER_EDGE + self.emit('enter-edge') + + def _leave_notify_cb(self, widget, event): + self._notify_leave() + logging.debug('EventFrame._leave_notify_cb ' + str(self._hover)) + + def _drag_leave_cb(self, widget, drag_context, timestamp): + self._notify_leave() + logging.debug('EventFrame._drag_leave_cb ' + str(self._hover)) + return True + + def _notify_leave(self): + self._hover = EventFrame.HOVER_NONE + if self._active: + self.emit('leave') + + def show(self): + self._active = True + for window in self._windows: + window.show() + + def hide(self): + self._active = False + for window in self._windows: + window.hide() + + def _active_window_changed_cb(self, screen): + for window in self._windows: + window.window.raise_() diff --git a/shell/view/frame/Frame.py b/shell/view/frame/frame.py similarity index 66% rename from shell/view/frame/Frame.py rename to shell/view/frame/frame.py index 01791159..d08d4d2c 100644 --- a/shell/view/frame/Frame.py +++ b/shell/view/frame/frame.py @@ -18,8 +18,8 @@ import logging import gtk import gobject import hippo -import wnck +from view.frame.eventframe import EventFrame from view.frame.ActivitiesBox import ActivitiesBox from view.frame.ZoomBox import ZoomBox from view.frame.overlaybox import OverlayBox @@ -32,123 +32,6 @@ from sugar.graphics.timeline import Timeline from sugar.graphics.grid import Grid from sugar.graphics.menushell import MenuShell -class EventFrame(gobject.GObject): - __gsignals__ = { - 'enter-edge': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, ([])), - 'enter-corner': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, ([])), - 'leave': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, ([])) - } - - HOVER_NONE = 0 - HOVER_CORNER = 1 - HOVER_EDGE = 2 - - def __init__(self): - gobject.GObject.__init__(self) - - self._windows = [] - self._hover = EventFrame.HOVER_NONE - self._active = False - - invisible = self._create_invisible(0, 0, gtk.gdk.screen_width(), 6) - self._windows.append(invisible) - - invisible = self._create_invisible(0, 0, 6, gtk.gdk.screen_height()) - self._windows.append(invisible) - - invisible = self._create_invisible(gtk.gdk.screen_width() - 6, 0, - gtk.gdk.screen_width(), - gtk.gdk.screen_height()) - self._windows.append(invisible) - - invisible = self._create_invisible(0, gtk.gdk.screen_height() - 6, - gtk.gdk.screen_width(), - gtk.gdk.screen_height()) - self._windows.append(invisible) - - screen = wnck.screen_get_default() - screen.connect('active-window-changed', - self._active_window_changed_cb) - - def _create_invisible(self, x, y, width, height): - invisible = gtk.Invisible() - invisible.connect('motion-notify-event', self._motion_notify_cb) - invisible.connect('enter-notify-event', self._enter_notify_cb) - invisible.connect('leave-notify-event', self._leave_notify_cb) - - invisible.drag_dest_set(0, [], 0) - invisible.connect('drag_motion', self._drag_motion_cb) - invisible.connect('drag_leave', self._drag_leave_cb) - - invisible.realize() - invisible.window.set_events(gtk.gdk.POINTER_MOTION_MASK | - gtk.gdk.ENTER_NOTIFY_MASK | - gtk.gdk.LEAVE_NOTIFY_MASK) - invisible.window.move_resize(x, y, width, height) - - return invisible - - def _enter_notify_cb(self, widget, event): - self._notify_enter(event.x, event.y) - logging.debug('EventFrame._enter_notify_cb ' + str(self._hover)) - - def _motion_notify_cb(self, widget, event): - self._notify_enter(event.x, event.y) - logging.debug('EventFrame._motion_notify_cb ' + str(self._hover)) - - def _drag_motion_cb(self, widget, drag_context, x, y, timestamp): - drag_context.drag_status(0, timestamp); - self._notify_enter(x, y) - logging.debug('EventFrame._drag_motion_cb ' + str(self._hover)) - return True - - def _notify_enter(self, x, y): - screen_w = gtk.gdk.screen_width() - screen_h = gtk.gdk.screen_height() - - if (x == 0 and y == 0) or \ - (x == 0 and y == screen_h - 1) or \ - (x == screen_w - 1 and y == 0) or \ - (x == screen_w - 1 and y == screen_h - 1): - if self._hover != EventFrame.HOVER_CORNER: - self._hover = EventFrame.HOVER_CORNER - self.emit('enter-corner') - else: - if self._hover != EventFrame.HOVER_EDGE: - self._hover = EventFrame.HOVER_EDGE - self.emit('enter-edge') - - def _leave_notify_cb(self, widget, event): - self._notify_leave() - logging.debug('EventFrame._leave_notify_cb ' + str(self._hover)) - - def _drag_leave_cb(self, widget, drag_context, timestamp): - self._notify_leave() - logging.debug('EventFrame._drag_leave_cb ' + str(self._hover)) - return True - - def _notify_leave(self): - self._hover = EventFrame.HOVER_NONE - if self._active: - self.emit('leave') - - def show(self): - self._active = True - for window in self._windows: - window.show() - - def hide(self): - self._active = False - for window in self._windows: - window.hide() - - def _active_window_changed_cb(self, screen): - for window in self._windows: - window.window.raise_() - class Frame: INACTIVE = 0 TEMPORARY = 1 From ff4054742a2acb25673f72d0dc68b7295f63558c Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Thu, 25 Jan 2007 12:39:44 +0100 Subject: [PATCH 2/7] Some refactoring. Store each panel in his own variable, since slide_in/slide_out handling will be different for each of them. --- shell/view/frame/eventframe.py | 2 + shell/view/frame/frame.py | 98 ++++++++++++++++++---------------- 2 files changed, 54 insertions(+), 46 deletions(-) diff --git a/shell/view/frame/eventframe.py b/shell/view/frame/eventframe.py index 8155c679..c3ed8b4b 100644 --- a/shell/view/frame/eventframe.py +++ b/shell/view/frame/eventframe.py @@ -14,6 +14,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +import logging + import gtk import gobject import wnck diff --git a/shell/view/frame/frame.py b/shell/view/frame/frame.py index d08d4d2c..2d3515a4 100644 --- a/shell/view/frame/frame.py +++ b/shell/view/frame/frame.py @@ -40,10 +40,15 @@ class Frame: AUTOMATIC = 4 def __init__(self, shell): - self._windows = [] + self._left_panel = None + self._right_panel = None + self._top_panel = None + self._bottom_panel = None + self._hover_frame = False self._shell = shell self._mode = Frame.INACTIVE + self._grid = Grid() self._timeline = Timeline(self) self._timeline.add_tag('slide_in', 18, 24) @@ -56,90 +61,85 @@ class Frame: self._event_frame.connect('leave', self._event_frame_leave_cb) self._event_frame.show() - grid = Grid() + self._create_top_panel() + self._create_bottom_panel() + self._create_left_panel() + self._create_right_panel() - # Top panel - panel = self._create_panel(grid, 0, 0, 16, 1) - menu_shell = panel.get_menu_shell() - root = panel.get_root() + shell.get_model().connect('notify::state', + self._shell_state_changed_cb) + + def _create_top_panel(self): + self._top_panel = self._create_panel(0, 0, 16, 1) + menu_shell = self._top_panel.get_menu_shell() + root = self._top_panel.get_root() menu_shell.set_position(MenuShell.BOTTOM) box = ZoomBox(self._shell, menu_shell) - [x, y] = grid.point(1, 0) + [x, y] = self._grid.point(1, 0) root.append(box, hippo.PACK_FIXED) root.set_position(box, x, y) tray = NotificationTray() - tray_box = hippo.CanvasBox(box_width=grid.dimension(1), - box_height=grid.dimension(1), + tray_box = hippo.CanvasBox(box_width=self._grid.dimension(1), + box_height=self._grid.dimension(1), xalign=hippo.ALIGNMENT_END) tray_widget = hippo.CanvasWidget() tray_widget.props.widget = tray tray_box.append(tray_widget, gtk.EXPAND) - [x, y] = grid.point(13, 0) + [x, y] = self._grid.point(13, 0) root.append(tray_box, hippo.PACK_FIXED) root.set_position(tray_box, x, y) box = OverlayBox(self._shell) - [x, y] = grid.point(14, 0) + [x, y] = self._grid.point(14, 0) root.append(box, hippo.PACK_FIXED) root.set_position(box, x, y) - # Bottom panel - panel = self._create_panel(grid, 0, 11, 16, 1) - menu_shell = panel.get_menu_shell() - root = panel.get_root() + def _create_bottom_panel(self): + self._bottom_panel = self._create_panel(0, 11, 16, 1) + menu_shell = self._bottom_panel.get_menu_shell() + root = self._bottom_panel.get_root() menu_shell.set_position(MenuShell.TOP) box = ActivitiesBox(self._shell) root.append(box, hippo.PACK_FIXED) - [x, y] = grid.point(1, 0) + [x, y] = self._grid.point(1, 0) root.set_position(box, x, y) - # Right panel - panel = self._create_panel(grid, 15, 1, 1, 10) - menu_shell = panel.get_menu_shell() - root = panel.get_root() + def _create_right_panel(self): + self._right_panel = self._create_panel(15, 1, 1, 10) + menu_shell = self._right_panel.get_menu_shell() + root = self._right_panel.get_root() menu_shell.set_position(MenuShell.LEFT) box = FriendsBox(self._shell, menu_shell) root.append(box) - # Left panel - panel = self._create_clipboard_panel(grid, 0, 1, 1, 10) + def _create_left_panel(self): + [x, y, width, height] = self._grid.rectangle(0, 1, 1, 10) + self._left_panel = ClipboardPanelWindow(self, x, y, width, height) - shell.get_model().connect('notify::state', - self._shell_state_changed_cb) + self._connect_to_panel(self._left_panel) + self._left_panel.connect('drag-motion', self._drag_motion_cb) + self._left_panel.connect('drag-leave', self._drag_leave_cb) def _shell_state_changed_cb(self, model, pspec): if model.props.state == ShellModel.STATE_SHUTDOWN: self._timeline.goto('slide_out', True) - def _create_clipboard_panel(self, grid, x, y, width, height): - [x, y, width, height] = grid.rectangle(x, y, width, height) - panel = ClipboardPanelWindow(self, x, y, width, height) - - self._connect_to_panel(panel) - panel.connect('drag-motion', self._drag_motion_cb) - panel.connect('drag-leave', self._drag_leave_cb) - - self._windows.append(panel) - - return panel - - def _create_panel(self, grid, x, y, width, height): - [x, y, width, height] = grid.rectangle(x, y, width, height) + def _create_panel(self, x, y, width, height): + [x, y, width, height] = self._grid.rectangle(x, y, width, height) panel = PanelWindow(x, y, width, height) self._connect_to_panel(panel) - self._windows.append(panel) return panel @@ -225,18 +225,24 @@ class Frame: self._timeline.play('before_slide_out', 'slide_out') def do_slide_in(self, current=0, n_frames=0): - if not self._windows[0].props.visible: - for panel in self._windows: - panel.show() + if not self._top_panel.props.visible: + self._left_panel.show() + self._right_panel.show() + self._top_panel.show() + self._bottom_panel.show() + self._event_frame.hide() def do_slide_out(self, current=0, n_frames=0): - if self._windows[0].props.visible: - for panel in self._windows: - panel.hide() + if self._top_panel.props.visible: + self._left_panel.hide() + self._right_panel.hide() + self._top_panel.hide() + self._bottom_panel.hide() + self._event_frame.show() def is_visible(self): - if self._windows[0].props.visible: + if self._top_panel.props.visible: return True return False From 5bc623f45e3ae4f381515ec8e6838e6c1bb4deff Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Thu, 25 Jan 2007 17:37:27 +0100 Subject: [PATCH 3/7] Try to avoid frame flickering by keeping the window offscreen. First go at animation impl as I was at it, off by default. --- shell/view/frame/PanelWindow.py | 3 +- shell/view/frame/ZoomBox.py | 2 +- shell/view/frame/clipboardpanelwindow.py | 4 +- shell/view/frame/eventframe.py | 3 ++ shell/view/frame/frame.py | 63 +++++++++++++++--------- 5 files changed, 47 insertions(+), 28 deletions(-) diff --git a/shell/view/frame/PanelWindow.py b/shell/view/frame/PanelWindow.py index a690b80c..02603134 100644 --- a/shell/view/frame/PanelWindow.py +++ b/shell/view/frame/PanelWindow.py @@ -20,7 +20,7 @@ import hippo from sugar.graphics.menushell import MenuShell class PanelWindow(gtk.Window): - def __init__(self, x, y, width, height): + def __init__(self, width, height): gtk.Window.__init__(self) self.set_decorated(False) @@ -36,7 +36,6 @@ class PanelWindow(gtk.Window): self._menu_shell = MenuShell(canvas) - self.move(x, y) self.resize(width, height) def get_menu_shell(self): diff --git a/shell/view/frame/ZoomBox.py b/shell/view/frame/ZoomBox.py index ed103744..7e14212d 100644 --- a/shell/view/frame/ZoomBox.py +++ b/shell/view/frame/ZoomBox.py @@ -113,7 +113,7 @@ class ZoomBox(hippo.CanvasBox): if home_activity: icon = ActivityIcon(self._shell, self._menu_shell, home_activity) style.apply_stylesheet(icon, 'frame.ZoomIcon') - self.append(icon, 0) + self.append(icon) self._activity_icon = icon else: self._activity_icon = None diff --git a/shell/view/frame/clipboardpanelwindow.py b/shell/view/frame/clipboardpanelwindow.py index f001476d..2f63106f 100644 --- a/shell/view/frame/clipboardpanelwindow.py +++ b/shell/view/frame/clipboardpanelwindow.py @@ -8,8 +8,8 @@ from sugar.clipboard import clipboardservice from sugar import util class ClipboardPanelWindow(PanelWindow): - def __init__(self, frame, x, y, width, height): - PanelWindow.__init__(self, x, y, width, height) + def __init__(self, frame, width, height): + PanelWindow.__init__(self, width, height) self._frame = frame diff --git a/shell/view/frame/eventframe.py b/shell/view/frame/eventframe.py index c3ed8b4b..0537df3f 100644 --- a/shell/view/frame/eventframe.py +++ b/shell/view/frame/eventframe.py @@ -136,3 +136,6 @@ class EventFrame(gobject.GObject): def _active_window_changed_cb(self, screen): for window in self._windows: window.window.raise_() + + def is_visible(self): + return self._windows[0].props.visible diff --git a/shell/view/frame/frame.py b/shell/view/frame/frame.py index 2d3515a4..2aa96532 100644 --- a/shell/view/frame/frame.py +++ b/shell/view/frame/frame.py @@ -32,6 +32,8 @@ from sugar.graphics.timeline import Timeline from sugar.graphics.grid import Grid from sugar.graphics.menushell import MenuShell +_ANIMATION = True + class Frame: INACTIVE = 0 TEMPORARY = 1 @@ -70,7 +72,7 @@ class Frame: self._shell_state_changed_cb) def _create_top_panel(self): - self._top_panel = self._create_panel(0, 0, 16, 1) + self._top_panel = self._create_panel(16, 1) menu_shell = self._top_panel.get_menu_shell() root = self._top_panel.get_root() @@ -102,7 +104,7 @@ class Frame: root.set_position(box, x, y) def _create_bottom_panel(self): - self._bottom_panel = self._create_panel(0, 11, 16, 1) + self._bottom_panel = self._create_panel(16, 1) menu_shell = self._bottom_panel.get_menu_shell() root = self._bottom_panel.get_root() @@ -115,7 +117,7 @@ class Frame: root.set_position(box, x, y) def _create_right_panel(self): - self._right_panel = self._create_panel(15, 1, 1, 10) + self._right_panel = self._create_panel(1, 10) menu_shell = self._right_panel.get_menu_shell() root = self._right_panel.get_root() @@ -125,8 +127,8 @@ class Frame: root.append(box) def _create_left_panel(self): - [x, y, width, height] = self._grid.rectangle(0, 1, 1, 10) - self._left_panel = ClipboardPanelWindow(self, x, y, width, height) + self._left_panel = ClipboardPanelWindow( + self, self._grid.dimension(1), self._grid.dimension(10)) self._connect_to_panel(self._left_panel) self._left_panel.connect('drag-motion', self._drag_motion_cb) @@ -136,13 +138,26 @@ class Frame: if model.props.state == ShellModel.STATE_SHUTDOWN: self._timeline.goto('slide_out', True) - def _create_panel(self, x, y, width, height): - [x, y, width, height] = self._grid.rectangle(x, y, width, height) - panel = PanelWindow(x, y, width, height) + def _create_panel(self, width, height): + panel = PanelWindow(self._grid.dimension(width), + self._grid.dimension(height)) self._connect_to_panel(panel) return panel + def _move_panel(self, panel, x1, y1, x2, y2, pos): + [screen_x1, screen_y1] = self._grid.point(x1, y1) + [screen_x2, screen_y2] = self._grid.point(x2, y2) + + screen_x = (screen_x2 - screen_x1) * pos + screen_x1 + screen_y = (screen_y2 - screen_y1) * pos + screen_y1 + + panel.move(int(screen_x), int(screen_y)) + + # FIXME we should hide and show as necessary to free memory + if not panel.props.visible: + panel.show() + def _connect_to_panel(self, panel): panel.connect('enter-notify-event', self._enter_notify_cb) panel.connect('leave-notify-event', self._leave_notify_cb) @@ -224,25 +239,27 @@ class Frame: if self._mode == Frame.TEMPORARY: self._timeline.play('before_slide_out', 'slide_out') - def do_slide_in(self, current=0, n_frames=0): - if not self._top_panel.props.visible: - self._left_panel.show() - self._right_panel.show() - self._top_panel.show() - self._bottom_panel.show() + def _move(self, pos): + self._move_panel(self._top_panel, 0, -1, 0, 0, pos) + self._move_panel(self._bottom_panel, 0, 12, 0, 11, pos) + self._move_panel(self._left_panel, -1, 1, 0, 1, pos) + self._move_panel(self._right_panel, 16, 1, 15, 1, pos) + def do_slide_in(self, current=0, n_frames=0): + if _ANIMATION: + self._move(float(current + 1) / float(n_frames)) + elif current == 0: + self._move(1) + if self._event_frame.is_visible(): self._event_frame.hide() def do_slide_out(self, current=0, n_frames=0): - if self._top_panel.props.visible: - self._left_panel.hide() - self._right_panel.hide() - self._top_panel.hide() - self._bottom_panel.hide() - + if _ANIMATION: + self._move(1 - (float(current + 1) / float(n_frames))) + elif current == 0: + self._move(0) + if not self._event_frame.is_visible(): self._event_frame.show() def is_visible(self): - if self._top_panel.props.visible: - return True - return False + return self._top_panel.props.visible From 81a1ac032004bb026cb74bbde290e93d680d1e18 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Thu, 25 Jan 2007 17:40:47 +0100 Subject: [PATCH 4/7] Change sound level as asked by Flipo --- shell/view/keyhandler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/view/keyhandler.py b/shell/view/keyhandler.py index 87ddce67..c10de39a 100644 --- a/shell/view/keyhandler.py +++ b/shell/view/keyhandler.py @@ -83,7 +83,7 @@ class KeyHandler(object): self._audio_manager.set_volume(40) def handle_volume_3(self): - self._audio_manager.set_volume(75) + self._audio_manager.set_volume(80) def handle_volume_4(self): self._audio_manager.set_volume(100) From aa79b1fdd65c9fdef8bbe11fa6f73497ab4e34bf Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Thu, 25 Jan 2007 18:04:47 +0100 Subject: [PATCH 5/7] Another volume change... --- shell/view/keyhandler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/view/keyhandler.py b/shell/view/keyhandler.py index c10de39a..3564974d 100644 --- a/shell/view/keyhandler.py +++ b/shell/view/keyhandler.py @@ -80,7 +80,7 @@ class KeyHandler(object): self._audio_manager.set_volume(0) def handle_volume_2(self): - self._audio_manager.set_volume(40) + self._audio_manager.set_volume(50) def handle_volume_3(self): self._audio_manager.set_volume(80) From 698e0cb7f9c66aa34e752d3cd9c9bcdf50958259 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Thu, 25 Jan 2007 19:50:00 +0100 Subject: [PATCH 6/7] Actually disable animation --- shell/view/frame/frame.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/view/frame/frame.py b/shell/view/frame/frame.py index 2aa96532..1e921803 100644 --- a/shell/view/frame/frame.py +++ b/shell/view/frame/frame.py @@ -32,7 +32,7 @@ from sugar.graphics.timeline import Timeline from sugar.graphics.grid import Grid from sugar.graphics.menushell import MenuShell -_ANIMATION = True +_ANIMATION = False class Frame: INACTIVE = 0 From 8a0728b169535e83ba1c1540cd6ddc42d24f16e3 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Fri, 26 Jan 2007 11:44:08 +0100 Subject: [PATCH 7/7] Setup plugins path --- lib/src/Makefile.am | 27 ++++++++++++++------------- lib/src/sugar-browser.cpp | 17 +++++++++++++++++ 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/lib/src/Makefile.am b/lib/src/Makefile.am index f7d0e171..407b4690 100644 --- a/lib/src/Makefile.am +++ b/lib/src/Makefile.am @@ -1,17 +1,18 @@ -libsugarprivate_la_CPPFLAGS = \ - $(WARN_CFLAGS) \ - $(LIB_CFLAGS) \ - $(GECKO_CFLAGS) \ - -I$(MOZILLA_INCLUDE_DIR)/dom \ - -I$(MOZILLA_INCLUDE_DIR)/exthandler \ - -I$(MOZILLA_INCLUDE_DIR)/gtkembedmoz \ - -I$(MOZILLA_INCLUDE_DIR)/mimetype \ - -I$(MOZILLA_INCLUDE_DIR)/necko \ - -I$(MOZILLA_INCLUDE_DIR)/pref \ - -I$(MOZILLA_INCLUDE_DIR)/uriloader \ - -I$(MOZILLA_INCLUDE_DIR)/webbrwsr \ +libsugarprivate_la_CPPFLAGS = \ + $(WARN_CFLAGS) \ + $(LIB_CFLAGS) \ + $(GECKO_CFLAGS) \ + -I$(MOZILLA_INCLUDE_DIR)/dom \ + -I$(MOZILLA_INCLUDE_DIR)/exthandler \ + -I$(MOZILLA_INCLUDE_DIR)/gtkembedmoz \ + -I$(MOZILLA_INCLUDE_DIR)/mimetype \ + -I$(MOZILLA_INCLUDE_DIR)/necko \ + -I$(MOZILLA_INCLUDE_DIR)/pref \ + -I$(MOZILLA_INCLUDE_DIR)/uriloader \ + -I$(MOZILLA_INCLUDE_DIR)/webbrwsr \ + -DPLUGIN_DIR=\"$(libdir)/mozilla/plugins\" \ -DSHARE_DIR=\"$(pkgdatadir)\" - + noinst_LTLIBRARIES = libsugarprivate.la libsugarprivate_la_LIBADD = \ diff --git a/lib/src/sugar-browser.cpp b/lib/src/sugar-browser.cpp index fe94378a..4bbbb62f 100644 --- a/lib/src/sugar-browser.cpp +++ b/lib/src/sugar-browser.cpp @@ -69,11 +69,28 @@ static const nsModuleComponentInfo sSugarComponents[] = { #endif +static void +setup_plugin_path () +{ + const char *user_path; + char *new_path; + + user_path = g_getenv ("MOZ_PLUGIN_PATH"); + new_path = g_strconcat (user_path ? user_path : "", + user_path ? ":" : "", + PLUGIN_DIR, + (char *) NULL); + g_setenv ("MOZ_PLUGIN_PATH", new_path, TRUE); + g_free (new_path); +} + gboolean sugar_browser_startup(const char *profile_path, const char *profile_name) { nsresult rv; + setup_plugin_path(); + gtk_moz_embed_set_profile_path(profile_path, profile_name); gtk_moz_embed_push_startup();