[Sugar-devel] Support for EPUB with Read in sugar-jhbuild?

James Simmons nicestep at gmail.com
Sat May 29 11:19:16 EDT 2010


Sayamindu,

I'm still working on my e-book book and not being able to read EPUBs
in Read under sugar-jhbuild has become a blocker for me.  I'm trying
to figure out what's wrong but print statements don't seem to ever
come out.  The only clue I've got is the stack trace I already sent to
you.

The code that runs the method that's failing looks like this:

        mimetype = mime.get_for_file(filepath)
        if mimetype == 'application/epub+zip':
            if not _EPUB_SUPPORT:
                self.close()
            self._epub = True
            self._setup_epub_viewer()
            self._document = epubadapter.EpubDocument(self._view,
filepath.replace('file://', ''))
        else:
            self._setup_evince_viewer()
            try:
                self._document = evince.factory_get_document(filepath)
            except GError, e:
                _logger.error('Can not load document: %s', e)
                return

I don't know what self.close() does.  It isn't enough to stop the
lines following from running and failing.

I did notice one odd thing.  epubpadapter.py is in the same directory
as readactivity.py, but epubadapter does an import of epubview and
that file is NOT in the same directory, but in a subdirectory called
epubview.  So that might be someting.

James Simmons


On Mon, Apr 26, 2010 at 3:04 PM, Sayamindu Dasgupta <sayamindu at gmail.com> wrote:
> On Mon, Apr 26, 2010 at 1:12 AM, James Simmons <nicestep at gmail.com> wrote:
>> Sayamindu,
>>
>> I installed pywebkitgtk on Fedora 11 and I still get this when trying
>> to read an EPUB using sugar-jhbuild:
>>
>> Traceback (most recent call last):
>>  File "/home/jim/sugar-jhbuild/install/lib/python2.6/site-packages/sugar/activity/activity.py",
>> line 437, in __canvas_map_cb
>>    self.read_file(self._jobject.file_path)
>>  File "/home/jim/sugar-jhbuild/install/share/sugar/activities/Read.activity/readactivity.py",
>> line 595, in read_file
>>    self._load_document('file://' + self._tempfile)
>>  File "/home/jim/sugar-jhbuild/install/share/sugar/activities/Read.activity/readactivity.py",
>> line 796, in _load_document
>>    self._setup_epub_viewer()
>>  File "/home/jim/sugar-jhbuild/install/share/sugar/activities/Read.activity/readactivity.py",
>> line 760, in _setup_epub_viewer
>>    self._view = epubadapter.View()
>> NameError: global name 'epubadapter' is not defined
>>
>> This looks pretty much like what I was getting yesterday before I
>> installed pywebkitgtk.
>>
>> James Simmons
>
>
> This is quite odd - it works fine for me. Read uses git submodules,
> but epubadapter.py is not a part of any submodule. Could you check if
> the epubadapter.py is getting installed or not ?
>
> Thanks,
> Sayamindu
>
>>
>>
>> On Sun, Apr 25, 2010 at 11:56 AM, Sayamindu Dasgupta
>> <sayamindu at gmail.com> wrote:
>>> Hi,
>>>
>>> On Sun, Apr 25, 2010 at 8:51 AM, James Simmons <nicestep at gmail.com> wrote:
>>>> I'm doing another FLOSS Manual on e-books and Sugar and one of the
>>>> things I'd like to do is get some screen shots of the Read Activity
>>>> reading an EPUB e-book.  I modified Get Internet Archive Books to
>>>> download EPUBs and that seems to work OK, but when I try to launch
>>>> Read on one of them it fails to start and complains of a missing
>>>> adapter.  As I remember it, EPUB support depended on something called
>>>> webkit, something like that, that was an alternative to gecko.  There
>>>> was some discussion here on whether we should support both that and
>>>> gecko.  So I have two questions:
>>>>
>>>> 1). How do I get Read as delivered by sugar-jhbuld to work with EPUBs?
>>>>
>>>> 2). Does Read support EPUBs on SoaS right now?  If not, what are our
>>>> future plans regarding EPUB support?
>>>>
>>>
>>> Read should be able to render EPUB files if pywebkitgtk is installed.
>>> Thanks,
>>> Sayamindu
>>>
>>>
>>> --
>>> Sayamindu Dasgupta
>>> [http://sayamindu.randomink.org/ramblings]


More information about the Sugar-devel mailing list