[Dextrose] [PATCH sugar v3] uy#698: Rectifying "Activity-icons not displaying, if notification-messages are shown"

Ajay Garg ajay at activitycentral.com
Tue Jan 31 23:00:15 EST 2012


Hi Esteban.

It was, in fact, the issue of a misplaced call to
"gobject.idle_add(show_notifications_cb)"; it needed to be setup after the
call "gobject.idle_add(setup_frame_cb)" has been invocated.

Please find attached the new "sugar-session". For brevity, I am also
attaching the original "sugar-session", and the diff.

Regards,
Ajay

On Tue, Jan 31, 2012 at 11:17 PM, Esteban Bordón <ebordon at plan.ceibal.edu.uy
> wrote:

> The class Notifier contains the invocation of jarabe.frame .If you want to
> test you have to change these lines for the lines sent before.
>
> cheers,
> Esteban.
>
> 2012/1/31 Ajay Garg <ajay at activitycentral.com>
>
>> Hi Esteban.
>>
>> Please send the file "bin/sugar-session" (that contains the
>> "gobject.idle_add(show_notification_cb)" call.
>>
>> It seems that the call has been placed too early in the bootstrap process.
>>
>> Regards,
>> Ajay
>>
>>
>> On Tue, Jan 31, 2012 at 10:40 PM, Esteban Bordón <
>> ebordon at plan.ceibal.edu.uy> wrote:
>>
>>> I've applied this patch on a dx3 image and activities icons are still
>>> missed.
>>>
>>> To test I've created a callback for display a notification:
>>>
>>> def show_notification_cb():
>>>     from jarabe.frame import get_view
>>>     frame = get_view()
>>>     frame.add_message(body="body", summary="summary")
>>>
>>> and I've added in bootstrap:
>>>
>>> gobject.idle_add(show_notification_cb)
>>>
>>> I attach shell.log because some messages refers to
>>> frame/activitiestray.py that was patched
>>>
>>>  cheers,
>>> Esteban
>>>
>>>
>>> 2012/1/31 Anish Mangal <anish at sugarlabs.org>
>>>
>>>> Ping. Could somebody review this please :-)
>>>>
>>>> On Tue, Jan 24, 2012 at 10:35, Ajay Garg <ajay at activitycentral.com>
>>>> wrote:
>>>> > ---
>>>> >
>>>> > Issue:
>>>> > ------
>>>> > Originally discussed at :
>>>> > http://lists.sugarlabs.org/archive/dextrose/2011-August/001340.html
>>>> >
>>>> > and catched by Esteban Bordón, the issue is that whenever (and not
>>>> just
>>>> > at startup) any notification-messages are displayed, any Activity-icon
>>>> > (and not just the Journal-Activity icon) is not displayed in the
>>>> > top-panel-frame.
>>>> >
>>>> > Technical history/details:
>>>> > ---------------------------
>>>> >
>>>> > The mesh-, group-, home-, and activity-zoom buttons are a group of
>>>> > radiobuttons; only one may be visibly-active at a time (this is
>>>> > highlighted by the white-background of the corresponding selected
>>>> > zoom-button).
>>>> > Please see:
>>>> >               "src/jarabe/frame/zoomtoolbar.py"
>>>> > for code-details.
>>>> >
>>>> > Similarly, all the opened activity-instances are shown by a yet
>>>> another
>>>> > group of radiobuttons; the selected activity being highlighed by the
>>>> > corresponding selected activity-icon-button.
>>>> >
>>>> > Now, what was happening, was that the notification-message-icon was
>>>> > being added into the Activities-Tray (the second group of radiobuttons
>>>> > as discussed above); but any further activity-icons were not being
>>>> added
>>>> > into the tray, because the notification-message-icon did not respect
>>>> the
>>>> > semantics of the activity-icons. Hence, the
>>>> notification-message-icon, and
>>>> > any other activity-icon (including Journal-activity icon) were not
>>>> being
>>>> > made a part of the same group.
>>>> >
>>>> > Fix:
>>>> > ----
>>>> >
>>>> > The top-panel-frame-setup (wherein the startup-notification-messages
>>>> may
>>>> > be added) gets processed, ONLY after the journal has been set-up.
>>>> > Thus, "gio.File.monitor_file" has been used as the signalling
>>>> mechanism.
>>>> >
>>>> > As rightly pointed out by Bernie and Sascha, gio-file-monitor might
>>>> not
>>>> > be the best signalling/synchronizing mechaism here. I tried to use
>>>> threading.Event()
>>>> > objects, but it needed to spawn another thread (note that all
>>>> operations
>>>> > happen here in the context of the main-thread, even for
>>>> "gobject.idle_add()"
>>>> > operations.
>>>> >
>>>> >
>>>> > CHANGELOG:
>>>> > ---------
>>>> >
>>>> > Changes of version-3 over version-2 :
>>>> > -------------------------------------
>>>> > a. Review changes as per Bernie and Sascha.
>>>> >
>>>> >
>>>> > Changes of version-2 over version-1 :
>>>> > -------------------------------------
>>>> > a. Reverted to the previous-behaviour, wherein the
>>>> notification-message-icon
>>>> >   is shown at the end of all activity-icons (Thanks Anish and
>>>> Estaban).
>>>> >   Of course, this included the fix of the issue :)
>>>> >
>>>> >
>>>> >  bin/sugar-session                  |   22 +++++++++++++++++++++-
>>>> >  src/jarabe/frame/activitiestray.py |   18 ++++++++++++++++++
>>>> >  2 files changed, 39 insertions(+), 1 deletions(-)
>>>> >
>>>> > diff --git a/bin/sugar-session b/bin/sugar-session
>>>> > index 40c9db7..1b28d4f 100755
>>>> > --- a/bin/sugar-session
>>>> > +++ b/bin/sugar-session
>>>> > @@ -21,6 +21,7 @@ import sys
>>>> >  import time
>>>> >  import subprocess
>>>> >  import shutil
>>>> > +import gio
>>>> >
>>>> >  if os.environ.get('SUGAR_LOGGER_LEVEL', '') == 'debug':
>>>> >     print '%r STARTUP: Starting the shell' % time.time()
>>>> > @@ -35,6 +36,9 @@ import gobject
>>>> >  import dbus.glib
>>>> >  import wnck
>>>> >
>>>> > +MONITORS = []
>>>> > +MONITOR_ACTION_TAKEN = False
>>>> > +
>>>> >  try:
>>>> >     import xklavier
>>>> >  except ImportError:
>>>> > @@ -181,15 +185,31 @@ def setup_window_manager():
>>>> >             shell=True):
>>>> >         logging.warning('Can not disable metacity keybindings')
>>>> >
>>>> > +def file_monitor_changed_cb(monitor, one_file, other_file,
>>>> event_type):
>>>> > +    global MONITOR_ACTION_TAKEN
>>>> > +    if (not MONITOR_ACTION_TAKEN) and \
>>>> > +       (one_file.get_path() ==
>>>> os.path.expanduser('~/.sugar/journal_created')):
>>>> > +        if event_type == gio.FILE_MONITOR_EVENT_CREATED:
>>>> > +            gobject.idle_add(setup_frame_cb)
>>>> > +            MONITOR_ACTION_TAKEN = True
>>>> > +
>>>> > +def arrange_for_setup_frame_cb():
>>>> > +    path = gio.File(os.path.expanduser('~/.sugar/journal_created'))
>>>> > +    monitor = path.monitor_file()
>>>> > +    monitor.connect('changed', file_monitor_changed_cb)
>>>> > +    MONITORS.append(monitor)
>>>> > +
>>>> >  def bootstrap():
>>>> >     setup_window_manager()
>>>> >
>>>> >     from jarabe.view import launcher
>>>> >     launcher.setup()
>>>> >
>>>> > -    gobject.idle_add(setup_frame_cb)
>>>> >     gobject.idle_add(setup_keyhandler_cb)
>>>> > +
>>>> > +    arrange_for_setup_frame_cb()
>>>> >     gobject.idle_add(setup_journal_cb)
>>>> > +
>>>> >     gobject.idle_add(setup_notification_service_cb)
>>>> >     gobject.idle_add(setup_file_transfer_cb)
>>>> >     gobject.idle_add(show_software_updates_cb)
>>>> > diff --git a/src/jarabe/frame/activitiestray.py
>>>> b/src/jarabe/frame/activitiestray.py
>>>> > index 2b8b7c6..1c8e285 100644
>>>> > --- a/src/jarabe/frame/activitiestray.py
>>>> > +++ b/src/jarabe/frame/activitiestray.py
>>>> > @@ -246,6 +246,24 @@ class ActivitiesTray(HTray):
>>>> >         button.connect('clicked', self.__activity_clicked_cb,
>>>> home_activity)
>>>> >         button.show()
>>>> >
>>>> > +        # JournalActivity is always the first activity to be added.
>>>> > +        # Broadcast the signal-of-its-creation.
>>>> > +        if group is None:
>>>> > +            self._signal_addition_of_journal_activity()
>>>> > +
>>>> > +    def _signal_addition_of_journal_activity(self):
>>>> > +        monitor_file = os.path.expanduser('~/.sugar/journal_created')
>>>> > +
>>>> > +        # Remove the file, if it exists.
>>>> > +        # This is important, since we are checking for the
>>>> > +        # FILE_CREATED event in the monitor.
>>>> > +        if os.path.exists(monitor_file):
>>>> > +            os.remove(monitor_file)
>>>> > +
>>>> > +        # Now, create the file.
>>>> > +        f = open(monitor_file, 'w')
>>>> > +        f.close()
>>>> > +
>>>> >     def __activity_removed_cb(self, home_model, home_activity):
>>>> >         logging.debug('__activity_removed_cb: %r', home_activity)
>>>> >         button = self._buttons[home_activity]
>>>> > --
>>>> > 1.7.4.4
>>>> >
>>>> > _______________________________________________
>>>> > Dextrose mailing list
>>>> > Dextrose at lists.sugarlabs.org
>>>> > http://lists.sugarlabs.org/listinfo/dextrose
>>>>
>>>>
>>>>
>>>> --
>>>> Anish | anish at sugarlabs.org
>>>> _______________________________________________
>>>> Dextrose mailing list
>>>> Dextrose at lists.sugarlabs.org
>>>> http://lists.sugarlabs.org/listinfo/dextrose
>>>>
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/dextrose/attachments/20120201/e7fc8a28/attachment-0001.html>
-------------- next part --------------
198a199
>             gobject.idle_add(show_notifications_cb)
222c223
<     gobject.idle_add(show_notifications_cb)
---
>     #gobject.idle_add(show_notifications_cb)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sugar-session
Type: application/octet-stream
Size: 10608 bytes
Desc: not available
URL: <http://lists.sugarlabs.org/archive/dextrose/attachments/20120201/e7fc8a28/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sugar-session.original
Type: application/octet-stream
Size: 10555 bytes
Desc: not available
URL: <http://lists.sugarlabs.org/archive/dextrose/attachments/20120201/e7fc8a28/attachment-0003.obj>


More information about the Dextrose mailing list