[Sugar-devel] [PATCH Read 1/2] fix EOL spaces

Sascha Silbe sascha-pgp at silbe.org
Sun Dec 5 07:00:21 EST 2010


Signed-off-by: Sascha Silbe <sascha-pgp at silbe.org>

diff --git a/activity/activity-read.svg b/activity/activity-read.svg
index a49ef84..d0d1804 100644
--- a/activity/activity-read.svg
+++ b/activity/activity-read.svg
@@ -4,7 +4,7 @@
 ]><svg enable-background="new 0 0 55 55" height="55px" version="1.1" viewBox="0 0 55 55" width="55px" x="0px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px"><g display="block" id="activity-read">
 	<path d="M27.904,11.023h-0.002   c0-0.002-1.71-2.053-9.376-2.504C10.86,8.07,6.843,10.121,6.84,10.122c-1.898,0.619-3.495,1.735-3.495,3.494v27.702   c0,2.025,1.235,3.494,3.495,3.494c0.003,0,4.41-1.35,10.004-1.35c5.589-0.001,11.061,2.253,11.061,2.253" display="inline" fill="&fill_color;" stroke="&stroke_color;" stroke-linejoin="round" stroke-width="3.5"/>
 	<path d="M27.898,11.023   L27.898,11.023c0-0.002,1.715-2.053,9.377-2.504c7.668-0.449,11.686,1.602,11.688,1.603c1.897,0.619,3.494,1.735,3.494,3.494   v27.702c0,2.025-1.233,3.494-3.494,3.494c-0.003,0-4.409-1.35-10.004-1.35c-5.589-0.001-11.062,2.253-11.062,2.253" display="inline" fill="&fill_color;" stroke="&stroke_color;" stroke-linejoin="round" stroke-width="3.5"/>
-	
+
 		<line display="inline" fill="none" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5" x1="27.898" x2="27.9" y1="11.023" y2="45.717"/>
 	<path d="   M32.566,44.275c0,0-0.031,2.906-4.666,2.906c-4.632,0-4.663-2.906-4.663-2.906" display="inline" fill="none" stroke="&stroke_color;" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5"/>
 </g></svg>
diff --git a/epubadapter.py b/epubadapter.py
index a3cf280..c740451 100644
--- a/epubadapter.py
+++ b/epubadapter.py
@@ -24,7 +24,7 @@ class View(epubview.EpubView):
 
     def set_current_page(self, n):
         # When the book is being loaded, calling this does not help
-        # In such a situation, we go into a loop and try to load the 
+        # In such a situation, we go into a loop and try to load the
         # supplied page when the book has loaded completely
         n += 1
         if self._ready:
diff --git a/epubview/__init__.py b/epubview/__init__.py
index 81a3175..5051bdf 100644
--- a/epubview/__init__.py
+++ b/epubview/__init__.py
@@ -21,4 +21,4 @@ gobject.threads_init()
 
 from epub import _Epub as Epub
 from epubview import _View as EpubView
-from jobs import _JobFind as JobFind
\ No newline at end of file
+from jobs import _JobFind as JobFind
diff --git a/epubview/epub.py b/epubview/epub.py
index 71267aa..86f6ec9 100644
--- a/epubview/epub.py
+++ b/epubview/epub.py
@@ -32,22 +32,22 @@ class _Epub(object):
         self._ncxpath = None
         self._basepath = None
         self._tempdir = tempfile.mkdtemp()
-        
+
         if not self._verify():
             print 'Warning: This does not seem to be a valid epub file'
-        
+
         self._get_opf()
         self._get_ncx()
-        
+
         ncxfile = self._zobject.open(self._ncxpath)
-        opffile = self._zobject.open(self._opfpath)        
+        opffile = self._zobject.open(self._opfpath)
         self._navmap = navmap.NavMap(opffile, ncxfile, self._basepath)
-        
+
         opffile = self._zobject.open(self._opfpath)
-        self._info = epubinfo.EpubInfo(opffile) 
-        
+        self._info = epubinfo.EpubInfo(opffile)
+
         self._unzip()
-        
+
     def _unzip(self):
         #self._zobject.extractall(path = self._tempdir) # This is broken upto python 2.7
         orig_cwd = os.getcwd()
@@ -61,28 +61,28 @@ class _Epub(object):
                 self._zobject.extract(name)
         os.chdir(orig_cwd)
 
-                
+
     def _get_opf(self):
         containerfile = self._zobject.open('META-INF/container.xml')
-        
+
         tree = etree.parse(containerfile)
         root = tree.getroot()
-        
+
         for element in root.iterfind('.//{urn:oasis:names:tc:opendocument:xmlns:container}rootfile'):
             if element.get('media-type') == 'application/oebps-package+xml':
                 self._opfpath = element.get('full-path')
-        
-        if self._opfpath.rpartition('/')[0]:        
+
+        if self._opfpath.rpartition('/')[0]:
             self._basepath = self._opfpath.rpartition('/')[0] + '/'
         else:
             self._basepath = ''
-            
+
         containerfile.close()
 
 
     def _get_ncx(self):
         opffile = self._zobject.open(self._opfpath)
-        
+
         tree = etree.parse(opffile)
         root = tree.getroot()
 
@@ -92,61 +92,61 @@ class _Epub(object):
         for element in root.iterfind('.//{http://www.idpf.org/2007/opf}item'):
             if element.get('id') == tocid:
                 self._ncxpath = self._basepath + element.get('href')
-        
+
         opffile.close()
 
     def _verify(self):
         '''
-        Method to crudely check to verify that what we 
+        Method to crudely check to verify that what we
         are dealing with is a epub file or not
         '''
         if not os.path.exists(self._filepath):
             return False
-        
+
         self._zobject = zipfile.ZipFile(self._filepath)
-        
+
         if not 'mimetype' in self._zobject.namelist():
             return False
-        
+
         mtypefile = self._zobject.open('mimetype')
         mimetype = mtypefile.readline()
-        
+
         if not mimetype.startswith('application/epub+zip'): # Some files seem to have trailing characters
             return False
-        
+
         return True
-    
+
     def get_toc_model(self):
         '''
         Returns a GtkTreeModel representation of the
         Epub table of contents
-        '''        
+        '''
         return self._navmap.get_gtktreestore()
-    
+
     def get_flattoc(self):
         '''
         Returns a flat (linear) list of files to be
         rendered.
-        '''                
+        '''
         return self._navmap.get_flattoc()
-    
+
     def get_basedir(self):
         '''
         Returns the base directory where the contents of the
         epub has been unzipped
         '''
         return self._tempdir
-    
+
     def get_info(self):
         '''
         Returns a EpubInfo object for the open Epub file
-        '''        
+        '''
         return self._info
-    
+
     def close(self):
         '''
