Skip to content

Commit

Permalink
Frame Palette interaction cleanup
Browse files Browse the repository at this point in the history
- add a 'done' signal to the CurrentActivityPalette
  that is emitted when on item in the Palette is
  selected, when received in the ActivitiesTray we
  do hide the Frame

- call 'popdown_all' on the PaletteGroup when the
  Frame is hidden, this makes sure that all the
  Palettes are popped down in that case

- Journal Palette: remove the popdown call when
  'show content' is selected, this introduced
  a race

- this fixes as well SL #4171

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
  • Loading branch information
Simon Schampijer committed Nov 10, 2012
1 parent 780a2b5 commit 9876f57
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/jarabe/frame/activitiestray.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ def create_palette(self):
palette = JournalPalette(self._home_activity)
else:
palette = CurrentActivityPalette(self._home_activity)
palette.connect('popdown', self.__palette_popped_down_cb)
palette.connect('done', self.__palette_item_selected_cb)
palette.set_group_id('frame')
self.set_palette(palette)

def __palette_popped_down_cb(self, widget):
def __palette_item_selected_cb(self, widget):
frame = jarabe.frame.get_view()
frame.hide()

Expand Down
1 change: 1 addition & 0 deletions src/jarabe/frame/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def hide(self):
if self._animator:
self._animator.stop()

palettegroup.popdown_all()
self._animator = animator.Animator(0.5)
self._animator.add(_Animation(self, 0.0))
self._animator.start()
Expand Down
15 changes: 11 additions & 4 deletions src/jarabe/view/palettes.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from gi.repository import GConf
import glib
from gi.repository import Gtk
from gi.repository import GObject

from sugar3 import env
from sugar3.graphics.palette import Palette
Expand Down Expand Up @@ -71,6 +72,13 @@ def __notify_launch_status_cb(self, home_activity, pspec):


class CurrentActivityPalette(BasePalette):

__gsignals__ = {
'done': (GObject.SignalFlags.RUN_FIRST,
None,
([])),
}

def __init__(self, home_activity):
self._home_activity = home_activity
BasePalette.__init__(self, home_activity)
Expand Down Expand Up @@ -108,20 +116,20 @@ def setup_palette(self):
self.menu_box.show_all()

def __resume_activate_cb(self, menu_item):
self.popdown(immediate=True)
self._home_activity.get_window().activate(Gtk.get_current_event_time())
self.emit('done')

def __view_source__cb(self, menu_item):
self.popdown(immediate=True)
setup_view_source(self._home_activity)
shell_model = shell.get_model()
if self._home_activity is not shell_model.get_active_activity():
self._home_activity.get_window().activate( \
Gtk.get_current_event_time())
self.emit('done')

def __stop_activate_cb(self, menu_item):
self.popdown(immediate=True)
self._home_activity.get_window().close(1)
self.emit('done')


class ActivityPalette(Palette):
Expand Down Expand Up @@ -207,7 +215,6 @@ def setup_palette(self):
self.connect('popup', self.__popup_cb)

def __open_activate_cb(self, menu_item):
self.popdown(immediate=True)
self._home_activity.get_window().activate(Gtk.get_current_event_time())

def __popup_cb(self, palette):
Expand Down

0 comments on commit 9876f57

Please sign in to comment.