[Sugar-devel] [PATCH 3/3] sdxo#2316: Browse don't remember the last zoom used. In the read_file and write_file method self.model.data['current_zoom_level'] is restored/written

Ariel Calzada ariel.calzada at gmail.com
Thu Jan 3 13:58:45 EST 2013


---
 webactivity.py |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/webactivity.py b/webactivity.py
index fc60069..a94c7fa 100644
--- a/webactivity.py
+++ b/webactivity.py
@@ -426,6 +426,13 @@ class WebActivity(activity.Activity):
                 tab_page.browser.grab_focus()
 
             self._tabbed_view.set_current_page(self.model.data['current_tab'])
+
+            # zoom level
+            if 'current_zoom_level' in self.model.data:
+                self._tabbed_view.props.current_browser.set_zoom_level(self.model.data['current_zoom_level'])
+            else:
+                self._tabbed_view.props.current_browser.set_zoom_level(ZOOM_ORIGINAL)
+
         elif self.metadata['mime_type'] == 'text/uri-list':
             data = self._get_data_from_file_path(file_path)
             uris = mime.split_uri_list(data)
@@ -447,6 +454,9 @@ class WebActivity(activity.Activity):
 
             browser = self._tabbed_view.current_browser
 
+            # zoom level
+            self.model.data['current_zoom_level'] = browser.get_zoom_level()
+
             if not self._jobject.metadata['title_set_by_user'] == '1':
                 if browser.props.title is None:
                     self.metadata['title'] = _('Untitled')
-- 
1.7.10.4



More information about the Sugar-devel mailing list