-        Cleans up (closes open zip files and deletes uncompressed content of Epub. 
-        Please call this when a file is being closed or during application exit. 
-        '''                
+        Cleans up (closes open zip files and deletes uncompressed content of Epub.
+        Please call this when a file is being closed or during application exit.
+        '''
         self._zobject.close()
         shutil.rmtree(self._tempdir)
diff --git a/epubview/epubinfo.py b/epubview/epubinfo.py
index d25dfc2..27cfe3e 100644
--- a/epubview/epubinfo.py
+++ b/epubview/epubinfo.py
@@ -7,7 +7,7 @@ class EpubInfo(): #TODO: Cover the entire DC range
         self._tree = etree.parse(opffile)
         self._root = self._tree.getroot()
         self._e_metadata = self._root.find('{http://www.idpf.org/2007/opf}metadata')
-        
+
         self.title = self._get_title()
         self.creator = self._get_creator()
         self.date = self._get_date()
@@ -16,34 +16,34 @@ class EpubInfo(): #TODO: Cover the entire DC range
         self.rights = self._get_rights()
         self.identifier = self._get_identifier()
         self.language = self._get_language()
-        
-    
+
+
     def _get_data(self, tagname):
         element = self._e_metadata.find(tagname)
         return element.text
-    
+
     def _get_title(self):
         try:
             ret = self._get_data('.//{http://purl.org/dc/elements/1.1/}title')
         except AttributeError:
             return None
-        
+
         return ret
-        
+
     def _get_creator(self):
         try:
             ret = self._get_data('.//{http://purl.org/dc/elements/1.1/}creator')
         except AttributeError:
-            return None        
+            return None
         return ret
-        
+
     def _get_date(self):
         #TODO: iter
         try:
             ret = self._get_data('.//{http://purl.org/dc/elements/1.1/}date')
         except AttributeError:
             return None
-        
+
         return ret
 
     def _get_source(self):
@@ -51,7 +51,7 @@ class EpubInfo(): #TODO: Cover the entire DC range
             ret = self._get_data('.//{http://purl.org/dc/elements/1.1/}source')
         except AttributeError:
             return None
-        
+
         return ret
 
     def _get_rights(self):
@@ -59,12 +59,12 @@ class EpubInfo(): #TODO: Cover the entire DC range
             ret = self._get_data('.//{http://purl.org/dc/elements/1.1/}rights')
         except AttributeError:
             return None
-        
+
         return ret
 
     def _get_identifier(self):
         #TODO: iter
-        element = self._e_metadata.find('.//{http://purl.org/dc/elements/1.1/}identifier')            
+        element = self._e_metadata.find('.//{http://purl.org/dc/elements/1.1/}identifier')
 
         if element is not None:
             return {'id':element.get('id'), 'value':element.text}
@@ -76,7 +76,7 @@ class EpubInfo(): #TODO: Cover the entire DC range
             ret = self._get_data('.//{http://purl.org/dc/elements/1.1/}language')
         except AttributeError:
             return None
-        
+
         return ret
 
     def _get_subject(self):
@@ -86,5 +86,5 @@ class EpubInfo(): #TODO: Cover the entire DC range
                 subjectlist.append(element.text)
         except AttributeError:
             return None
-        
-        return subjectlist
\ No newline at end of file
+
+        return subjectlist
diff --git a/epubview/epubview.py b/epubview/epubview.py
index 595eb20..e9cc276 100644
--- a/epubview/epubview.py
+++ b/epubview/epubview.py
@@ -37,20 +37,20 @@ class _View(gtk.HBox):
     __gproperties__ = {
         'has-selection' : (gobject.TYPE_BOOLEAN, 'whether has selection',
                   'whether the widget has selection or not',
-                  0, gobject.PARAM_READABLE), 
+                  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)
-    }    
+    }
     __gsignals__ = {
         'page-changed': (gobject.SIGNAL_RUN_FIRST,
                           gobject.TYPE_NONE,
                           ([]))
-    }    
+    }
     def __init__(self):
         gobject.threads_init()
         gtk.HBox.__init__(self)
-        
+
         self.connect("destroy", self._destroy_cb)
 
         self._ready = False
@@ -68,7 +68,7 @@ class _View(gtk.HBox):
         self._findjob = None
         self.__in_search = False
         self.__search_fwd = True
-        
+
         self._sw = gtk.ScrolledWindow()
         self._view = widgets._WebView()
         self._view.load_string(LOADING_HTML, 'text/html', 'utf-8', '/')
@@ -82,7 +82,7 @@ class _View(gtk.HBox):
         self._view.connect('button-release-event', self._view_buttonrelease_event_cb)
         self._view.connect('selection-changed', self._view_selection_changed_cb)
         self._view.connect_after('populate-popup', self._view_populate_popup_cb)
-        
+
         self._sw.add(self._view)
         self._sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_NEVER)
         self._v_vscrollbar = self._sw.get_vscrollbar()
@@ -94,13 +94,13 @@ class _View(gtk.HBox):
                                                                       self._scrollbar_change_value_cb)
         self.pack_start(self._sw, expand = True, fill = True)
         self.pack_start(self._scrollbar, expand = False, fill = False)
-        
-        self._view.set_flags(gtk.CAN_DEFAULT|gtk.CAN_FOCUS)        
-        
+
+        self._view.set_flags(gtk.CAN_DEFAULT|gtk.CAN_FOCUS)
+
     def set_document(self, epubdocumentinstance):
         '''
         Sets document (should be a Epub instance)
-        '''        
+        '''
         self._epub = epubdocumentinstance
         gobject.idle_add(self._paginate)
 
@@ -117,29 +117,29 @@ class _View(gtk.HBox):
             self.__set_zoom(value)
         else:
             raise AttributeError, 'unknown property %s' % property.name
-    
+
     def get_has_selection(self):
         '''
         Returns True if any part of the content is selected
-        '''        
+        '''
         return self.get_property('has-selection')
-    
+
     def get_zoom(self):
         '''
         Returns the current zoom level
-        '''        
+        '''
         return self.get_property('zoom')
-    
+
     def set_zoom(self, value):
         '''
         Sets the current zoom level
-        '''        
+        '''
         self.set_property('zoom', value)
-    
+
     def zoom_in(self):
         '''
         Zooms in (increases zoom level by 0.1)
-        '''        
+        '''
         if self.can_zoom_in():
             self.set_zoom(self.get_zoom() + 0.1)
             return True
@@ -149,17 +149,17 @@ class _View(gtk.HBox):
     def zoom_out(self):
         '''
         Zooms out (decreases zoom level by 0.1)
-        '''        
+        '''
         if self.can_zoom_out():
             self.set_zoom(self.get_zoom() - 0.1)
             return True
         else:
             return False
-    
+
     def can_zoom_in(self):
         '''
         Returns True if it is possible to zoom in further
-        '''        
+        '''
         if self.zoom < 4:
             return True
         else:
@@ -168,58 +168,58 @@ class _View(gtk.HBox):
     def can_zoom_out(self):
         '''
         Returns True if it is possible to zoom out further
-        '''        
+        '''
         if self.zoom > 0.5:
             return True
         else:
             return False
