[Sugar-devel] [PATCH Read] adapt to evince 2.30 API (SL#1900)
Sascha Silbe
sascha-pgp at silbe.org
Sun Dec 5 07:41:18 EST 2010
From: Lucian Branescu Mihaila <lucian.branescu at gmail.com>
PDFs are working fine, EPub support is limited:
- search not working
- copy to clipboard disabled
- zoom disabled
- page next/prev disabled
Tested-by: Sascha Silbe <sascha-pgp at silbe.org>
[combined into a single patch, wrote patch description, minor style clean-ups]
Signed-off-by: Sascha Silbe <sascha-pgp at silbe.org>
---
Based on my clean-up patches, so those need to be merged first.
epubadapter.py | 3 -
epubview/epub.py | 4 +-
epubview/epubview.py | 34 ++++++++---------
readactivity.py | 102 +++++++++++++++++++++++++++----------------------
readtoolbar.py | 71 +++++++++++++++++++---------------
readtopbar.py | 37 +++++++++++-------
6 files changed, 137 insertions(+), 114 deletions(-)
diff --git a/epubadapter.py b/epubadapter.py
index 2bea967..a11cdd7 100644
--- a/epubadapter.py
+++ b/epubadapter.py
@@ -51,9 +51,6 @@ class EpubDocument(epubview.Epub):
epubview.Epub.__init__(self, docpath)
self._page_cache = view
- def get_page_cache(self):
- return self._page_cache
-
def get_n_pages(self):
return int(self._page_cache.get_pagecount())
diff --git a/epubview/epub.py b/epubview/epub.py
index 9a05abf..560c20a 100644
--- a/epubview/epub.py
+++ b/epubview/epub.py
@@ -137,9 +137,9 @@ class _Epub(object):
def get_info(self):
'''
- Returns a EpubInfo object for the open Epub file
+ Returns a EpubInfo object title
'''
- return self._info
+ return self._info.title
def close(self):
'''
diff --git a/epubview/epubview.py b/epubview/epubview.py
index 31acb3f..197dcd3 100644
--- a/epubview/epubview.py
+++ b/epubview/epubview.py
@@ -37,15 +37,14 @@ LOADING_HTML = '''
class _View(gtk.HBox):
__gproperties__ = {
- 'has-selection': (gobject.TYPE_BOOLEAN, 'whether has selection',
- 'whether the widget has selection or not',
- 0, gobject.PARAM_READABLE),
- 'zoom': (gobject.TYPE_FLOAT, 'the zoom level',
- 'the zoom level of the widget',
- 0.5, 4.0, 1.0, gobject.PARAM_READWRITE),
+ 'scale' : (gobject.TYPE_FLOAT, 'the zoom level',
+ 'the zoom level of the widget',
+ 0.5, 4.0, 1.0, gobject.PARAM_READWRITE),
}
__gsignals__ = {
'page-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])),
+ 'selection-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
+ ([])),
}
def __init__(self):
@@ -63,8 +62,8 @@ class _View(gtk.HBox):
self.__going_fwd = True
self.__going_back = False
self.__page_changed = False
- self.has_selection = False
- self.zoom = 1.0
+ self._has_selection = False
+ self.scale = 1.0
self._epub = None
self._findjob = None
self.__in_search = False
@@ -107,9 +106,9 @@ class _View(gtk.HBox):
def do_get_property(self, property):
if property.name == 'has-selection':
- return self.has_selection
+ return self._has_selection
elif property.name == 'zoom':
- return self.zoom
+ return self.scale
else:
raise AttributeError, 'unknown property %s' % property.name
@@ -123,7 +122,7 @@ class _View(gtk.HBox):
'''
Returns True if any part of the content is selected
'''
- return self.get_property('has-selection')
+ return self._has_selection
def get_zoom(self):
'''
@@ -161,7 +160,7 @@ class _View(gtk.HBox):
'''
Returns True if it is possible to zoom in further
'''
- if self.zoom < 4:
+ if self.scale < 4:
return True
else:
return False
@@ -170,7 +169,7 @@ class _View(gtk.HBox):
'''
Returns True if it is possible to zoom out further
'''
- if self.zoom > 0.5:
+ if self.scale > 0.5:
return True
else:
return False
@@ -293,12 +292,11 @@ class _View(gtk.HBox):
def __set_zoom(self, value):
self._view.set_zoom_level(value)
- self.zoom = value
+ self.scale = value
def __set_has_selection(self, value):
- if value != self.has_selection:
- self.has_selection = value
- self.notify('has-selection')
+ if value != self._has_selection:
+ self._has_selection = value
def _view_populate_popup_cb(self, view, menu):
menu.destroy() #HACK
@@ -308,6 +306,7 @@ class _View(gtk.HBox):
# FIXME: This does not seem to be implemented in
# webkitgtk yet
print view.has_selection()
+ self.emit('selection-changed')
def _view_buttonrelease_event_cb(self, view, event):
# Ugly hack
@@ -350,7 +349,6 @@ class _View(gtk.HBox):
return False
def _view_load_finished_cb(self, v, frame):
-
# Normally the line below would not be required - ugly workaround for
# possible Webkit bug. See : https://bugs.launchpad.net/bugs/483231
self._sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_NEVER)
diff --git a/readactivity.py b/readactivity.py
index 5aff808..ba8bbfa 100644
--- a/readactivity.py
+++ b/readactivity.py
@@ -54,8 +54,9 @@ from readtopbar import TopBar
_EPUB_SUPPORT = True
try:
import epubadapter
-except:
+except ImportError, e:
_EPUB_SUPPORT = False
+ logging.warning('Epub support disabled because: %s' % e)
_HARDWARE_MANAGER_INTERFACE = 'org.laptop.HardwareManager'
@@ -138,10 +139,6 @@ class ReadActivity(activity.Activity):
def __init__(self, handle):
activity.Activity.__init__(self, handle)
- if hasattr(evince, 'evince_embed_init'):
- # if we use evince-2.24
- evince.evince_embed_init()
-
self._epub = False
self._document = None
self._fileserver = None
@@ -180,8 +177,6 @@ class ReadActivity(activity.Activity):
edit_toolbar_button.show()
self._view_toolbar = ViewToolbar()
- self._view_toolbar.connect('needs-update-size',
- self.__view_toolbar_needs_update_size_cb)
self._view_toolbar.connect('go-fullscreen',
self.__view_toolbar_go_fullscreen_cb)
view_toolbar_button = ToolbarButton(
@@ -418,7 +413,7 @@ class ReadActivity(activity.Activity):
elif page < 0:
page = 0
- self._document.get_page_cache().set_current_page(page)
+ self._model.props.page = page
entry.props.text = str(page + 1)
def __go_back_cb(self, button):
@@ -434,42 +429,42 @@ class ReadActivity(activity.Activity):
self._view.next_page()
def __prev_bookmark_activate_cb(self, menuitem):
- page = self._document.get_page_cache().get_current_page()
+ page = self._model.props.page
bookmarkmanager = self._sidebar.get_bookmarkmanager()
prev_bookmark = bookmarkmanager.get_prev_bookmark_for_page(page)
if prev_bookmark is not None:
- self._document.get_page_cache().set_current_page(prev_bookmark.page_no)
+ self._model.props.page = prev_bookmark.page_no
def __next_bookmark_activate_cb(self, menuitem):
- page = self._document.get_page_cache().get_current_page()
+ page = self._model.props.page
bookmarkmanager = self._sidebar.get_bookmarkmanager()
next_bookmark = bookmarkmanager.get_next_bookmark_for_page(page)
if next_bookmark is not None:
- self._document.get_page_cache().set_current_page(next_bookmark.page_no)
+ self._model.props.page = next_bookmark.page_no
def __bookmarker_toggled_cb(self, button):
- page = self._document.get_page_cache().get_current_page()
+ page = self._model.props.page
if self._bookmarker.props.active:
self._sidebar.add_bookmark(page)
else:
self._sidebar.del_bookmark(page)
- def __page_changed_cb(self, page, proxy=None):
+ def __page_changed_cb(self, model, page_from, page_to):
self._update_nav_buttons()
if hasattr(self._document, 'has_document_links'):
if self._document.has_document_links():
self._toc_select_active_page()
- self._sidebar.update_for_page(self._document.get_page_cache().get_current_page())
+ self._sidebar.update_for_page(self._model.props.page)
self._bookmarker.handler_block(self._bookmarker_toggle_handler_id)
self._bookmarker.props.active = self._sidebar.is_showing_local_bookmark()
self._bookmarker.handler_unblock(self._bookmarker_toggle_handler_id)
def _update_nav_buttons(self):
- current_page = self._document.get_page_cache().get_current_page()
+ current_page = self._model.props.page
self._back_button.props.sensitive = current_page > 0
self._forward_button.props.sensitive = \
current_page < self._document.get_n_pages() - 1
@@ -520,7 +515,7 @@ class ReadActivity(activity.Activity):
iter = self._navigator.get_active_iter()
current_link = self._toc_model.get(iter, 1)[0]
- current_page = self._document.get_page_cache().get_current_page()
+ current_page = self._model.props.page
if not hasattr(current_link, 'get_page'):
filepath = self._view.get_current_file()
@@ -621,20 +616,20 @@ class ReadActivity(activity.Activity):
try:
self.metadata['Read_current_page'] = \
- str(self._document.get_page_cache().get_current_page())
+ str(self._model.props.page)
- self.metadata['Read_zoom'] = str(self._view.props.zoom)
+ self.metadata['Read_zoom'] = str(self._model.props.scale)
if not self._epub:
- if self._view.props.sizing_mode == evince.SIZING_BEST_FIT:
+ if self._model.props.sizing_mode == evince.SIZING_BEST_FIT:
self.metadata['Read_sizing_mode'] = "best-fit"
- elif self._view.props.sizing_mode == evince.SIZING_FREE:
+ elif self._model.props.sizing_mode == evince.SIZING_FREE:
self.metadata['Read_sizing_mode'] = "free"
- elif self._view.props.sizing_mode == evince.SIZING_FIT_WIDTH:
+ elif self._model.props.sizing_mode == evince.SIZING_FIT_WIDTH:
self.metadata['Read_sizing_mode'] = "fit-width"
else:
_logger.error("Don't know how to save sizing_mode state '%s'" %
- self._view.props.sizing_mode)
+ self._model.props.sizing_mode)
self.metadata['Read_sizing_mode'] = "fit-width"
self.metadata['Read_search'] = \
@@ -766,17 +761,16 @@ class ReadActivity(activity.Activity):
def _setup_epub_viewer(self):
self._view = epubadapter.View()
self._view.set_screen_dpi(_get_screen_dpi())
- self._view.connect('notify::has-selection',
- self._view_notify_has_selection_cb)
+ self._view.connect('selection-changed',
+ self._view_selection_changed_cb)
self._hbox.pack_start(self._view, expand=True, fill=True)
self._view.show_all()
def _setup_evince_viewer(self):
self._view = evince.View()
- self._view.set_screen_dpi(_get_screen_dpi())
- self._view.connect('notify::has-selection',
- self._view_notify_has_selection_cb)
+ self._view.connect('selection-changed',
+ self._view_selection_changed_cb)
self._scrolled = gtk.ScrolledWindow()
self._scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
@@ -798,22 +792,39 @@ class ReadActivity(activity.Activity):
if mimetype == 'application/epub+zip':
if not _EPUB_SUPPORT:
self.close()
+ return
self._epub = True
self._setup_epub_viewer()
self._document = epubadapter.EpubDocument(self._view, filepath.replace('file://', ''))
+ self._model = None
+
+ self._view.set_document(self._document)
else:
self._setup_evince_viewer()
try:
- self._document = evince.factory_get_document(filepath)
+ self._document = evince.document_factory_get_document(filepath)
except GError, e:
_logger.error('Can not load document: %s', e)
return
+ else:
+ self._model = evince.DocumentModel()
+ self._model.set_document(self._document)
+ self._view.set_model(self._model)
- self._view_toolbar.set_view(self._view)
- self._edit_toolbar.set_view(self._view)
+ # set dpi
+ dpi = _get_screen_dpi()
+ min_scale = self._model.get_min_scale()
+ max_scale = self._model.get_max_scale()
+ self._model.set_min_scale(min_scale * dpi / 72.0)
+ self._model.set_max_scale(max_scale * dpi / 72.0)
self._want_document = False
- self._view.set_document(self._document)
+
+ # set dpi
+
+ self._view_toolbar.set_view(self._view, self._model)
+ self._edit_toolbar.set_view(self._view)
+
self._edit_toolbar.set_document(self._document)
self._topbar.set_document(self._document)
@@ -823,27 +834,26 @@ class ReadActivity(activity.Activity):
self._update_nav_buttons()
self._update_toc()
- page_cache = self._document.get_page_cache()
- page_cache.connect('page-changed', self.__page_changed_cb)
+ self._model.connect('page-changed', self.__page_changed_cb)
if not self.metadata['title_set_by_user'] == '1':
- info = self._document.get_info()
- if info and info.title:
- self.metadata['title'] = info.title
+ title = self._document.get_title()
+ if title:
+ self.metadata['title'] = title
if not self._epub:
sizing_mode = self.metadata.get('Read_sizing_mode', 'fit-width')
_logger.debug('Found sizing mode: %s', sizing_mode)
if sizing_mode == "best-fit":
- self._view.props.sizing_mode = evince.SIZING_BEST_FIT
+ self._model.props.sizing_mode = evince.SIZING_BEST_FIT
if hasattr(self._view, 'update_view_size'):
self._view.update_view_size(self._scrolled)
elif sizing_mode == "free":
- self._view.props.sizing_mode = evince.SIZING_FREE
- self._view.props.zoom = float(self.metadata.get('Read_zoom', '1.0'))
- _logger.debug('Set zoom to %f', self._view.props.zoom)
+ self._model.props.sizing_mode = evince.SIZING_FREE
+ self._model.props.scale = float(self.metadata.get('Read_zoom', '1.0'))
+ _logger.debug('Set zoom to %f', self._model.props.scale)
elif sizing_mode == "fit-width":
- self._view.props.sizing_mode = evince.SIZING_FIT_WIDTH
+ self._model.props.sizing_mode = evince.SIZING_FIT_WIDTH
if hasattr(self._view, 'update_view_size'):
self._view.update_view_size(self._scrolled)
else:
@@ -851,7 +861,7 @@ class ReadActivity(activity.Activity):
# version of Read, for example.
_logger.warning("Unknown sizing_mode state '%s'", sizing_mode)
if self.metadata.get('Read_zoom', None) is not None:
- self._view.props.zoom = float(self.metadata['Read_zoom'])
+ self._model.props.scale = float(self.metadata['Read_zoom'])
self._view_toolbar._update_zoom_buttons()
@@ -860,7 +870,7 @@ class ReadActivity(activity.Activity):
current_page = int(self.metadata.get('Read_current_page', '0'))
_logger.debug('Setting page to: %d', current_page)
- self._document.get_page_cache().set_current_page(current_page)
+ self._model.props.page = current_page
# We've got the document, so if we're a shared activity, offer it
try:
@@ -932,8 +942,8 @@ class ReadActivity(activity.Activity):
self.watch_for_tubes()
self._share_document()
- def _view_notify_has_selection_cb(self, view, pspec):
- self._edit_toolbar.copy.set_sensitive(self._view.props.has_selection)
+ def _view_selection_changed_cb(self, view):
+ self._edit_toolbar.copy.props.sensitive = view.get_has_selection()
def _edit_toolbar_copy_cb(self, button):
self._view.copy()
diff --git a/readtoolbar.py b/readtoolbar.py
index acd459f..93612d2 100644
--- a/readtoolbar.py
+++ b/readtoolbar.py
@@ -15,6 +15,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
from gettext import gettext as _
+import logging
import gobject
import gtk
@@ -22,7 +23,7 @@ import evince
try:
import epubadapter
-except:
+except ImportError:
pass
from sugar.graphics.toolbutton import ToolButton
@@ -98,7 +99,7 @@ class EditToolbar(activity.EditToolbar):
try:
self._find_job = evince.JobFind(document=self._document, start_page=0, n_pages=self._document.get_n_pages(), text=text, case_sensitive=False)
self._find_updated_handler = self._find_job.connect('updated', self._find_updated_cb)
- evince.job_scheduler_push_job(self._find_job, evince.JOB_PRIORITY_NONE)
+ evince.Job.scheduler_push_job(self._find_job, evince.JOB_PRIORITY_NONE)
except TypeError:
self._find_job = epubadapter.JobFind(document=self._document, start_page=0, n_pages=self._document.get_n_pages(), text=text, case_sensitive=False)
self._find_updated_handler = self._find_job.connect('updated', self._find_updated_cb)
@@ -126,11 +127,16 @@ class EditToolbar(activity.EditToolbar):
self._search_find_next()
def _search_entry_changed_cb(self, entry):
+ logging.debug('Search entry: %s' % (entry.props.text))
self._search_entry_changed = True
self._update_find_buttons()
-# Automatically start search, maybe after timeout?
-# self._search_find_first()
+ # gobject.timeout_add(500, self._search_entry_timeout_cb)
+ #
+ #def _search_entry_timeout_cb(self):
+ # self._clear_find_job()
+ # self._search_find_first()
+ # return False
def _find_changed_cb(self, page, spec):
self._update_find_buttons()
@@ -171,8 +177,6 @@ class ViewToolbar(gtk.Toolbar):
__gtype_name__ = 'ViewToolbar'
__gsignals__ = {
- 'needs-update-size': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
- ([])),
'go-fullscreen': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])),
}
@@ -243,37 +247,48 @@ class ViewToolbar(gtk.Toolbar):
self._view_notify_zoom_handler = None
- def set_view(self, view):
+ def set_view(self, view, model):
+ # FIXME epubview needs fixing, until then toolbar is disabled
+ if model == None:
+ self._zoom_in.props.sensitive = False
+ self._zoom_out.props.sensitive = False
+ self._zoom_to_width.props.sensitive = False
+ self._zoom_spin.props.sensitive = False
+ return
+
+ self._evince_model = model
self._evince_view = view
- self._zoom_spin.props.value = self._evince_view.props.zoom * 100
- self._view_notify_zoom_handler = self._evince_view.connect(
- 'notify::zoom', self._view_notify_zoom_cb)
+
+ self._zoom_spin.props.value = self._evince_model.props.scale * 100
+ self._view_notify_zoom_handler = self._evince_model.connect(
+ 'notify::scale', self._view_notify_zoom_cb)
self._update_zoom_buttons()
def _zoom_spin_notify_value_cb(self, zoom_spin, pspec):
+ self._evince_model.props.sizing_mode = evince.SIZING_FREE
+
if not self._view_notify_zoom_handler:
return
- self._evince_view.disconnect(self._view_notify_zoom_handler)
+
+ self._evince_model.disconnect(self._view_notify_zoom_handler)
try:
- if hasattr(self._evince_view.props, 'sizing_mode'):
- self._evince_view.props.sizing_mode = evince.SIZING_FREE
- self._evince_view.props.zoom = zoom_spin.props.value / 100.0
+ self._evince_model.props.scale = zoom_spin.props.value / 100.0
finally:
- self._view_notify_zoom_handler = self._evince_view.connect(
- 'notify::zoom', self._view_notify_zoom_cb)
+ self._view_notify_zoom_handler = self._evince_model.connect(
+ 'notify::scale', self._view_notify_zoom_cb)
- def _view_notify_zoom_cb(self, evince_view, pspec):
+ def _view_notify_zoom_cb(self, evince_model, pspec):
self._zoom_spin.disconnect(self._zoom_spin_notify_value_handler)
try:
- self._zoom_spin.props.value = round(evince_view.props.zoom * 100.0)
+ self._zoom_spin.props.value = round(evince_model.props.scale *
+ 100.0)
finally:
self._zoom_spin_notify_value_handler = self._zoom_spin.connect(
'notify::value', self._zoom_spin_notify_value_cb)
def zoom_in(self):
- if hasattr(self._evince_view.props, 'sizing_mode'):
- self._evince_view.props.sizing_mode = evince.SIZING_FREE
+ self._evince_model.props.sizing_mode = evince.SIZING_FREE
self._evince_view.zoom_in()
self._update_zoom_buttons()
@@ -281,8 +296,7 @@ class ViewToolbar(gtk.Toolbar):
self.zoom_in()
def zoom_out(self):
- if hasattr(self._evince_view.props, 'sizing_mode'):
- self._evince_view.props.sizing_mode = evince.SIZING_FREE
+ self._evince_model.props.sizing_mode = evince.SIZING_FREE
self._evince_view.zoom_out()
self._update_zoom_buttons()
@@ -290,9 +304,7 @@ class ViewToolbar(gtk.Toolbar):
self.zoom_out()
def zoom_to_width(self):
- if hasattr(self._evince_view.props, 'sizing_mode'):
- self._evince_view.props.sizing_mode = evince.SIZING_FIT_WIDTH
- self.emit('needs-update-size')
+ self._evince_model.props.sizing_mode = evince.SIZING_FIT_WIDTH
self._update_zoom_buttons()
def _zoom_to_width_cb(self, button):
@@ -303,15 +315,12 @@ class ViewToolbar(gtk.Toolbar):
self._zoom_out.props.sensitive = self._evince_view.can_zoom_out()
def _zoom_to_fit_menu_item_activate_cb(self, menu_item):
- if hasattr(self._evince_view.props, 'sizing_mode'): #XXX
- self._evince_view.props.sizing_mode = evince.SIZING_BEST_FIT
- self.emit('needs-update-size')
+ self._evince_model.props.sizing_mode = evince.SIZING_BEST_FIT
self._update_zoom_buttons()
def _actual_size_menu_item_activate_cb(self, menu_item):
- if hasattr(self._evince_view.props, 'sizing_mode'):
- self._evince_view.props.sizing_mode = evince.SIZING_FREE
- self._evince_view.props.zoom = 1.0
+ self._evince_model.props.sizing_mode = evince.SIZING_FREE
+ self._evince_model.props.scale = 1.0
self._update_zoom_buttons()
def _fullscreen_cb(self, button):
diff --git a/readtopbar.py b/readtopbar.py
index 630601b..c6ce422 100644
--- a/readtopbar.py
+++ b/readtopbar.py
@@ -18,6 +18,9 @@
import gtk, gobject
import dbus
+import logging
+
+import evince
from sugar.graphics import style
from sugar.graphics.icon import Icon, get_icon_state
@@ -133,17 +136,22 @@ class _TopBar(gtk.HBox):
self._completion_level = 0
self._progressbar = None
- bus = dbus.Bus(dbus.Bus.TYPE_SYSTEM)
- proxy = bus.get_object('org.freedesktop.Hal',
- '/org/freedesktop/Hal/Manager')
- hal_manager = dbus.Interface(proxy, 'org.freedesktop.Hal.Manager')
- udis = hal_manager.FindDeviceByCapability('battery')
- if len(udis) > 0:
- self._battery = BattMan(udis[0]) # TODO: Support more than one battery
- self._battery.connect('notify::level', \
- self._battery_level_changed_cb)
- else:
+ try:
+ bus = dbus.Bus(dbus.Bus.TYPE_SYSTEM)
+ proxy = bus.get_object('org.freedesktop.Hal',
+ '/org/freedesktop/Hal/Manager')
+ hal_manager = dbus.Interface(proxy, 'org.freedesktop.Hal.Manager')
+ udis = hal_manager.FindDeviceByCapability('battery')
+ if len(udis) > 0:
+ self._battery = BattMan(udis[0]) # TODO: Support more than one battery
+ self._battery.connect('notify::level', \
+ self._battery_level_changed_cb)
+ else:
+ self._battery = None
+ except dbus.exceptions.DBusException:
self._battery = None
+ logging.warning('Hardware manager service not found, no idle \
+ suspend.')
self._icon = None
@@ -189,11 +197,12 @@ class TopBar(_TopBar):
def set_document(self, document):
self._document = document
- page_cache = self._document.get_page_cache()
- page_cache.connect('page-changed', self._page_changed_cb)
+ model = evince.DocumentModel()
+ model.props.document = self._document
+ model.connect('page-changed', self._page_changed_cb)
- def _page_changed_cb(self, page, proxy=None):
- current_page = self._document.get_page_cache().get_current_page()
+ def _page_changed_cb(self, model, page_from, page_to):
+ current_page = self._model.props.page
n_pages = self._document.get_n_pages()
self.set_completion_level(current_page * 100 / n_pages)
--
1.7.2.3
More information about the Sugar-devel
mailing list