Monday, January 19, 2009

Embedding Evince, GNOME Mobile and GNOME 4.0

Evince gets embeddable

The fine evince hackers, with special mention to Carlos Garcia Campos, have been of great help during the last week as I was trying to get upstreamed our sugar-evince fork.

Sugar had to modify Evince so we could link python programs against it and build the intended user experience, quite different from that in GNOME. Several people (Marco Pesenti Gritti, Reinier Heeres and Daniel Drake) had worked on it during the last two years, though in the rush to ship a complete learning environment, never got to upstream the changes. Check out the design mockup by Eben Eliason of our document viewer:


So Evince 2.25.5 is going to ship with libevview and I'm going to ask for an exception of the API freeze so we can get the python bindings in the next release of gnome-python-desktop. Then you will be able to write something like this and get your own document viewer:

import evince
import gtk

w = gtk.Window()
w.show()

e = evince.View()
w.add(e)
e.show()

document = evince.factory_get_document('file:///home/tomeu/Desktop/comic.pdf')
e.set_document(document)

gtk.main()


What has this to do with GNOME Mobile?

GNOME Mobile is a platform for other people to build their own software on. Most of the solutions that people base on GNOME Mobile will be able to run unmodified GNOME applications, but given hardware constraints or different intended user experiences that won't happen too often.

Platforms like Maemo have had to maintain their fork of Evince and apply patches to it so they can provide a document viewer that conforms to the Hildon UI guidelines. I can only guess that this is very expensive for Nokia, and what about other vendors interested in basing their software on GNOME Mobile? Will they have the resources needed to maintain forks of all the GNOME applications they wish to reuse?

So I hope other people will feel attracted by the advantages of exposing widgets out of apps and we can work together so as time passes more and more GNOME apps can be embedded and new UIs get built around them.

And GNOME 4.0?

I have no idea what GNOME 4.0 will be, but I know that lots of people (and organizations) in the GNOME world are not resigning themselves to build a Windows-clone and are willing to explore new user experiences that help computing to bring more benefits to more people.

By splitting base functionality to shared libraries and making easier to build new UIs around them, we have a better base on which to play and experiment, until the day will come ;)

13 comments:

Anonymous said...

> Then you will be able to write something like this and get your own document viewer: [...]

Even in a web browser?

Read: Will this finally pave the way for an evince plugin in our favorite web browser?

Tomeu Vizoso said...

Yes, Sayamindu Dasgupta already wrote a small python script that embeds evince plus some controls and then used mozplugger to put it inside mozilla:

http://sayamindu.randomink.org/ramblings/2008/10/14/14th-october-2008/

Unknown said...

I think that if gnome had a similar technology to kparts (from kde) this issues would be far easier to fix

Anonymous said...

Hm, well, I was thinking about a native evince plugin for epiphany -- not a "hack" (sorry!) via mozplugger.

Tomeu Vizoso said...

> Hm, well, I was thinking about a native evince plugin for epiphany -- not a "hack" (sorry!) via mozplugger.

libevview allows you to do both, see here:

http://mail.gnome.org/archives/evince-list/2009-January/msg00023.html

andre klapper said...

"I'm going to ask for an exception of the API freeze"

Please see http://live.gnome.org/ReleasePlanning/RequestingFreezeBreaks and ask the r-t by mail *before* breaking the API. Much appreciated. :-)

Tomeu Vizoso said...

> Please see http://live.gnome.org/ReleasePlanning/RequestingFreezeBreaks and ask the r-t by mail *before* breaking the API. Much appreciated. :-)

Thanks for your interest, you can track the process here:

http://bugzilla.gnome.org/show_bug.cgi?id=568287

As you can see, there are still some (small) issues that need to be solved before the bindings will accepted, but I hope those will be solved soon.

Anonymous said...

Reinout: I find it sometimes useful to have a PDF in just another browser tab next to some thematically related web sites, instead of having it in a separate window showing up in the taskbar.

Anonymous said...

Doesn't evince render full pages... hopefully the library will be reworked to be more suitable to memory/cpu constrained devices (partial page rendering / background rendering so user can still interact while it fills in detail)

Tomeu Vizoso said...

> Doesn't evince render full pages... hopefully the library will be reworked to be more suitable to memory/cpu constrained devices (partial page rendering / background rendering so user can still interact while it fills in detail)

Yes, that's a big problem for us, specially because the new screens that are getting in the market have much higher resolutions, thus having to store lots more of pixels.

Anonymous said...

Yes, this trend towards widgets in separate libraries is really promising. Think of a LaTeX-Plugin for gedit with integrated document preview through an embedded evince widget. :-)

And a document viewer plugin for web browsers that has it's own set of minimalistic controls makes much more sense than simply embedding a complex application into a web browser window.

I think the Sugar project has done quite a lot for the GNOME project as a whole.

mihai007 said...

I already done a latex preview for gedit using python poppler. I am looking forward to release code somewhere, when it gets more stable.

Info and Screenshot:
http://ubuntuforums.org/showthread.php?p=6284498#post6284498

Juanjo MarĂ­n said...

Tomeu:

Updated example using fresh master evince and master gnome-python-desktop with your patch #604751:

import evince
import gtk

window = gtk.Window()
window.show()

view = evince.View()
document = evince.document_factory_get_document ('file:///home/jjmarin/Desktop/ejemplo.pdf')
document_model = evince.DocumentModel()
document_model.set_document(document)
view.set_model(document_model)
view.set_presentation(True)

window.add(view)
view.show()

gtk.main()