-    
+
     def get_current_page(self):
         '''
         Returns the currently loaded page
-        '''        
+        '''
         return self._loaded_page
-    
+
     def get_current_file(self):
         '''
         Returns the currently loaded XML file
-        '''        
+        '''
         #return self._loaded_filename
-        if self._paginator: 
+        if self._paginator:
             return self._paginator.get_file_for_pageno(self._loaded_page)
         else:
             return None
-    
+
     def get_pagecount(self):
         '''
         Returns the pagecount of the loaded file
-        '''        
+        '''
         return self._pagecount
-    
+
     def set_current_page(self, n):
         '''
         Loads page number n
-        '''        
+        '''
         if n < 1 or n > self._pagecount:
             return False
         self._load_page(n)
         return True
-        
+
     def next_page(self):
         '''
         Loads next page if possible
         Returns True if transition to next page is possible and done
-        '''        
+        '''
         if self._loaded_page == self._pagecount:
             return False
         self._load_next_page()
         return True
-        
+
     def previous_page(self):
         '''
         Loads previous page if possible
         Returns True if transition to previous page is possible and done
-        '''        
+        '''
         if self._loaded_page == 1:
             return False
         self._load_prev_page()
@@ -229,8 +229,8 @@ class _View(gtk.HBox):
         '''
         Scrolls through the pages.
         Scrolling is horizontal if horizontal is set to True
-        Valid scrolltypes are: gtk.SCROLL_PAGE_BACKWARD and gtk.SCROLL_PAGE_FORWARD 
-        '''        
+        Valid scrolltypes are: gtk.SCROLL_PAGE_BACKWARD and gtk.SCROLL_PAGE_FORWARD
+        '''
         if scrolltype == gtk.SCROLL_PAGE_BACKWARD:
             self.__going_back = True
             self.__going_fwd = False
@@ -243,17 +243,17 @@ class _View(gtk.HBox):
                 self._view.move_cursor(gtk.MOVEMENT_PAGES, 1)
         else:
             print ('Got unsupported scrolltype %s' % str(scrolltype))
-    
+
     def copy(self):
         '''
         Copies the current selection to clipboard.
-        '''                
+        '''
         self._view.copy_clipboard()
-    
+
     def find_next(self):
         '''
         Highlights the next matching item for current search
-        '''        
+        '''
         self._view.grab_focus()
         self._view.grab_default()
 
@@ -265,11 +265,11 @@ class _View(gtk.HBox):
             self.__in_search = True
             self.__search_fwd = True
             self._load_file(path)
-    
+
     def find_previous(self):
         '''
         Highlights the previous matching item for current search
-        '''        
+        '''
         self._view.grab_focus()
         self._view.grab_default()
 
@@ -289,39 +289,39 @@ class _View(gtk.HBox):
         #self._view.search_text(self._findjob.get_search_text(), \
         #                       self._findjob.get_case_sensitive(), True, False)
         self.find_next()
-        
+
     def __set_zoom(self, value):
         self._view.set_zoom_level(value)
         self.zoom = value
-    
+
     def __set_has_selection(self, value):
         if value != self.has_selection:
             self.has_selection = value
             self.notify('has-selection')
-    
+
     def _view_populate_popup_cb(self, view, menu):
         menu.destroy() #HACK
         return
-    
+
     def _view_selection_changed_cb(self, view):
-        # FIXME: This does not seem to be implemented in 
+        # FIXME: This does not seem to be implemented in
         # webkitgtk yet
         print view.has_selection()
-    
+
     def _view_buttonrelease_event_cb(self, view, event):
         # Ugly hack
         self.__set_has_selection(view.can_copy_clipboard() \
                                  | view.can_cut_clipboard())
-    
+
     def _view_keypress_event_cb(self, view, event):
         name = gtk.gdk.keyval_name(event.keyval)
-        if name == 'Page_Down' or name == 'Down': 
+        if name == 'Page_Down' or name == 'Down':
             self.__going_back = False
             self.__going_fwd = True
         elif name == 'Page_Up' or name == 'Up':
             self.__going_back = True
             self.__going_fwd = False
-            
+
         self._do_page_transition()
 
     def _view_scroll_event_cb(self, view, event):
@@ -332,8 +332,8 @@ class _View(gtk.HBox):
             self.__going_back = True
             self.__going_fwd = False
 
-        self._do_page_transition() 
-    
+        self._do_page_transition()
+
     def _do_page_transition(self):
         if self.__going_fwd:
             if self._v_vscrollbar.get_value() >= \
@@ -345,32 +345,32 @@ class _View(gtk.HBox):
             if self._v_vscrollbar.get_value() == self._v_vscrollbar.props.adjustment.props.lower:
                 self._load_prev_file()
                 return True
-        
+
         return False
-        
+
     def _view_load_finished_cb(self, v, frame):
-    	
-        # Normally the line below would not be required - ugly workaround for 
+
+        # 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)
-        
+
         filename = self._view.props.uri.replace('file://', '')
         if os.path.exists(filename.replace('xhtml', 'xml')):
             filename = filename.replace('xhtml', 'xml') # Hack for making javascript work
-        
+
         filename = filename.split('#')[0] # Get rid of anchors
-        
+
         if self._loaded_page < 1 or filename == None:
             return False
-        
+
         self._loaded_filename = filename
-        
+
         remfactor = self._paginator.get_remfactor_for_file(filename)
         pages = self._paginator.get_pagecount_for_file(filename)
         extra = int(math.ceil(remfactor * self._view.get_page_height()/(pages-remfactor)))
         if extra > 0:
             self._view.add_bottom_padding(extra)
