[sugar] Web activity & ebook reading
Ian Bicking
ianb
Sat May 5 20:46:37 EDT 2007
So we've been talking about "the" ebook reader, and how it might work.
For reading HTML or things that would be converted into HTML (e.g.,
Crossmark), the browser seems like an obvious basis for a reader.
There's not a huge number of basic features that aren't in the browser
currently. So we're thinking about how we might add these extra features.
I've been reading the list of methods as described here:
http://www.pygtk.org/pygtkmozembed/class-gtkmozembed.html
and there's not a lot of methods. Changing buttons, maybe allowing you
to switch modes, all seems pretty reasonable -- the code at least all
looks simple enough. But some of what we want to do involves getting at
the document object.
As an example, if you get to the bottom of a document, and the document
has a <link rel="next"> tag, then a page-down from there should take you
to the linked page. Then you can flow through a linear but multi-page
document fairly seamlessly (assuming it's been marked up nicely).
There's a variety of things we'd like to do, including injecting the
Javascript to implement the ubiquitous annotation.
Is the current browser activity -- and more specifically pygtkmozembed
-- the right basis for this kind of work? In the short term, are there
ways we can start adding these features (even if the implementation may
have to be discarded later)?
Looking at details, we were thinking that maybe browser.append_data()
could be used to inject at least a little Javascript. I tried adding
this to WebActivity.__init__:
self._browser.connect('notify::net-stop', self._doc_loaded_cb)
Then:
def self._doc_loaded_cb(self, embed, *args):
data = '<script>alert("hey!")</script>'
embed.append_data(StringIO(data), len(data))
But I couldn't get the signal to fire at all; I couldn't get any signals
to work except notify::title. Maybe there's something magic that I
don't understand here. Anyway, that might give me a crude way to hack
on stuff.
Cheers,
Ian
More information about the Sugar-devel
mailing list