[sugar] 9.1 proposal: View source key everywhere

Tomeu Vizoso tomeu at tomeuvizoso.net
Thu Oct 23 08:53:59 EDT 2008


Hi,

I think that with a small effort, we could implement something much
better than what we have today.

We have glorious plans for the view source key, but as no resources
have been devoted to them, perhaps we should scale back and make sure
that we provide the best we can today. And let the future deal with
the dreams.

Have hacked a quick way of displaying the contents of the currently
active activity bundle, along with displaying the source code if the
activity ships its source inside the bundle.

Screenshot of Implode's source: http://dev.laptop.org/~tomeu/viewsource.png

The approach I have followed is installing a global keybinding that is
handled in the shell. If you want to try it, it's a matter of dropping
the file in the url below into
~/sugar-jhbuild/install/share/sugar/extensions/globalkey, if you have
a recent enough sugar-jhbuild.

http://dev.laptop.org/~tomeu/viewsource.py

This approach has a good thing that is that works everywhere, but has
a major problem: doesn't let activities override it and handle
themselves the view source key event. This is very bad for activities
like Etoys, the ones produced by Pippy or activities that would prefer
to display the source code for the _content_ loaded in that moment
(Browse).

Alternative 1: Move it to sugar-toolkit, would be available to all
python activities, and activities would be able to override it easily.
Inconvenient: non-python activities wouldn't benefit from it.

Alternative 2: Add a mechanism for the shell to know if an activity
wishes to provide its own view source window. It could be done by
adding one more D-Bus method or by adding one more property to
activity.info. Inconvenient: adds complexity to activity development.

Opinions?

Thanks,

Tomeu


More information about the Sugar mailing list