-        
+
         if self.__in_search:
             self._view.search_text(self._findjob.get_search_text(), \
                                self._findjob.get_case_sensitive(), \
@@ -382,7 +382,7 @@ class _View(gtk.HBox):
                 self._scroll_page_end()
             else:
                 self._scroll_page()
-                
+
         base_pageno = self._paginator.get_base_pageno_for_file(filename)
         scrollval = self._v_vscrollbar.get_value()
         scroll_upper = self._v_vscrollbar.props.adjustment.props.upper
@@ -392,39 +392,39 @@ class _View(gtk.HBox):
         else:
             offset = (scrollval/scroll_upper) * self._paginator.get_pagecount_for_file(filename)
             pageno = math.floor(base_pageno + offset)
-        
+
         if pageno != self._loaded_page:
             self._on_page_changed(int(pageno))
-            
+
 
     def _scroll_page_end(self):
         v_upper = self._v_vscrollbar.props.adjustment.props.upper
         v_page_size = self._v_vscrollbar.props.adjustment.props.page_size
         self._v_vscrollbar.set_value(v_upper)
-        
+
     def _scroll_page(self):
         pageno = self._loaded_page
-        
+
         v_upper = self._v_vscrollbar.props.adjustment.props.upper
         v_page_size = self._v_vscrollbar.props.adjustment.props.page_size
-        
+
         scrollfactor = self._paginator.get_scrollfactor_pos_for_pageno(pageno)
         self._v_vscrollbar.set_value((v_upper - v_page_size) * scrollfactor)
-        
+
     def _paginate(self):
         filelist = []
         for i in self._epub._navmap.get_flattoc():
             filelist.append(os.path.join(self._epub._tempdir, i))
-            
+
         self._paginator = _Paginator(filelist)
         self._paginator.connect('paginated', self._paginated_cb)
-    
+
     def _load_next_page(self):
         self._load_page(self._loaded_page + 1)
 
     def _load_prev_page(self):
         self._load_page(self._loaded_page - 1)
-    
+
     def _v_scrollbar_value_changed_cb(self, scrollbar):
         if self._loaded_page < 1:
             return
@@ -457,7 +457,7 @@ class _View(gtk.HBox):
 
             if scrollfactor <= scrollfactor_cur:
                 self._on_page_changed(self._loaded_page - 1)
-        
+
     def _on_page_changed(self, pageno):
         self.__page_changed = True
         self._loaded_page = pageno
@@ -465,7 +465,7 @@ class _View(gtk.HBox):
         self._scrollbar.set_value(pageno)
         self._scrollbar.handler_unblock(self._scrollbar_change_value_cb_id)
         self.emit('page-changed')
-        
+
     def _load_page(self, pageno):
         if pageno > self._pagecount or pageno < 1:
             #TODO: Cause an exception
@@ -483,7 +483,7 @@ class _View(gtk.HBox):
                 self._view.open(filename)
         else:
             self._scroll_page()
-    
+
     def _load_next_file(self):
         if self._loaded_page == self._pagecount:
             return
@@ -493,7 +493,7 @@ class _View(gtk.HBox):
             pageno += 1
             if self._paginator.get_file_for_pageno(pageno) != cur_file:
                 break
-        
+
         self._load_page(pageno)
 
     def _load_file(self, path):
@@ -513,7 +513,7 @@ class _View(gtk.HBox):
             pageno -= 1
             if self._paginator.get_file_for_pageno(pageno) != cur_file:
                 break
-            
+
         self._load_page(pageno)
 
     def _scrollbar_change_value_cb(self, range, scrolltype, value):
@@ -526,7 +526,7 @@ class _View(gtk.HBox):
             self.__going_fwd = False
             self.__going_back = True
             if not self._do_page_transition():
-                self._view.move_cursor(gtk.MOVEMENT_DISPLAY_LINES, -1)                
+                self._view.move_cursor(gtk.MOVEMENT_DISPLAY_LINES, -1)
         elif scrolltype == gtk.SCROLL_JUMP or \
             scrolltype == gtk.SCROLL_PAGE_FORWARD or \
                 scrolltype == gtk.SCROLL_PAGE_BACKWARD:
@@ -536,18 +536,18 @@ class _View(gtk.HBox):
                 self._load_page(round(value))
         else:
             print 'Warning: unknown scrolltype %s with value %f' % (str(scrolltype), value)
-        
+
         self._scrollbar.set_value(self._loaded_page) #FIXME: This should not be needed here
-        
+
         if self.__page_changed == True:
             self.__page_changed = False
             return False
         else:
             return True
-        
+
     def _paginated_cb(self, object):
         self._ready = True
-        
+
         self._pagecount = self._paginator.get_total_pagecount()
         self._scrollbar.set_range(1.0, self._pagecount - 1.0)
         self._scrollbar.set_increments(1.0, 1.0)
@@ -555,8 +555,8 @@ class _View(gtk.HBox):
         self._view.grab_default()
         if self._loaded_page < 1:
             self._load_page(1)
-        
-        
+
+
 
     def _destroy_cb(self, widget):
         self._epub.close()
diff --git a/epubview/jobs.py b/epubview/jobs.py
index 19c8434..6fe5b25 100644
--- a/epubview/jobs.py
+++ b/epubview/jobs.py
@@ -57,28 +57,28 @@ class SearchThread(threading.Thread):
             if self._searchfile(f):
                 self.obj._matchfilelist.append(entry)
             f.close()
-        
+
         gtk.gdk.threads_enter()
-        self.obj._finished = True 
+        self.obj._finished = True
         self.obj.emit('updated')
         gtk.gdk.threads_leave()
-        
+
         return False
-    
+
     def _searchfile(self, fileobj):
         soup = BeautifulSoup.BeautifulSoup(fileobj)
         body = soup.find('body')
         tags = body.findChildren(True)
         for tag in tags:
-            if not tag.string is None: 
+            if not tag.string is None:
                 if tag.string.find(self.obj._text) > -1:
                     return True
-    
+
         return False
 
     def run (self):
         self._start_search()
-      
+
     def stop(self):
         self.stopthread.set()
 
@@ -89,18 +89,18 @@ class _JobPaginator(gobject.GObject):
         'paginated': (gobject.SIGNAL_RUN_FIRST,
                           gobject.TYPE_NONE,
                           ([]))
-    }   
+    }
     def __init__(self, filelist):
         gobject.GObject.__init__(self)
-        
+
         self._filelist = filelist
         self._filedict = {}
         self._pagemap = {}
-        
+
         self._bookheight = 0
         self._count = 0
         self._pagecount = 0
-        
+
         self._screen = gtk.gdk.screen_get_default()
         self._old_fontoptions = self._screen.get_font_options()
         options = cairo.FontOptions()
@@ -109,7 +109,7 @@ class _JobPaginator(gobject.GObject):
         options.set_subpixel_order(cairo.SUBPIXEL_ORDER_DEFAULT)
         options.set_hint_metrics(cairo.HINT_METRICS_DEFAULT)
         self._screen.set_font_options(options)
-        
+
         self._temp_win = gtk.Window()
         self._temp_view = widgets._WebView()
 
@@ -124,7 +124,7 @@ class _JobPaginator(gobject.GObject):
         settings.props.default_font_size = 12
         settings.props.default_monospace_font_size = 10
         settings.props.default_encoding = 'utf-8'
-        
+
         sw = gtk.ScrolledWindow()
         sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER)
         self._dpi = 96
@@ -132,16 +132,16 @@ class _JobPaginator(gobject.GObject):
         sw.add(self._temp_view)
         self._temp_win.add(sw)
         self._temp_view.connect('load-finished', self._page_load_finished_cb)
-           
+
         self._temp_win.show_all()
         self._temp_win.unmap()
-        
+
         self._temp_view.open(self._filelist[self._count])
-       
+
     def _page_load_finished_cb(self, v, frame):
         f = v.get_main_frame()
         pageheight = v.get_page_height()
-                
+
         if pageheight <= _mm_to_pixel(PAGE_HEIGHT, self._dpi):
             pages = 1
         else:
@@ -152,11 +152,11 @@ class _JobPaginator(gobject.GObject):
             else:
                 pagelen = 1/pages
             self._pagemap[float(self._pagecount + i)] = (f.props.uri, (i-1)/math.ceil(pages), pagelen)
-        
+
         self._pagecount += math.ceil(pages)
         self._filedict[f.props.uri.replace('file://', '')] = (math.ceil(pages), math.ceil(pages) - pages)
         self._bookheight += pageheight
