Difference between revisions of "Features/Evince Introspection Bindings"

From Sugar Labs
Jump to navigation Jump to search
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<noinclude>{{TOCright}}
+
<noinclude>
[[Category:Feature Page Incomplete]]
+
[[Category:FeatureLanded|Evince Introspection Bindings]]
[[Category:Feature|WebKit]]
 
 
<!-- You can add categories to tie features back to real deployments/schools requesting them, for example  
 
<!-- You can add categories to tie features back to real deployments/schools requesting them, for example  
 
[[Category:Features requested by School Xyz|<Feature Name>]] (the |Feature Name option sorts the entry on the category page under the first letter of <Feature Name>). -->
 
[[Category:Features requested by School Xyz|<Feature Name>]] (the |Feature Name option sorts the entry on the category page under the first letter of <Feature Name>). -->
Line 16: Line 15:
 
== Current status ==
 
== Current status ==
 
* Targeted release: 0.96
 
* Targeted release: 0.96
* Last updated: 25/10/2011
+
* Last updated: 31 Jan 2012
* Percentage of completion: 0%
+
* Percentage of completion: 100%
  
 
== Initial information ==
 
== Initial information ==
  
* The bindings are not ready to use. We need work closely with upstream to solve the remaining issues.
+
* This feature depends on evince  3.4 (shipped in F17)
  
There is a related bug https://bugzilla.gnome.org/show_bug.cgi?id=635705
+
* The bindings are already fixed and packaged in Fedora Rawhide
the evince developers know we need it, and they are working on this.
 
The patches are against evince 3.4 (shipped in F17), after review of the patches, we need look if it can be backported to evince 3.2
 
to update Fedora 16.
 
  
 
=== Implementation plan ===
 
=== Implementation plan ===
Line 73: Line 69:
 
     app = HelloWorldApp()
 
     app = HelloWorldApp()
 
     app.run(None)
 
     app.run(None)
 
 
  
 
=== More information ===
 
=== More information ===
  
Simon did tests and report:
+
Not directly related. Evince developers have a request to support epub format [https://bugzilla.gnome.org/show_bug.cgi?id=539347].
  
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?
+
We are implementing our own epub reader displaying it with webkit. If implemented in evince, we can simplify our code a lot.
 
 
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 ==
''What is the benefit to the platform?  If this is a major capability update, what has changed?  If this is a new feature, what capabilities does it bring? Why will Sugar become a better platform or project because of this feature?''
 
  
''Make sure to note here as well if this feature has been requested by a specific deployment, or if it has emerged from a bug report.''
+
Have a working Read activity. Evince does not include the old bindings anymore.
  
 
== Scope ==
 
== Scope ==
Line 170: Line 88:
 
== How To Test ==
 
== How To Test ==
  
== User Experience ==
+
Need be tested in a F17 based image
''If this feature is noticeable by its target audience, how will their experiences change as a result?  Describe what they will see or notice.''
 
  
 
== Dependencies ==
 
== Dependencies ==
  
 +
Evince 3.4
  
== Contingency Plan ==
+
== Release Notes ==
''If you cannot complete your feature by the final development freeze, what is the backup plan?  This might be as simple as "None necessary, revert to previous release behaviour."  Or it might not.  If your feature is not completed in time, we want to assure others that other parts of Sugar will not be in jeopardy.''
 
 
 
== Documentation ==
 
''Is there upstream documentation on this feature, or notes you have written yourself?  Has this topic been discussed in the mailing list or during a meeting? Link to that material here so other interested developers can get involved.''
 
  
== Release Notes ==
+
This change is a internal implementation issue. To the users should be almost equal than the previous version.
''The Sugar Release Notes inform end-users about what is new in the release. An Example is [[0.84/Notes]]. The release notes also help users know how to deal with platform changes such as ABIs/APIs, configuration or data file formats, or upgrade concerns.  If there are any such changes involved in this feature, indicate them here.  You can also link to upstream documentation if it satisfies this need.  This information forms the basis of the release notes edited by the release team and shipped with the release.''
 
  
 
== Comments and Discussion ==
 
== Comments and Discussion ==
 
* See [[{{TALKPAGENAME}}|discussion tab for this feature]]
 
* See [[{{TALKPAGENAME}}|discussion tab for this feature]]

Latest revision as of 14:09, 5 November 2013


Summary

The pygtk bindings used until F14 to use the evince backend in Read activity, are no longer present in F16. We need use the new gi based bindings

Owner

Current status

  • Targeted release: 0.96
  • Last updated: 31 Jan 2012
  • Percentage of completion: 100%

Initial information

  • This feature depends on evince 3.4 (shipped in F17)
  • The bindings are already fixed and packaged in Fedora Rawhide

Implementation plan

The first step is port this simple demo to gtk3:

e = evince.View()
docmodel = evince.DocumentModel()
doc = evince.document_factory_get_document('file:///path/to/file/example.pdf')
docmodel.set_document(doc)
e.set_model(model)

With gtk 3 is:

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


class HelloWorldApp(Gtk.Application):
   def __init__(self):
       Gtk.Application.__init__(self, application_id="apps.test.helloevince",
                                flags=Gio.ApplicationFlags.FLAGS_NONE)
       self.connect("activate", self.on_activate)
       
   def on_activate(self, data=None):
       window = Gtk.Window(type=Gtk.WindowType.TOPLEVEL)
       window.set_title("Evince Gtk3 Python Example")
       window.set_border_width(24)
       scroll = Gtk.ScrolledWindow()
       window.add(scroll)
       EvinceDocument.init()
       doc = EvinceDocument.Document.factory_get_document('file:///home/gonzalo/Desktop/AjedrezyLeyendas-Postmortem.pdf')
       view = EvinceView.View()
       model = EvinceView.DocumentModel()
       model.set_document(doc)
       view.set_model(model)
       scroll.add(view)
       window.show_all()
       self.add_window(window)
   
if __name__ == "__main__":
   app = HelloWorldApp()
   app.run(None)

More information

Not directly related. Evince developers have a request to support epub format [1].

We are implementing our own epub reader displaying it with webkit. If implemented in evince, we can simplify our code a lot.

Benefit to Sugar

Have a working Read activity. Evince does not include the old bindings anymore.

Scope

What work do the developers have to accomplish to complete the feature in time for release? Is it a large change affecting many parts of the distribution or is it a very isolated change? What are those changes?

UI Design

Does the feature have a direct impact on the work flow, or does it need a UI? Link here mockups, or add detailed descriptions.

How To Test

Need be tested in a F17 based image

Dependencies

Evince 3.4

Release Notes

This change is a internal implementation issue. To the users should be almost equal than the previous version.

Comments and Discussion