Features/Evince Introspection Bindings: Difference between revisions

Godiard (talk | contribs)
Godiard (talk | contribs)
Line 45: Line 45:
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:
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
from gi.repository import EvinceDocument
dir(EvinceDocument)
dir(EvinceDocument)


from gi.repository import EvinceView
from gi.repository import EvinceView
dir(EvinceView)
dir(EvinceView)


Works!
Works!
Line 59: Line 59:
Furthermore are present:
Furthermore are present:


help(view)
help(view)
view.set_model
view.set_model
view.can_zoom_in, view.can_zoom_out
view.can_zoom_in, view.can_zoom_out
view.zoom_in
view.zoom_in
view_zoom_out
view_zoom_out
view.find_next
view.find_next
view.find_previous
view.find_previous
view.scroll
view.scroll
view.copy
view.copy
view.find_set_highlight_search
view.find_set_highlight_search


I could not find: update_view_size, find_changed
I could not find: update_view_size, find_changed


Some further transitions:
Some further transitions:
evince.JobFind -> EvinceView.JobFind
 
evince.Job.scheduler_push_job -> EvinceView.Job
evince.JobFind -> EvinceView.JobFind
evince.Job.scheduler_push_job -> EvinceView.Job


I could not find: evince.SIZING_* (e.g. evince.SIZING_BEST_FIT)
I could not find: evince.SIZING_* (e.g. evince.SIZING_BEST_FIT)
Line 85: Line 86:
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:
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
>>> EvinceDocument.factory_get_document
Traceback (most recent call last):
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/gi/module.py", line 243, in __getattr__
  File "/usr/lib/python2.7/site-packages/gi/module.py", line 243, in __getattr__
Line 92: Line 93:
  File "/usr/lib/python2.7/site-packages/gi/module.py", line 105, in __getattr__
  File "/usr/lib/python2.7/site-packages/gi/module.py", line 105, in __getattr__
   self.__name__, name))
   self.__name__, name))
AttributeError: 'gi.repository.EvinceDocument' object has no attribute 'factory_get_document'
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:
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"
<function name="factory_get_document"
               c:identifier="ev_document_factory_get_document"
               c:identifier="ev_document_factory_get_document"
               introspectable="0"
               introspectable="0"