-        
+
         if self._count+1 >= len(self._filelist):
             self._temp_win.destroy()
             self._screen.set_font_options(self._old_fontoptions)
@@ -164,48 +164,48 @@ class _JobPaginator(gobject.GObject):
         else:
             self._count += 1
             self._temp_view.open(self._filelist[self._count])
-            
-            
+
+
     def get_file_for_pageno(self, pageno):
         '''
         Returns the file in which pageno occurs
-        '''        
+        '''
         return self._pagemap[pageno][0]
-    
+
     def get_scrollfactor_pos_for_pageno(self, pageno):
         '''
         Returns the position scrollfactor (fraction) for pageno
-        '''        
+        '''
         return self._pagemap[pageno][1]
 
     def get_scrollfactor_len_for_pageno(self, pageno):
         '''
         Returns the length scrollfactor (fraction) for pageno
-        '''        
+        '''
         return self._pagemap[pageno][2]
-    
+
     def get_pagecount_for_file(self, filename):
         '''
         Returns the number of pages in file
-        '''        
+        '''
         return self._filedict[filename][0]
 
     def get_base_pageno_for_file(self, filename):
         '''
         Returns the pageno which begins in filename
-        '''                
+        '''
         for key in self._pagemap.keys():
             if  self._pagemap[key][0].replace('file://', '') == filename:
                 return key
-            
+
         return None
 
     def get_remfactor_for_file(self, filename):
         '''
         Returns the remainder factor (1 - fraction length of last page in file)
-        '''        
+        '''
         return self._filedict[filename][1]
-    
+
     def get_total_pagecount(self):
         '''
         Returns the total pagecount for the Epub file
@@ -215,7 +215,7 @@ class _JobPaginator(gobject.GObject):
     def get_total_height(self):
         '''
         Returns the total height of the Epub in pixels
-        '''        
+        '''
         return self._bookheight
 
 
@@ -228,7 +228,7 @@ class _JobFind(gobject.GObject):
     def __init__(self, document, start_page, n_pages, text, case_sensitive=False):
         gobject.GObject.__init__(self)
         gtk.gdk.threads_init()
-        
+
         self._finished = False
         self._document = document
         self._start_page = start_page
@@ -239,58 +239,58 @@ class _JobFind(gobject.GObject):
         self._matchfilelist = []
         self._current_file_index = 0
         self.threads = []
-        
+
         s_thread = SearchThread(self)
         self.threads.append(s_thread)
         s_thread.start()
-        
+
     def cancel(self):
         '''
         Cancels the search job
-        '''                
+        '''
         for s_thread in self.threads:
             s_thread.stop()
-    
+
     def is_finished(self):
         '''
         Returns True if the entire search job has been finished
-        '''                
+        '''
         return self._finished
-    
+
     def get_next_file(self):
         '''
         Returns the next file which has the search pattern
-        '''                
+        '''
         self._current_file_index += 1
         try:
             path = self._matchfilelist[self._current_file_index]
         except IndexError:
             self._current_file_index = 0
             path = self._matchfilelist[self._current_file_index]
-   
+
         return path
 
     def get_prev_file(self):
         '''
         Returns the previous file which has the search pattern
-        '''        
+        '''
         self._current_file_index -= 1
         try:
             path = self._matchfilelist[self._current_file_index]
         except IndexError:
             self._current_file_index = -1
             path = self._matchfilelist[self._current_file_index]
-   
+
         return path
 
     def get_search_text(self):
         '''
         Returns the search text
-        '''        
+        '''
         return self._text
-    
+
     def get_case_sensitive(self):
         '''
         Returns True if the search is case-sensitive
-        '''        
+        '''
         return self._case_sensitive
diff --git a/epubview/navmap.py b/epubview/navmap.py
index a0a1799..314752a 100644
--- a/epubview/navmap.py
+++ b/epubview/navmap.py
@@ -5,14 +5,14 @@ class NavPoint(object):
     def __init__(self, label, contentsrc, children = []):
         self._label = label
         self._contentsrc = contentsrc
-        self._children = children 
-        
+        self._children = children
+
     def get_label(self):
         return self._label
-    
+
     def get_contentsrc(self):
         return self._contentsrc
-    
+
     def get_children(self):
         return self._children
 
@@ -25,32 +25,32 @@ class NavMap(object):
         self._root = self._tree.getroot()
         self._gtktreestore = gtk.TreeStore(str, str)
         self._flattoc = []
-        
+
         self._populate_flattoc()
         self._populate_toc()
-         
+
     def _populate_flattoc(self):
         tree = etree.parse(self._opffile)
         root = tree.getroot()
-        
+
         itemmap = {}
         manifest = root.find('.//{http://www.idpf.org/2007/opf}manifest')
         for element in manifest.iterfind('{http://www.idpf.org/2007/opf}item'):
             itemmap[element.get('id')] = element
-        
-        spine = root.find('.//{http://www.idpf.org/2007/opf}spine')        
+
+        spine = root.find('.//{http://www.idpf.org/2007/opf}spine')
         for element in spine.iterfind('{http://www.idpf.org/2007/opf}itemref'):
             idref = element.get('idref')
             href = itemmap[idref].get('href')
             self._flattoc.append(self._basepath + href)
-            
+
         self._opffile.close()
-        
+
     def _populate_toc(self):
-        navmap = self._root.find('{http://www.daisy.org/z3986/2005/ncx/}navMap')       
+        navmap = self._root.find('{http://www.daisy.org/z3986/2005/ncx/}navMap')
         for navpoint in navmap.iterfind('./{http://www.daisy.org/z3986/2005/ncx/}navPoint'):
             self._process_navpoint(navpoint)
-            
+
     def _gettitle(self, navpoint):
         text = navpoint.find('./{http://www.daisy.org/z3986/2005/ncx/}navLabel/{http://www.daisy.org/z3986/2005/ncx/}text')
         return text.text
@@ -62,32 +62,32 @@ class NavMap(object):
     def _process_navpoint(self, navpoint, parent = None):
         title = self._gettitle(navpoint)
         content = self._getcontent(navpoint)
-        
+
         #print title, content
-        
+
         iter = self._gtktreestore.append(parent, [title, content])
         #self._flattoc.append((title, content))
-        
+
         childnavpointlist = list(navpoint.iterfind('./{http://www.daisy.org/z3986/2005/ncx/}navPoint'))
-        
+
         if len(childnavpointlist):
             for childnavpoint in childnavpointlist:
-                self._process_navpoint(childnavpoint, parent = iter)   
-        else: 
+                self._process_navpoint(childnavpoint, parent = iter)
+        else:
             return
-             
+
     def get_gtktreestore(self):
         '''
         Returns a GtkTreeModel representation of the
         Epub table of contents
-        '''        
+        '''
         return self._gtktreestore
-    
+
     def get_flattoc(self):
         '''
         Returns a flat (linear) list of files to be
         rendered.
