Revert to the trial-3 frame behavior (always visible on

the home page). Readapt things which are changed in the
meantime.
This commit is contained in:
Marco Pesenti Gritti 2007-10-29 15:49:17 +01:00
parent 91c97ba018
commit 702a890770
11 changed files with 57 additions and 161 deletions

2
NEWS
View File

@ -1,3 +1,5 @@
* #4428 Revert to the trial-3 frame behavior (marco)
Snapshot 176262f2e9 Snapshot 176262f2e9
* Added morgs NotifyAlert (timed one button alert) to the alert api (erikos) * Added morgs NotifyAlert (timed one button alert) to the alert api (erikos)

View File

@ -45,7 +45,6 @@ AC_OUTPUT([
Makefile Makefile
bin/Makefile bin/Makefile
data/Makefile data/Makefile
data/icons/Makefile
lib/Makefile lib/Makefile
lib/sugar/Makefile lib/sugar/Makefile
lib/sugar/activity/Makefile lib/sugar/activity/Makefile

View File

@ -1,5 +1,3 @@
SUBDIRS = icons
sugar.gtkrc: gtkrc.em sugar.gtkrc: gtkrc.em
$(srcdir)/em.py -D theme=\'sugar\' $(srcdir)/gtkrc.em > \ $(srcdir)/em.py -D theme=\'sugar\' $(srcdir)/gtkrc.em > \
$(top_builddir)/data/sugar.gtkrc $(top_builddir)/data/sugar.gtkrc

View File

@ -1,9 +0,0 @@
iconsdir = $(pkgdatadir)/data/icons
icons_DATA = \
arrow_NE.svg \
arrow_NW.svg \
arrow_SE.svg \
arrow_SW.svg
EXTRA_DIST = \
$(icons_DATA)

View File

@ -1,7 +0,0 @@
<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg enable-background="new 0 0 55 55" height="55px" version="1.1" viewBox="0 0 55 55" width="55px" x="0px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px"><g display="block" id="arrow_x5F_NE">
<g display="inline">
<g>
<path d="M20.154,15.718c-0.896,0-1.794,0.344-2.481,1.028c-1.373,1.372-1.373,3.598,0,4.969c0.686,0.686,1.585,1.026,2.481,1.026 h7.137L16.745,33.29c-0.633,0.635-1.026,1.514-1.029,2.482c0.003,1.939,1.576,3.512,3.514,3.512c0.972,0,1.848-0.395,2.483-1.028 l10.546-10.545v7.136c0,0.898,0.342,1.799,1.029,2.482c1.369,1.373,3.595,1.371,4.965,0c0.687-0.686,1.028-1.588,1.031-2.482 V15.716L20.154,15.718z"/>
</g>
</g>
</g></svg>

Before

Width:  |  Height:  |  Size: 839 B

View File

@ -1,7 +0,0 @@
<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg enable-background="new 0 0 55 55" height="55px" version="1.1" viewBox="0 0 55 55" width="55px" x="0px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px"><g display="block" id="arrow_x5F_NW">
<g display="inline">
<g>
<path d="M38.255,33.287L27.71,22.741h7.136c0.898,0,1.799-0.342,2.482-1.029c1.373-1.369,1.371-3.595,0-4.965 c-0.686-0.687-1.588-1.029-2.482-1.031H15.715l0.002,19.13c0,0.896,0.344,1.794,1.028,2.481c1.372,1.373,3.598,1.373,4.969,0 c0.686-0.686,1.026-1.585,1.026-2.481v-7.137L33.29,38.255c0.635,0.633,1.514,1.026,2.482,1.029 c1.939-0.003,3.512-1.576,3.512-3.514C39.284,34.799,38.889,33.923,38.255,33.287z"/>
</g>
</g>
</g></svg>

Before

Width:  |  Height:  |  Size: 845 B

View File

@ -1,7 +0,0 @@
<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg enable-background="new 0 0 55 55" height="55px" version="1.1" viewBox="0 0 55 55" width="55px" x="0px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px"><g display="block" id="arrow_x5F_SE">
<g display="inline">
<g>
<path d="M39.282,20.154c0-0.896-0.344-1.794-1.028-2.481c-1.372-1.373-3.598-1.373-4.969,0c-0.686,0.686-1.026,1.585-1.026,2.481 v7.137L21.709,16.745c-0.635-0.633-1.514-1.026-2.482-1.029c-1.939,0.003-3.512,1.576-3.512,3.514 c0,0.972,0.395,1.848,1.028,2.483l10.545,10.546h-7.136c-0.898,0-1.799,0.342-2.482,1.029c-1.373,1.369-1.371,3.595,0,4.965 c0.686,0.687,1.588,1.028,2.482,1.031h19.131L39.282,20.154z"/>
</g>
</g>
</g></svg>

Before

Width:  |  Height:  |  Size: 844 B

View File

@ -1,7 +0,0 @@
<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg enable-background="new 0 0 55 55" height="55px" version="1.1" viewBox="0 0 55 55" width="55px" x="0px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px"><g display="block" id="arrow_x5F_SW">
<g>
<g>
<path d="M34.845,32.259h-7.137L38.254,21.71c0.633-0.635,1.026-1.514,1.029-2.482c-0.003-1.939-1.576-3.512-3.514-3.512 c-0.972,0-1.848,0.395-2.483,1.028L22.741,27.289v-7.136c0-0.898-0.342-1.799-1.029-2.482c-1.369-1.373-3.595-1.371-4.965,0 c-0.687,0.686-1.029,1.588-1.031,2.482v19.131l19.13-0.002c0.896,0,1.794-0.344,2.481-1.028c1.373-1.372,1.373-3.598,0-4.969 C36.641,32.6,35.742,32.259,34.845,32.259z"/>
</g>
</g>
</g></svg>

Before

Width:  |  Height:  |  Size: 827 B

View File

@ -57,6 +57,7 @@ class Shell(gobject.GObject):
self._current_host = None self._current_host = None
self._pending_host = None self._pending_host = None
self._screen_rotation = 0 self._screen_rotation = 0
self._zoom_level = ShellModel.ZOOM_HOME
self._key_handler = KeyHandler(self) self._key_handler = KeyHandler(self)
@ -73,6 +74,8 @@ class Shell(gobject.GObject):
home_model.connect('pending-activity-changed', home_model.connect('pending-activity-changed',
self._pending_activity_changed_cb) self._pending_activity_changed_cb)
self._model.connect('notify::zoom-level', self._zoom_level_changed_cb)
gobject.idle_add(self._start_journal_idle) gobject.idle_add(self._start_journal_idle)
def _start_journal_idle(self): def _start_journal_idle(self):
@ -172,8 +175,7 @@ class Shell(gobject.GObject):
activity.get_service().TakeScreenshot() activity.get_service().TakeScreenshot()
def set_zoom_level(self, level): def set_zoom_level(self, level):
old_level = self._model.get_zoom_level() if level == self._zoom_level:
if level == old_level:
return return
self.take_activity_screenshot() self.take_activity_screenshot()
@ -187,6 +189,17 @@ class Shell(gobject.GObject):
self._screen.toggle_showing_desktop(True) self._screen.toggle_showing_desktop(True)
self._home_window.set_zoom_level(level) self._home_window.set_zoom_level(level)
def _zoom_level_changed_cb(self, model, pspec):
new_level = model.props.zoom_level
if new_level == ShellModel.ZOOM_HOME:
self._frame.show(Frame.MODE_HOME)
if self._zoom_level == ShellModel.ZOOM_HOME:
self._frame.hide()
self._zoom_level = new_level
def toggle_activity_fullscreen(self): def toggle_activity_fullscreen(self):
if self._model.get_zoom_level() == ShellModel.ZOOM_ACTIVITY: if self._model.get_zoom_level() == ShellModel.ZOOM_ACTIVITY:
self.get_current_activity().toggle_fullscreen() self.get_current_activity().toggle_fullscreen()

View File

@ -33,16 +33,11 @@ from view.frame.framewindow import FrameWindow
from view.frame.clipboardpanelwindow import ClipboardPanelWindow from view.frame.clipboardpanelwindow import ClipboardPanelWindow
from model.shellmodel import ShellModel from model.shellmodel import ShellModel
MODE_NONE = 0
MODE_MOUSE = 1
MODE_KEYBOARD = 2
MODE_FORCE = 3
_FRAME_HIDING_DELAY = 500 _FRAME_HIDING_DELAY = 500
class _Animation(animator.Animation): class _Animation(animator.Animation):
def __init__(self, frame, end): def __init__(self, frame, end):
start = frame.get_current_position() start = frame.current_position
animator.Animation.__init__(self, start, end) animator.Animation.__init__(self, start, end)
self._frame = frame self._frame = frame
@ -55,19 +50,16 @@ class _MouseListener(object):
self._hide_sid = 0 self._hide_sid = 0
def mouse_enter(self): def mouse_enter(self):
if self._frame.mode == MODE_NONE or \
self._frame.mode == MODE_MOUSE:
self._show_frame() self._show_frame()
def mouse_leave(self): def mouse_leave(self):
if self._frame.mode == MODE_MOUSE: if self._frame.mode == Frame.MODE_MOUSE:
self._hide_frame() self._hide_frame()
def _show_frame(self): def _show_frame(self):
if self._hide_sid != 0: if self._hide_sid != 0:
gobject.source_remove(self._hide_sid) gobject.source_remove(self._hide_sid)
self._frame.show() self._frame.show(Frame.MODE_MOUSE)
self._frame.mode = MODE_MOUSE
def _hide_frame_timeout_cb(self): def _hide_frame_timeout_cb(self):
self._frame.hide() self._frame.hide()
@ -80,52 +72,23 @@ class _MouseListener(object):
_FRAME_HIDING_DELAY, self._hide_frame_timeout_cb) _FRAME_HIDING_DELAY, self._hide_frame_timeout_cb)
class _KeyListener(object): class _KeyListener(object):
_HIDDEN = 1
_SHOWN_PRESSED = 2
_SHOWN_REPEAT = 3
_SHOWN_RELEASED = 4
def __init__(self, frame): def __init__(self, frame):
self._frame = frame self._frame = frame
self._state = _KeyListener._HIDDEN
def key_press(self): def key_press(self):
if self._frame.mode != MODE_NONE and \
self._frame.mode != MODE_KEYBOARD:
return
if self._frame.visible: if self._frame.visible:
if self._frame.mode == Frame.MODE_KEYBOARD:
self._frame.hide() self._frame.hide()
else: else:
self._frame.show() self._frame.show(Frame.MODE_KEYBOARD)
self._frame.mode = MODE_KEYBOARD
"""
if self._state == _KeyListener._HIDDEN:
self._frame.show()
self._frame.mode = MODE_KEYBOARD
self._state = _KeyListener._SHOWN_PRESSED
elif self._state == _KeyListener._SHOWN_PRESSED:
self._state = _KeyListener._SHOWN_REPEAT
elif self._state == _KeyListener._SHOWN_RELEASED:
self._frame.hide()
self._state = _KeyListener._HIDDEN
"""
def key_release(self):
pass
"""
if self._state == _KeyListener._SHOWN_PRESSED:
self._state = _KeyListener._SHOWN_RELEASED
elif self._state == _KeyListener._SHOWN_REPEAT:
self._frame.hide()
self._state = _KeyListener._HIDDEN
"""
class Frame(object): class Frame(object):
MODE_MOUSE = 0
MODE_KEYBOARD = 1
MODE_HOME = 2
def __init__(self, shell): def __init__(self, shell):
self.mode = MODE_NONE self.mode = None
self.visible = False
self._palette_group = palettegroup.get_group('frame') self._palette_group = palettegroup.get_group('frame')
self._palette_group.connect('popdown', self._palette_group_popdown_cb) self._palette_group.connect('popdown', self._palette_group_popdown_cb)
@ -136,7 +99,7 @@ class Frame(object):
self._bottom_panel = None self._bottom_panel = None
self._shell = shell self._shell = shell
self._current_position = 0.0 self.current_position = 0.0
self._animator = None self._animator = None
self._event_area = EventArea() self._event_area = EventArea()
@ -157,9 +120,12 @@ class Frame(object):
self._key_listener = _KeyListener(self) self._key_listener = _KeyListener(self)
self._mouse_listener = _MouseListener(self) self._mouse_listener = _MouseListener(self)
def hide(self, force=False): self.move(1.0)
if not self.visible:
return def is_visible(self):
return self.current_position != 0.0
def hide(self):
if self._animator: if self._animator:
self._animator.stop() self._animator.stop()
@ -169,16 +135,9 @@ class Frame(object):
self._event_area.show() self._event_area.show()
self.visible = False self.mode = None
if force:
self.mode = MODE_NONE
else:
self.mode = MODE_FORCE
self._animator.connect('completed', self._hide_completed_cb)
def show(self):
self.mode = MODE_FORCE
def show(self, mode):
if self.visible: if self.visible:
return return
if self._animator: if self._animator:
@ -186,19 +145,16 @@ class Frame(object):
self._shell.take_activity_screenshot() self._shell.take_activity_screenshot()
self.mode = mode
self._animator = animator.Animator(0.5) self._animator = animator.Animator(0.5)
self._animator.add(_Animation(self, 1.0)) self._animator.add(_Animation(self, 1.0))
self._animator.start() self._animator.start()
self._event_area.hide() self._event_area.hide()
self.visible = True
def get_current_position(self):
return self._current_position
def move(self, pos): def move(self, pos):
self._current_position = pos self.current_position = pos
self._update_position() self._update_position()
def _is_hover(self): def _is_hover(self):
@ -266,21 +222,18 @@ class Frame(object):
screen_h = gtk.gdk.screen_height() screen_h = gtk.gdk.screen_height()
screen_w = gtk.gdk.screen_width() screen_w = gtk.gdk.screen_width()
self._move_panel(self._top_panel, self._current_position, self._move_panel(self._top_panel, self.current_position,
0, - self._top_panel.size, 0, 0) 0, - self._top_panel.size, 0, 0)
self._move_panel(self._bottom_panel, self._current_position, self._move_panel(self._bottom_panel, self.current_position,
0, screen_h, 0, screen_h - self._bottom_panel.size) 0, screen_h, 0, screen_h - self._bottom_panel.size)
self._move_panel(self._left_panel, self._current_position, self._move_panel(self._left_panel, self.current_position,
- self._left_panel.size, 0, 0, 0) - self._left_panel.size, 0, 0, 0)
self._move_panel(self._right_panel, self._current_position, self._move_panel(self._right_panel, self.current_position,
screen_w, 0, screen_w - self._right_panel.size, 0) screen_w, 0, screen_w - self._right_panel.size, 0)
def _hide_completed_cb(self, animator):
self.mode = MODE_NONE
def _size_changed_cb(self, screen): def _size_changed_cb(self, screen):
self._update_position() self._update_position()
@ -316,6 +269,4 @@ class Frame(object):
def notify_key_press(self): def notify_key_press(self):
self._key_listener.key_press() self._key_listener.key_press()
def notify_key_release(self): visible = property(is_visible, None)
self._key_listener.key_release()

