Hey Michael,<br><br>Did you try applying Sayamindu's patch from the previous email (and did you see the associated screenshot)?<br><br>I'm surprised it hasn't been cleaned up and pushed by the Sugar dev team by now.<br>
<br>-Wade<br><br><div class="gmail_quote">On Sun, Jan 4, 2009 at 5:55 PM, Michael Stone <span dir="ltr"><<a href="mailto:michael@laptop.org">michael@laptop.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Sat, Jan 03, 2009 at 02:23:41PM -0500, Chris Marshall wrote:<br>
>Two specific questions come to mind:<br>
><br>
>(1) How does Sugar know that a new top level<br>
> window has been instantiated? Is there a<br>
> hook from the X server or what?<br>
<br>
</div>Here's a short code tour for your enjoyment. I'll start by tracing<br>
backwards from what we know:<br>
<br>
1. Clone the sugar source code:<br>
<br>
git clone git://<a href="http://git.sugarlabs.org/sugar/mainline.git" target="_blank">git.sugarlabs.org/sugar/mainline.git</a> sugar<br>
<br>
2. We know that things including gray circles appear in the top part of<br>
the frame. What causes this?<br>
<br>
cd sugar<br>
find . -name '*frame*'<br>
# Inspiration!<br>
cd src/jarabe/frame<br>
<br>
3. Start reading files here looking for info about how the frame is<br>
constructed.<br>
<br>
Ah hah! We find out from src/jarabe/frame/frame.py that the frame<br>
consists of four panels.<br>
<br>
<a href="http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/frame.py#line117" target="_blank">http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/frame.py#line117</a><br>
<br>
What goes in the top panel? Read _create_top_panel():<br>
<br>
<a href="http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/frame.py#line177" target="_blank">http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/frame.py#line177</a><br>
<br>
Bingo! An ActivitiesTray()!<br>
<br>
4. Go find ActivitiesTray():<br>
<br>
First, search for "ActivitiesTray". Find the import line at<br>
<br>
<a href="http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/frame.py#line29" target="_blank">http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/frame.py#line29</a><br>
<br>
Next, go read src/jarabe/frame/activitiestray.py looking for the<br>
definition of ActivitiesTray()<br>
<br>
<a href="http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/activitiestray.py#line299" target="_blank">http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/activitiestray.py#line299</a><br>
<br>
5. Figure out what message causes the tray to add icons.<br>
<br>
Doesn't that __activity_added_cb() callback look suspicious?<br>
<br>
Let's figure out what causes self._home_model to generate<br>
'activity-added' signals.<br>
<br>
6. Track down self._home_model.<br>
<br>
Ah! In ActivitiesTray.__init__, we set it equal to shell.get_model().<br>
<br>
Where does the variable "shell" come from? From here:<br>
<br>
<a href="http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/activitiestray.py#line39" target="_blank">http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/activitiestray.py#line39</a><br>
<br>
7. Track down 'get_model' in src/jarabe/model/shell.py<br>
<br>
<a href="http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/model/shell.py#line573" target="_blank">http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/model/shell.py#line573</a><br>
<br>
So what's a ShellModel?<br>
<br>
8. Look more carefully at ShellModel.<br>
<br>
We find the definition of the 'activity-added' signal here:<br>
<br>
<a href="http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/model/shell.py#line282" target="_blank">http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/model/shell.py#line282</a><br>
<br>
alongside several other tasty-sounding signals.<br>
<br>
...<br>
<br>
Oooh, look at the __init__ method:<br>
<br>
<a href="http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/model/shell.py#line310" target="_blank">http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/model/shell.py#line310</a><br>
<br>
Doesn't that "window-open" signal sound interesting?<br>
<br>
9. Review.<br>
<br>
We've pretty much figured out the chain of events that results in the<br>
appearance of a new button on the frame's top panel's activities tray.<br>
<br>
Moreover, while we still don't really know why the buttons sometimes<br>
display gray circles vs activity icons or how to remove a button, we<br>
can be fairly sure that the answers lie close by, e.g.<br>
<br>
(where the gray circles come from:)<br>
<a href="http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/activitiestray.py#line67" target="_blank">http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/frame/activitiestray.py#line67</a><br>
<br>
and back in jarabe.model.shell.ShellModel, which seems to be driving<br>
the show w.r.t. to the display and removal of items in the<br>
ActivitiesTray.<br>
<br>
10. Forward.<br>
<br>
The questions which remain include:<br>
<br>
a) What things are driving the ShellModel? Are they doing so<br>
correctly?<br>
<br>
hint: nope. read<br>
<a href="http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/model/shell.py#line434" target="_blank">http://git.sugarlabs.org/projects/sugar/repos/mainline/blobs/master/src/jarabe/model/shell.py#line434</a><br>
<a href="http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt" target="_blank">http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt</a><br>
<br>
(also, please help me get the ideas in the patches at the top of<br>
<a href="http://dev.laptop.org/git/users/mstone/sugar" target="_blank">http://dev.laptop.org/git/users/mstone/sugar</a> and<br>
<a href="http://dev.laptop.org/git/users/mstone/sugar-toolkit" target="_blank">http://dev.laptop.org/git/users/mstone/sugar-toolkit</a><br>
merged which, while they won't solve your problem, may still be<br>
generally useful.)<br>
<br>
b) What icon data should we be feeding into those buttons? Where<br>
does it come from?<br>
<br>
hint: read<br>
<a href="http://standards.freedesktop.org/wm-spec/latest/" target="_blank">http://standards.freedesktop.org/wm-spec/latest/</a><br>
<a href="http://standards.freedesktop.org/wm-spec/latest/ar01s05.html#id2569669" target="_blank">http://standards.freedesktop.org/wm-spec/latest/ar01s05.html#id2569669</a><br>
and start asking questions.<br>
<br>
Hope this helps,<br>
<font color="#888888"><br>
Michael<br>
</font><div><div></div><div class="Wj3C7c">_______________________________________________<br>
Devel mailing list<br>
<a href="mailto:Devel@lists.laptop.org">Devel@lists.laptop.org</a><br>
<a href="http://lists.laptop.org/listinfo/devel" target="_blank">http://lists.laptop.org/listinfo/devel</a><br>
</div></div></blockquote></div><br>