-        '''       
+        '''
         return self._flattoc
-    
-#t = TocParser('/home/sayamindu/Desktop/Test/OPS/fb.ncx')
\ No newline at end of file
+
+#t = TocParser('/home/sayamindu/Desktop/Test/OPS/fb.ncx')
diff --git a/epubview/widgets.py b/epubview/widgets.py
index d80c45a..0458573 100644
--- a/epubview/widgets.py
+++ b/epubview/widgets.py
@@ -5,12 +5,12 @@ import gtk
 class _WebView(webkit.WebView):
     def __init__(self):
         webkit.WebView.__init__(self)
-        
+
     def get_page_height(self):
         '''
         Gets height (in pixels) of loaded (X)HTML page.
         This is done via javascript at the moment
-        '''        
+        '''
         #TODO: Need to check status of page load
         js = 'oldtitle=document.title;document.title=Math.max(document.body.scrollHeight, document.body.offsetHeight,document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight);'
         self.execute_script(js)
@@ -20,12 +20,12 @@ class _WebView(webkit.WebView):
         if ret is None:
             return 0
         return int(ret)
-        
+
     def add_bottom_padding(self, incr):
         '''
         Adds incr pixels of padding to the end of the loaded (X)HTML page.
         This is done via javascript at the moment
-        '''        
+        '''
         js = ('var newdiv = document.createElement("div");newdiv.style.height = "%dpx";document.body.appendChild(newdiv);' % incr)
         self.execute_script(js)
-        
+
diff --git a/readactivity.py b/readactivity.py
index f3052c6..d855d2a 100644
--- a/readactivity.py
+++ b/readactivity.py
@@ -72,7 +72,7 @@ def _get_screen_dpi():
     return float(xft_dpi / 1024)
 
 def get_md5(filename): #FIXME: Should be moved somewhere else
-    filename = filename.replace('file://', '') #XXX: hack 
+    filename = filename.replace('file://', '') #XXX: hack
     fh = open(filename)
     digest = md5.new()
     while 1:
@@ -133,7 +133,7 @@ class ReadActivity(activity.Activity):
         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
@@ -144,9 +144,9 @@ class ReadActivity(activity.Activity):
         self.connect('window-state-event', self._window_state_event_cb)
 
         _logger.debug('Starting Read...')
-        
+
         self._view = None
-        
+
         self._sidebar = Sidebar()
         self._sidebar.show()
 
@@ -229,7 +229,7 @@ class ReadActivity(activity.Activity):
         spacer.show()
 
         bookmark_item = gtk.ToolItem()
-        self._bookmarker = self._create_bookmarker()        
+        self._bookmarker = self._create_bookmarker()
         self._bookmarker_toggle_handler_id = self._bookmarker.connect( \
                 'toggled', self.__bookmarker_toggled_cb)
         bookmark_item.add(self._bookmarker)
@@ -331,10 +331,10 @@ class ReadActivity(activity.Activity):
         back.props.sensitive = False
         palette = back.get_palette()
         previous_page = MenuItem(text_label= _("Previous page"))
-        palette.menu.append(previous_page) 
-        previous_page.show_all()        
+        palette.menu.append(previous_page)
+        previous_page.show_all()
         previous_bookmark = MenuItem(text_label= _("Previous bookmark"))
-        palette.menu.append(previous_bookmark) 
+        palette.menu.append(previous_bookmark)
         previous_bookmark.show_all()
         back.connect('clicked', self.__go_back_cb)
         previous_page.connect('activate', self.__go_back_page_cb)
@@ -347,10 +347,10 @@ class ReadActivity(activity.Activity):
         forward.props.sensitive = False
         palette = forward.get_palette()
         next_page = MenuItem(text_label= _("Next page"))
-        palette.menu.append(next_page) 
-        next_page.show_all()        
+        palette.menu.append(next_page)
+        next_page.show_all()
         next_bookmark = MenuItem(text_label= _("Next bookmark"))
-        palette.menu.append(next_bookmark) 
+        palette.menu.append(next_bookmark)
         next_bookmark.show_all()
         forward.connect('clicked', self.__go_forward_cb)
         next_page.connect('activate', self.__go_forward_page_cb)
@@ -373,13 +373,13 @@ class ReadActivity(activity.Activity):
 
         label_attributes = pango.AttrList()
         label_attributes.insert(pango.AttrSize(14000, 0, -1))
-        label_attributes.insert(pango.AttrForeground(65535, 65535, 
+        label_attributes.insert(pango.AttrForeground(65535, 65535,
                                                      65535, 0, -1))
         total_page_label.set_attributes(label_attributes)
 
         total_page_label.set_text(' / 0')
         return total_page_label
-    
+
     def _create_navigator(self):
         navigator = gtk.ComboBox()
         navigator.set_add_tearoffs(True)
@@ -392,7 +392,7 @@ class ReadActivity(activity.Activity):
     def _create_bookmarker(self):
         bookmarker = ToggleToolButton('emblem-favorite')
         return bookmarker
-    
+
     def __num_page_entry_insert_text_cb(self, entry, text, length, position):
         if not re.match('[0-9]', text):
             entry.emit_stop_by_name('insert-text')
@@ -412,7 +412,7 @@ class ReadActivity(activity.Activity):
 
         self._document.get_page_cache().set_current_page(page)
         entry.props.text = str(page + 1)
-    
+
     def __go_back_cb(self, button):
         self._view.scroll(gtk.SCROLL_PAGE_BACKWARD, False)
 
@@ -421,14 +421,14 @@ class ReadActivity(activity.Activity):
 
     def __go_back_page_cb(self, button):
         self._view.previous_page()
-    
+
     def __go_forward_page_cb(self, button):
         self._view.next_page()
 
     def __prev_bookmark_activate_cb(self, menuitem):
         page = self._document.get_page_cache().get_current_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)
@@ -436,7 +436,7 @@ class ReadActivity(activity.Activity):
     def __next_bookmark_activate_cb(self, menuitem):
         page = self._document.get_page_cache().get_current_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)
@@ -446,26 +446,26 @@ class ReadActivity(activity.Activity):
         if self._bookmarker.props.active:
             self._sidebar.add_bookmark(page)
         else:
-            self._sidebar.del_bookmark(page)    
+            self._sidebar.del_bookmark(page)
 
     def __page_changed_cb(self, page, proxy = None):
         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._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()
         self._back_button.props.sensitive = current_page > 0
         self._forward_button.props.sensitive = \
             current_page < self._document.get_n_pages() - 1
-        
+
         self._num_page_entry.props.text = str(current_page + 1)
         self._total_page_label.props.label = \
             ' / ' + str(self._document.get_n_pages())
@@ -510,7 +510,7 @@ class ReadActivity(activity.Activity):
 
     def _toc_select_active_page(self):
         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()
 