View File

@ -48,55 +48,17 @@ class HomeBox(hippo.CanvasBox, hippo.CanvasItem):
shell_model = shell.get_model() shell_model = shell.get_model()
top_box = hippo.CanvasBox(yalign=hippo.ALIGNMENT_START,
box_height=style.GRID_CELL_SIZE,
orientation=hippo.ORIENTATION_HORIZONTAL)
self.append(top_box, hippo.PACK_EXPAND)
nw_arrow = CanvasIcon(icon_name='arrow_NW',
xalign=hippo.ALIGNMENT_START)
top_box.append(nw_arrow)
arrows_separator = hippo.CanvasBox()
top_box.append(arrows_separator, hippo.PACK_EXPAND)
ne_arrow = CanvasIcon(icon_name='arrow_NE',
xalign=hippo.ALIGNMENT_END)
top_box.append(ne_arrow)
self._donut = ActivitiesDonut(shell) self._donut = ActivitiesDonut(shell)
self.append(self._donut) self.append(self._donut, hippo.PACK_FIXED)
bottom_box = hippo.CanvasBox(yalign=hippo.ALIGNMENT_END,
box_height=style.GRID_CELL_SIZE,
orientation=hippo.ORIENTATION_HORIZONTAL)
self.append(bottom_box, hippo.PACK_EXPAND)
self._my_icon = _MyIcon(shell, style.XLARGE_ICON_SIZE) self._my_icon = _MyIcon(shell, style.XLARGE_ICON_SIZE)
self.append(self._my_icon, hippo.PACK_FIXED) self.append(self._my_icon, hippo.PACK_FIXED)
sw_arrow = CanvasIcon(icon_name='arrow_SW', self._devices_box = _DevicesBox(shell_model.get_devices())
xalign=hippo.ALIGNMENT_START) self.append(self._devices_box, hippo.PACK_FIXED)
bottom_box.append(sw_arrow)
devices_box = _DevicesBox(shell_model.get_devices())
bottom_box.append(devices_box, hippo.PACK_EXPAND)
se_arrow = CanvasIcon(icon_name='arrow_SE',
xalign=hippo.ALIGNMENT_END)
bottom_box.append(se_arrow)
self._arrows = [ nw_arrow, ne_arrow, sw_arrow, se_arrow ]
shell_model.connect('notify::state', shell_model.connect('notify::state',
self._shell_state_changed_cb) self._shell_state_changed_cb)
shell_model.connect('notify::zoom-level',
self._shell_zoom_level_changed_cb)
def _shell_zoom_level_changed_cb(self, model, pspec):
for arrow in self._arrows:
arrow.destroy()
self._arrows = []
def _shell_state_changed_cb(self, model, pspec): def _shell_state_changed_cb(self, model, pspec):
# FIXME implement this # FIXME implement this
@ -106,10 +68,18 @@ class HomeBox(hippo.CanvasBox, hippo.CanvasItem):
def do_allocate(self, width, height, origin_changed): def do_allocate(self, width, height, origin_changed):
hippo.CanvasBox.do_allocate(self, width, height, origin_changed) hippo.CanvasBox.do_allocate(self, width, height, origin_changed)
[donut_width, donut_height] = self._donut.get_allocation()
self.set_position(self._donut, (width - donut_width) / 2,
(height - donut_height) / 2)
[icon_width, icon_height] = self._my_icon.get_allocation() [icon_width, icon_height] = self._my_icon.get_allocation()
self.set_position(self._my_icon, (width - icon_width) / 2, self.set_position(self._my_icon, (width - icon_width) / 2,
(height - icon_height) / 2) (height - icon_height) / 2)
[box_width, box_height] = self._devices_box.get_allocation()
self.set_position(self._devices_box, (width - icon_width) / 2,
height - style.GRID_CELL_SIZE * 3)
_REDRAW_TIMEOUT = 5 * 60 * 1000 # 5 minutes _REDRAW_TIMEOUT = 5 * 60 * 1000 # 5 minutes
def resume(self): def resume(self):