From de545fc97273db57453d3cc212ce80bb784aa9de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <manuq@laptop.org>
Date: Wed, 23 Jan 2013 14:09:35 -0300
Subject: [PATCH Browse] Fix "Actual zoom" button in PDF tabs - SL #4383
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Mail-Followup-To: <sugar-devel@lists.sugarlabs.org>
- Make 'Actual zoom' button from the subtoolbar insensitive, just like
the others
- Add 'Actual zoom' button to PDF toolbar overflow
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
---
pdfviewer.py | 13 +++++++++++++
viewtoolbar.py | 1 +
2 files changed, 14 insertions(+)
diff --git a/pdfviewer.py b/pdfviewer.py
index d1f1ecf..e539a32 100644
a
|
b
|
class EvinceViewer(Gtk.Overlay): |
98 | 98 | toolbar_box.toolbar.insert(zoom_in_button, -1) |
99 | 99 | zoom_in_button.show() |
100 | 100 | |
| 101 | zoom_original_button = ToolButton('zoom-original') |
| 102 | zoom_original_button.set_tooltip(_('Actual size')) |
| 103 | zoom_original_button.connect('clicked', self.__zoom_original_cb) |
| 104 | toolbar_box.toolbar.insert(zoom_original_button, -1) |
| 105 | zoom_original_button.show() |
| 106 | |
101 | 107 | separator = Gtk.SeparatorToolItem() |
102 | 108 | separator.props.draw = True |
103 | 109 | toolbar_box.toolbar.insert(separator, -1) |
… |
… |
class EvinceViewer(Gtk.Overlay): |
146 | 152 | def __zoom_in_cb(self, widget): |
147 | 153 | self.zoom_in() |
148 | 154 | |
| 155 | def __zoom_original_cb(self, widget): |
| 156 | self.zoom_original() |
| 157 | |
149 | 158 | def __go_back_page_cb(self, widget): |
150 | 159 | self._view.previous_page() |
151 | 160 | |
… |
… |
class EvinceViewer(Gtk.Overlay): |
162 | 171 | self._forward_page_button.props.sensitive = \ |
163 | 172 | current_page < self._doc.get_n_pages() - 1 |
164 | 173 | |
| 174 | def zoom_original(self): |
| 175 | self._model.props.sizing_mode = EvinceView.SizingMode.FREE |
| 176 | self._model.props.scale = 1.0 |
| 177 | |
165 | 178 | def zoom_in(self): |
166 | 179 | self._model.props.sizing_mode = EvinceView.SizingMode.FREE |
167 | 180 | self._view.zoom_in() |
diff --git a/viewtoolbar.py b/viewtoolbar.py
index 41ea21f..2008277 100644
a
|
b
|
class ViewToolbar(Gtk.Toolbar): |
90 | 90 | is_webkit_browser = isinstance(self._browser, Browser) |
91 | 91 | self.zoomin.set_sensitive(is_webkit_browser) |
92 | 92 | self.zoomout.set_sensitive(is_webkit_browser) |
| 93 | self.zoom_original.set_sensitive(is_webkit_browser) |
93 | 94 | |
94 | 95 | def __zoom_original_clicked_cb(self, button): |
95 | 96 | tabbed_view = self._activity.get_canvas() |