@@ -534,14 +534,14 @@ class ReadActivity(activity.Activity):
         """
         if not self._want_document:
             return
-        chooser = ObjectChooser(_('Choose document'), self, 
-                                gtk.DIALOG_MODAL | 
+        chooser = ObjectChooser(_('Choose document'), self,
+                                gtk.DIALOG_MODAL |
                                 gtk.DIALOG_DESTROY_WITH_PARENT,
                                 what_filter=mime.GENERIC_TYPE_TEXT)
         try:
             result = chooser.run()
             if result == gtk.RESPONSE_ACCEPT:
-                logging.debug('ObjectChooser: %r' % 
+                logging.debug('ObjectChooser: %r' %
                               chooser.get_selected_object())
                 jobject = chooser.get_selected_object()
                 if jobject and jobject.file_path:
@@ -600,13 +600,13 @@ class ReadActivity(activity.Activity):
 
     def write_file(self, file_path):
         """Write into datastore for Keep.
-        
+
         The document is saved by hardlinking from the temporary file we
         keep around instead of "saving".
 
         The metadata is updated, including current page, view settings,
         search text.
-        
+
         """
         if self._tempfile is None:
             # Workaround for closing Read with no document loaded
@@ -650,7 +650,7 @@ class ReadActivity(activity.Activity):
 
     def can_close(self):
         """Prepare to cleanup on closing.
-        
+
         Called from self.close()
         """
         self._close_requested = True
@@ -681,7 +681,7 @@ class ReadActivity(activity.Activity):
         # FIXME: Draw a progress bar
         if self._download_content_length > 0:
             _logger.debug("Downloaded %u of %u bytes from tube %u...",
-                          bytes_downloaded, self._download_content_length, 
+                          bytes_downloaded, self._download_content_length,
                           tube_id)
         else:
             _logger.debug("Downloaded %u bytes from tube %u...",
@@ -786,7 +786,7 @@ class ReadActivity(activity.Activity):
         """Load the specified document and set up the UI.
 
         filepath -- string starting with file://
