[evince] Read pdf index with evince using python bindings



Hi,
I need read the index of a pdf file using evince and the python bindings,
but after the job is finished, the model is None.

I filled a bug [1] with a nice testcase:

from gi.repository import Gtk
from gi.repository import EvinceDocument
from gi.repository import EvinceView

EvinceDocument.init()

doc =  EvinceDocument.Document.factory_get_document('file:///home/gonzalo/Desktop/Libros/La_gran_manzana.pdf')

def job_finished_cb(job):
    print 'Read links job finished. model class:', job.model.__class__

view = EvinceView.View()

model = EvinceView.DocumentModel()
model.set_document(doc)
view.set_model(model)

if not doc.has_document_links():
    print 'The pdf file does not have a index'
else:
    jl = EvinceView.JobLinks.new(document=doc)
    jl.connect('finished', job_finished_cb)
    EvinceView.Job.scheduler_push_job(jl, EvinceView.JobPriority.PRIORITY_NONE)

win = Gtk.Window()
scrolled = Gtk.ScrolledWindow()
win.add(scrolled)
scrolled.add_with_viewport(view)

win.set_default_geometry(200, 300)
win.connect("destroy", Gtk.main_quit)

win.show_all()
Gtk.main()

I am doing something wrong or there are a problem with the bindings?
Regards,

Gonzalo

[1] https://bugzilla.gnome.org/show_bug.cgi?id=682882 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]