blob: d4324def7b17dee9eb1401977acf6661e22f1033 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
import logging
from gettext import gettext as _
import gtk
import evince
from sugar.activity.Activity import Activity
from toolbar import Toolbar
class XbookActivity(Activity):
def __init__(self):
Activity.__init__(self)
logging.debug('Starting xbook...')
self.set_title(_('Read Activity'))
evince.job_queue_init()
self._evince_view = evince.View()
vbox = gtk.VBox(False, 0)
self.add(vbox)
vbox.show()
self._toolbar = Toolbar(self._evince_view)
vbox.pack_start(self._toolbar, False)
self._toolbar.show()
scrolled = gtk.ScrolledWindow()
vbox.pack_start(scrolled, True, True)
scrolled.show()
scrolled.add(self._evince_view)
self._evince_view.show()
def execute(self, command, args):
if(command == 'open_document'):
document = evince.factory_get_document('file://' + args[0])
self._evince_view.set_document(document)
self._toolbar.set_document(document)
|