-        
+
         """
         mimetype = mime.get_for_file(filepath)
         if mimetype == 'application/epub+zip':
@@ -816,7 +816,7 @@ 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)
 
diff --git a/readbookmark.py b/readbookmark.py
index 5ac9b24..27b1319 100644
--- a/readbookmark.py
+++ b/readbookmark.py
@@ -26,10 +26,10 @@ class Bookmark:
         self.nick = data[4]
         self.color = data[5]
         self.local = data[6]
-        
+
     def belongstopage(self, page_no):
-        return self.page_no == page_no 
-    
+        return self.page_no == page_no
+
     def is_local(self):
         return bool(self.local)
 
@@ -43,8 +43,8 @@ class Bookmark:
     def get_note_body(self):
         if self.content == '' or self.content is None:
             return ''
-        
+
         note = cjson.decode(self.content)
         return note['body']
-        
+
 
diff --git a/readdb.py b/readdb.py
index 8309e0e..e8bc02a 100644
--- a/readdb.py
+++ b/readdb.py
@@ -51,7 +51,7 @@ def _init_db():
     #Situation 2: DB is outdated
     if not os.path.exists(dbpath) and os.path.exists(olddbpath):
         shutil.copy(olddbpath, dbpath)
-        
+
         conn = sqlite3.connect(dbpath)
         conn.execute("CREATE TABLE  temp_bookmarks  AS SELECT md5, page, title 'content', timestamp, user, color, local  FROM bookmarks")
         conn.execute("ALTER TABLE bookmarks RENAME TO bookmarks_old")
@@ -76,12 +76,12 @@ class BookmarkManager:
         self._conn = sqlite3.connect(dbpath)
         self._conn.text_factory = lambda x: unicode(x, "utf-8", "ignore")
 
-        
+
         self._bookmarks = []
         self._populate_bookmarks()
-        
+
     def add_bookmark(self, page, content, local=1):
-        # locale = 0 means that this is a bookmark originally 
+        # locale = 0 means that this is a bookmark originally
         # created by the person who originally shared the file
         timestamp = time.time()
         client = gconf.client_get_default()
@@ -91,19 +91,19 @@ class BookmarkManager:
         t = (self._filehash, page, content, timestamp, user, color, local)
         self._conn.execute('insert into bookmarks values (?, ?, ?, ?, ?, ?, ?)', t)
         self._conn.commit()
-        
+
         self._resync_bookmark_cache()
-        
+
     def del_bookmark(self, page):
         client = gconf.client_get_default()
         user = client.get_string("/desktop/sugar/user/nick")
 
         # We delete only the locally made bookmark
-        
+
         t = (self._filehash, page, user)
         self._conn.execute('delete from bookmarks where md5=? and page=? and user=?', t)
         self._conn.commit()
-        
+
         self._resync_bookmark_cache()
 
     def _populate_bookmarks(self):
@@ -112,15 +112,15 @@ class BookmarkManager:
 
         for row in rows:
             self._bookmarks.append(Bookmark(row))
-            
+
     def get_bookmarks_for_page(self, page):
         bookmarks = []
         for bookmark in self._bookmarks:
             if bookmark.belongstopage(page):
                 bookmarks.append(bookmark)
-        
+
         return bookmarks
-    
+
     def _resync_bookmark_cache(self):
         # To be called when a new bookmark has been added/removed
         self._bookmarks = []
@@ -130,7 +130,7 @@ class BookmarkManager:
     def get_prev_bookmark_for_page(self, page, wrap = True):
         if not len(self._bookmarks):
             return None
-        
+
         if page <= self._bookmarks[0].page_no and wrap:
             return self._bookmarks[-1]
         else:
@@ -138,14 +138,14 @@ class BookmarkManager:
                 for bookmark in self._bookmarks:
                     if bookmark.belongstopage(i):
                         return bookmark
-                
-        return None 
+
+        return None
 
 
     def get_next_bookmark_for_page(self, page, wrap = True):
         if not len(self._bookmarks):
             return None
-        
+
         if page >= self._bookmarks[-1].page_no and wrap:
             return self._bookmarks[0]
         else:
@@ -153,5 +153,5 @@ class BookmarkManager:
                 for bookmark in self._bookmarks:
                     if bookmark.belongstopage(i):
                         return bookmark
-        
-        return None            
+
+        return None
diff --git a/readdialog.py b/readdialog.py
index c60d1a0..d30e222 100644
--- a/readdialog.py
+++ b/readdialog.py
@@ -3,7 +3,7 @@
 # Stolen from the PyGTK demo module by Maik Hertha <maik.hertha at berlin.de>
 
 import gtk
-import gobject 
+import gobject
 
 from sugar.graphics import style
 from sugar.graphics.toolbutton import ToolButton
@@ -56,7 +56,7 @@ class BaseReadDialog(gtk.Window):
         accept.connect('clicked', self.accept_clicked_cb)
         accept.show()
         self.toolbar.insert(accept, -1)
-        
+
         _vbox.pack_start(self.toolbar, expand=False)
         self.toolbar.show()
 
@@ -165,7 +165,7 @@ class BookmarkAddDialog(BookmarkDialog):
     def accept_clicked_cb(self, widget):
         title = self._title_entry.get_text()
         details = self._content_entry.get_buffer().props.text
-        content = {'title' : unicode(title), 'body' : unicode(details)} 
+        content = {'title' : unicode(title), 'body' : unicode(details)}
         self._sidebarinstance._real_add_bookmark(self._page, cjson.encode(content))
         self.destroy()
 
@@ -176,7 +176,7 @@ class BookmarkEditDialog(BookmarkDialog):
     def accept_clicked_cb(self, widget):
         title = self._title_entry.get_text()
         details = self._content_entry.get_buffer().props.text
-        content = {'title' : unicode(title), 'body' : unicode(details)} 
+        content = {'title' : unicode(title), 'body' : unicode(details)}
         self._sidebarinstance.del_bookmark(self._page)
         self._sidebarinstance._real_add_bookmark(self._page, cjson.encode(content))
         self.destroy()
diff --git a/readsidebar.py b/readsidebar.py
index d8bb895..0df3993 100644
--- a/readsidebar.py
+++ b/readsidebar.py
@@ -49,7 +49,7 @@ class Sidebar(gtk.EventBox):
 
         self._box.show()
         self.show()
-        
+
         self._bookmark_icon = None
         self._bookmark_manager = None
         self._is_showing_local_bookmark = False
@@ -74,7 +74,7 @@ class Sidebar(gtk.EventBox):
 
         if bookmark.is_local():
             self._is_showing_local_bookmark = True
-        
+
     def __bookmark_icon_query_tooltip_cb(self, widget, x, y, keyboard_mode, tip, bookmark):
         tooltip_header = bookmark.get_note_title()
         tooltip_body = bookmark.get_note_body()
@@ -112,7 +112,7 @@ class Sidebar(gtk.EventBox):
         tip.set_custom(vbox)
 
         return True
-        
+
     def __event_cb(self, widget, event, bookmark):
         if event.type == gtk.gdk.BUTTON_PRESS and \
                     self._bookmark_icon is not None:
@@ -136,27 +136,27 @@ class Sidebar(gtk.EventBox):
 
             self._bookmark_icon.hide() #XXX: Is this needed??
             self._bookmark_icon.destroy()
-            
+
             self._bookmark_icon = None
-        
+
             self._is_showing_local_bookmark = False
-    
+
     def set_bookmarkmanager(self, filehash):
         self._bookmark_manager = BookmarkManager(filehash)
-        
+
     def get_bookmarkmanager(self):
         return (self._bookmark_manager)
-    
+
     def update_for_page(self, page):
         self._clear_bookmarks()
         if self._bookmark_manager is None:
             return
-        
+
         bookmarks = self._bookmark_manager.get_bookmarks_for_page(page)
-        
+
         for bookmark in bookmarks:
             self._add_bookmark_icon(bookmark)
-    
+
     def add_bookmark(self, page):
         bookmark_title = (_("%s's bookmark") % profile.get_nick_name())
         bookmark_content = (_("Bookmark for page %d") % page)
@@ -170,11 +170,11 @@ class Sidebar(gtk.EventBox):
     def _real_add_bookmark(self, page, content):
         self._bookmark_manager.add_bookmark(page, unicode(content))
         self.update_for_page(page)
-        
+
     def del_bookmark(self, page):
         self._bookmark_manager.del_bookmark(page)
         self.update_for_page(page)
-        
+
     def is_showing_local_bookmark(self):
         return self._is_showing_local_bookmark
 
diff --git a/readtoolbar.py b/readtoolbar.py
index 53a756f..4d5bcb8 100644
--- a/readtoolbar.py
+++ b/readtoolbar.py
@@ -141,7 +141,7 @@ class EditToolbar(activity.EditToolbar):
             self._search_find_last()
         else:
             self._search_find_prev()
-    
+
     def _find_next_cb(self, button):
         if self._search_entry_changed:
             self._search_find_first()
@@ -182,7 +182,7 @@ class ViewToolbar(gtk.Toolbar):
 
         self._evince_view = None
         self._document = None
-            
+
         self._zoom_out = ToolButton('zoom-out')
         self._zoom_out.set_tooltip(_('Zoom out'))
         self._zoom_out.connect('clicked', self._zoom_out_cb)
@@ -194,7 +194,7 @@ class ViewToolbar(gtk.Toolbar):
         self._zoom_in.connect('clicked', self._zoom_in_cb)
         self.insert(self._zoom_in, -1)
         self._zoom_in.show()
-            
+
         self._zoom_to_width = ToolButton('zoom-best-fit')
         self._zoom_to_width.set_tooltip(_('Zoom to width'))
         self._zoom_to_width.connect('clicked', self._zoom_to_width_cb)
@@ -250,7 +250,7 @@ class ViewToolbar(gtk.Toolbar):
         self._view_notify_zoom_handler = self._evince_view.connect(
             'notify::zoom', self._view_notify_zoom_cb)
 
-        self._update_zoom_buttons() 
+        self._update_zoom_buttons()
 
 
     def _zoom_spin_notify_value_cb(self, zoom_spin, pspec):
@@ -287,7 +287,7 @@ class ViewToolbar(gtk.Toolbar):
             self._evince_view.props.sizing_mode = evince.SIZING_FREE
         self._evince_view.zoom_out()
         self._update_zoom_buttons()
-        
+
     def _zoom_out_cb(self, button):
         self.zoom_out()
 
diff --git a/readtopbar.py b/readtopbar.py
index 3f338f5..6883474 100644
--- a/readtopbar.py
+++ b/readtopbar.py
@@ -46,7 +46,7 @@ class BattMan(gobject.GObject):
 
     def __init__(self, udi):
         gobject.GObject.__init__(self)
-        
+
         bus = dbus.Bus(dbus.Bus.TYPE_SYSTEM)
         proxy = bus.get_object('org.freedesktop.Hal', udi,
                                follow_name_owner_changes=True)
@@ -92,7 +92,7 @@ class BattMan(gobject.GObject):
 
     def do_get_property(self, pspec):
         if pspec.name == 'level':
-            return self._level 
+            return self._level
         if pspec.name == 'charging':
             return self._charging
         if pspec.name == 'discharging':
@@ -174,7 +174,7 @@ class _TopBar(gtk.HBox):
         if self._battery is not None:
             icon_name = get_icon_state(_ICON_NAME, self._battery.props.level, step=-5)
             self._icon = Icon(icon_name=icon_name)
-            self.pack_start(self._icon, expand = False, fill = False) 
+            self.pack_start(self._icon, expand = False, fill = False)
 
     def _battery_level_changed_cb(self, pspec, param):
         icon_name = get_icon_state(_ICON_NAME, self._battery.props.level, step=-5)
@@ -199,6 +199,6 @@ class TopBar(_TopBar):
 
         #TRANS: Translate this as Page i of m (eg: Page 4 of 334)
         self._progressbar.set_text(_("Page %i of %i") % (current_page, n_pages))
-        
-        
+
+
 
-- 
1.7.2.3



More information about the Sugar-devel mailing list