Line 36: |
Line 36: |
| docmodel.set_document(doc) | | docmodel.set_document(doc) |
| e.set_model(model) | | e.set_model(model) |
| + | |
| + | === More information === |
| + | |
| + | Simon did tests and report: |
| + | |
| + | what I did today to get a bit of a feeling of what is needed to port Read was looking at the evince bidings through introspection. So first, hmmm what is the gi repository called? |
| + | |
| + | In Fedora you can have a look at '/usr/lib/girepository-1.0/' and find out that there is a EvinceDocument-3.0.typelib and a EvinceDocument-3.0.typelib. If we have a quick look at [1] we find out that the .typelib is a Binary version of the invocation info. Ok let's try this: |
| + | |
| + | from gi.repository import EvinceDocument |
| + | dir(EvinceDocument) |
| + | |
| + | from gi.repository import EvinceView |
| + | dir(EvinceView) |
| + | |
| + | Works! |
| + | |
| + | Looking at the invokations in read/evinceadapter.py I did extract the calls we did previously on the evince module (e.g. evince.View()) and checked if they were present, too. |
| + | |
| + | The evince.View() is now EvinceView.View(). |
| + | |
| + | Furthermore are present: |
| + | |
| + | help(view) |
| + | view.set_model |
| + | view.can_zoom_in, view.can_zoom_out |
| + | view.zoom_in |
| + | view_zoom_out |
| + | view.find_next |
| + | view.find_previous |
| + | view.scroll |
| + | view.copy |
| + | view.find_set_highlight_search |
| + | |
| + | I could not find: update_view_size, find_changed |
| + | |
| + | Some further transitions: |
| + | evince.JobFind -> EvinceView.JobFind |
| + | evince.Job.scheduler_push_job -> EvinceView.Job |
| + | |
| + | I could not find: evince.SIZING_* (e.g. evince.SIZING_BEST_FIT) |
| + | |
| + | More info on the EvinceView API are at [2]. |
| + | |
| + | |
| + | And then I came across an hard one (which I have not solved yet): |
| + | |
| + | I could not find out how 'evince.document_factory_get_document(file_path)' should be called now. Looking at the API it should be maybe something like EvinceDocument.factory_get_document, trying that: |
| + | |
| + | >>> EvinceDocument.factory_get_document |
| + | Traceback (most recent call last): |
| + | File "<stdin>", line 1, in <module> |
| + | File "/usr/lib/python2.7/site-packages/gi/module.py", line 243, in __getattr__ |
| + | return getattr(self._introspection_module, name) |
| + | File "/usr/lib/python2.7/site-packages/gi/module.py", line 105, in __getattr__ |
| + | self.__name__, name)) |
| + | AttributeError: 'gi.repository.EvinceDocument' object has no attribute 'factory_get_document' |
| + | >>> |
| + | |
| + | Hmm, I did get the sources, then to have a look because the .typelib is a Binary version of the invocation info and therefore I need to have a look at the .gir file to dig a bit deeper. After installing all the dependencies I did a './autogen.sh --enable-introspection' and run 'make' and had a .gir file placed in libdocument/EvinceDocument-3.0.gir. Looking at the definition it says: |
| + | |
| + | <function name="factory_get_document" |
| + | c:identifier="ev_document_factory_get_document" |
| + | introspectable="0" |
| + | throws="1"> |
| + | |
| + | Hmm, so it should not be available 'introspectable="0"'. Why, how, this exercise is left to the reader, I am a bit stuck on this :) |
| + | |
| + | A good resource for asking related is questions is #introspection on GimpNet. I have attached the chat I had with Tomeu about that issue. |
| + | |
| + | Regards, |
| + | Simon |
| + | |
| + | [1] http://live.gnome.org/GObjectIntrospection/Architecture |
| + | [2] http://developer.gnome.org/libevview/stable/ |
| + | [3] http://developer.gnome.org/libevdocument/stable/libevdocument-ev-document-factory.html |
| + | |
| + | The gir file is installed with the package evince-devel in /usr/share/gir-1.0/EvinceDocument-3.0.gir |
| | | |
| == Benefit to Sugar == | | == Benefit to Sugar == |