anonymous gray activity circles

Michael Stone michael at laptop.org
Sun Jan 4 17:55:39 EST 2009


On Sat, Jan 03, 2009 at 02:23:41PM -0500, Chris Marshall wrote:
>Two specific questions come to mind:
>
>(1) How does Sugar know that a new top level
>     window has been instantiated?  Is there a
>     hook from the X server or what?

Here's a short code tour for your enjoyment. I'll start by tracing
backwards from what we know:

1. Clone the sugar source code:

   git clone git://git.sugarlabs.org/sugar/mainline.git sugar

2. We know that things including gray circles appear in the top part of
the frame. What causes this?

   cd sugar
   find . -name '*frame*'
   # Inspiration!
   cd src/jarabe/frame

3. Start reading files here looking for info about how the frame is
constructed. 

   Ah hah! We find out from src/jarabe/frame/frame.py that the frame
   consists of four panels.

   http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/frame.py#line117

   What goes in the top panel? Read _create_top_panel():

   http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/frame.py#line177

   Bingo! An ActivitiesTray()!

4. Go find ActivitiesTray():

   First, search for "ActivitiesTray". Find the import line at

   http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/frame.py#line29

   Next, go read src/jarabe/frame/activitiestray.py looking for the
   definition of ActivitiesTray()

   http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/activitiestray.py#line299

5. Figure out what message causes the tray to add icons.

   Doesn't that __activity_added_cb() callback look suspicious? 
   
   Let's figure out what causes self._home_model to generate
   'activity-added' signals.

6. Track down self._home_model.

   Ah! In ActivitiesTray.__init__, we set it equal to shell.get_model().

   Where does the variable "shell" come from? From here:

   http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/activitiestray.py#line39

7. Track down 'get_model' in src/jarabe/model/shell.py

   http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/model/shell.py#line573

   So what's a ShellModel?

8. Look more carefully at ShellModel.

   We find the definition of the 'activity-added' signal here:
   
   http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/model/shell.py#line282

   alongside several other tasty-sounding signals.

   ...

   Oooh, look at the __init__ method:

   http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/model/shell.py#line310

   Doesn't that "window-open" signal sound interesting?

9. Review.

   We've pretty much figured out the chain of events that results in the
   appearance of a new button on the frame's top panel's activities tray.

   Moreover, while we still don't really know why the buttons sometimes
   display gray circles vs activity icons or how to remove a button, we
   can be fairly sure that the answers lie close by, e.g.

   (where the gray circles come from:)
   http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/activitiestray.py#line67 

   and back in jarabe.model.shell.ShellModel, which seems to be driving
   the show w.r.t. to the display and removal of items in the
   ActivitiesTray.

10. Forward.

   The questions which remain include:

     a) What things are driving the ShellModel? Are they doing so
     correctly?

        hint: nope. read 
          http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/model/shell.py#line434
          http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt

        (also, please help me get the ideas in the patches at the top of
          http://dev.laptop.org/git/users/mstone/sugar and 
          http://dev.laptop.org/git/users/mstone/sugar-toolkit
        merged which, while they won't solve your problem, may still be
        generally useful.)

     b) What icon data should we be feeding into those buttons? Where
     does it come from?

        hint: read 
          http://standards.freedesktop.org/wm-spec/latest/
          http://standards.freedesktop.org/wm-spec/latest/ar01s05.html#id2569669
        and start asking questions.

Hope this helps,

Michael 



More information about the Devel mailing list