diff options
author | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2006-10-26 20:05:48 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2006-10-26 20:05:48 (GMT) |
commit | ee29e5ec0073c93e99f70788dbae5291c7f3f5b0 (patch) | |
tree | 5c12f43f0a6cc28199b1a860d22cc44f89d6bb0c | |
parent | f5ed91621f4c5abb37f93c98a401b797e8ce20cf (diff) |
Added execute method for passing the file name of the file to open.
-rw-r--r-- | XbookActivity.py | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/XbookActivity.py b/XbookActivity.py index e5a6ae6..c0a9200 100644 --- a/XbookActivity.py +++ b/XbookActivity.py @@ -1,4 +1,5 @@ import os +import logging from gettext import gettext as _ import gtk import evince @@ -7,30 +8,35 @@ from sugar.activity.Activity import Activity from toolbar import Toolbar class XbookActivity(Activity): - def __init__(self): - Activity.__init__(self) + def __init__(self): + Activity.__init__(self) - self.set_title(_('Read Activity')) - - evince.job_queue_init() - evince_view = evince.View() - - vbox = gtk.VBox(False, 0) - self.add(vbox) - vbox.show() + 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() - toolbar = Toolbar(evince_view) - vbox.pack_start(toolbar, False) - toolbar.show() - - scrolled = gtk.ScrolledWindow() - vbox.pack_start(scrolled, True, True) - scrolled.show() + toolbar = Toolbar(self._evince_view) + vbox.pack_start(toolbar, False) + toolbar.show() + + scrolled = gtk.ScrolledWindow() + vbox.pack_start(scrolled, True, True) + scrolled.show() - scrolled.add(evince_view) - evince_view.show() + scrolled.add(self._evince_view) + self._evince_view.show() - test_file = 'file://' + os.path.expanduser('~/test.pdf') - document = evince.factory_get_document(test_file) - evince_view.set_document(document) - toolbar.set_document(document) + def execute(self, command, args): + if(command == 'open_document'): + #FIXME: Get the entire path from GSugarDownload + file_name = '/tmp/' + args[0] + + document = evince.factory_get_document('file://' + file_name) + self._evince_view.set_document(document) + toolbar.set_document(document) |