Thanks. Pushed and released Help 14<div><br></div><div>Gonzalo<br><br><div class="gmail_quote">On Thu, Apr 26, 2012 at 1:33 PM, Manuel Quiñones <span dir="ltr"><<a href="mailto:manuq@laptop.org" target="_blank">manuq@laptop.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">El día 26 de abril de 2012 12:04, Manuel Kaufmann <<a href="mailto:humitos@gmail.com">humitos@gmail.com</a>> escribió:<br>
<div class="im">> - All the code was migrated to Gtk3 following this guide[1]<br>
> - Toolbar View's icon was changed from "camera" to the right one:<br>
> "toolbar-view"<br>
> - Back and Forward buttons are working properly<br>
> - WebKit.WebView inside a Gtk.ScrolledWindow to be able to scroll the page.<br>
><br>
> [1] <a href="http://wiki.sugarlabs.org/go/Features/GTK3/Porting" target="_blank">http://wiki.sugarlabs.org/go/Features/GTK3/Porting</a><br>
><br>
> Signed-off-by: Manuel Kaufmann <<a href="mailto:humitos@gmail.com">humitos@gmail.com</a>><br>
<br>
</div>Acked-by: Manuel Quiñones <<a href="mailto:manuq@laptop.org">manuq@laptop.org</a>><br>
<div class="HOEnZb"><div class="h5"><br>
> ---<br>
> browser.py | 43 -------------------------------------------<br>
> helpactivity.py | 36 +++++++++++++++---------------------<br>
> 2 files changed, 15 insertions(+), 64 deletions(-)<br>
> delete mode 100644 browser.py<br>
><br>
> diff --git a/browser.py b/browser.py<br>
> deleted file mode 100644<br>
> index 85017cb..0000000<br>
> --- a/browser.py<br>
> +++ /dev/null<br>
> @@ -1,43 +0,0 @@<br>
> -# This program is free software; you can redistribute it and/or modify<br>
> -# it under the terms of the GNU General Public License as published by<br>
> -# the Free Software Foundation; either version 2 of the License, or<br>
> -# (at your option) any later version.<br>
> -#<br>
> -# This program is distributed in the hope that it will be useful,<br>
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
> -# GNU General Public License for more details.<br>
> -#<br>
> -# You should have received a copy of the GNU General Public License<br>
> -# along with this program; if not, write to the Free Software<br>
> -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA<br>
> -<br>
> -from gi.repository import WebKit<br>
> -<br>
> -_ZOOM_AMOUNT = 0.1<br>
> -<br>
> -<br>
> -class Browser(WebKit.WebView):<br>
> - def __init__(self):<br>
> - WebKit.WebView.__init__(self)<br>
> -<br>
> - def do_setup(self):<br>
> - WebKit.WebView.do_setup(self)<br>
> -<br>
> - def zoom_in(self):<br>
> - # contentViewer = self.doc_shell.queryInterface( \<br>
> - # interfaces.nsIDocShell).contentViewer<br>
> - # if contentViewer is not None:<br>
> - # markupDocumentViewer = contentViewer.queryInterface( \<br>
> - # interfaces.nsIMarkupDocumentViewer)<br>
> - # markupDocumentViewer.fullZoom += _ZOOM_AMOUNT<br>
> - pass<br>
> -<br>
> - def zoom_out(self):<br>
> - # contentViewer = self.doc_shell.queryInterface( \<br>
> - # interfaces.nsIDocShell).contentViewer<br>
> - # if contentViewer is not None:<br>
> - # markupDocumentViewer = contentViewer.queryInterface( \<br>
> - # interfaces.nsIMarkupDocumentViewer)<br>
> - # markupDocumentViewer.fullZoom -= _ZOOM_AMOUNT<br>
> - pass<br>
> diff --git a/helpactivity.py b/helpactivity.py<br>
> index f8e3435..85ca801 100755<br>
> --- a/helpactivity.py<br>
> +++ b/helpactivity.py<br>
> @@ -17,14 +17,15 @@ from gettext import gettext as _<br>
><br>
> from gi.repository import Gtk<br>
> from gi.repository import GObject<br>
> +from gi.repository import WebKit<br>
><br>
> from sugar3.activity import activity<br>
> from sugar3.graphics.toolbutton import ToolButton<br>
> -from sugar3.graphics.toolbarbox import ToolbarBox, ToolbarButton<br>
> +from sugar3.graphics.toolbarbox import ToolbarBox<br>
> +from sugar3.graphics.toolbarbox import ToolbarButton<br>
> from sugar3.activity.widgets import ActivityToolbarButton<br>
> from sugar3.activity.widgets import StopButton<br>
><br>
> -from browser import Browser<br>
> from viewtoolbar import ViewToolbar<br>
><br>
> HOME = 'file://' + os.path.join(activity.get_bundle_path(),<br>
> @@ -37,8 +38,10 @@ class HelpActivity(activity.Activity):<br>
><br>
> self.props.max_participants = 1<br>
><br>
> - self._web_view = Browser()<br>
> -<br>
> + self._web_view = WebKit.WebView()<br>
> + _scrolled_window = Gtk.ScrolledWindow()<br>
> + _scrolled_window.add(self._web_view)<br>
> + _scrolled_window.show()<br>
><br>
> toolbar_box = ToolbarBox()<br>
><br>
> @@ -48,7 +51,7 @@ class HelpActivity(activity.Activity):<br>
><br>
> viewtoolbar = ViewToolbar(self)<br>
> viewbutton = ToolbarButton(page=viewtoolbar, \<br>
> - icon_name='camera')<br>
> + icon_name='toolbar-view')<br>
> toolbar_box.toolbar.insert(viewbutton, -1)<br>
> viewbutton.show()<br>
><br>
> @@ -96,9 +99,8 @@ class HelpActivity(activity.Activity):<br>
> self.set_toolbar_box(toolbar_box)<br>
> toolbar_box.show()<br>
><br>
> - self.set_canvas(self._web_view)<br>
> + self.set_canvas(_scrolled_window)<br>
> self._web_view.show()<br>
> -<br>
> self._web_view.load_uri(HOME)<br>
><br>
><br>
> @@ -128,31 +130,23 @@ class Toolbar(Gtk.Toolbar):<br>
> self.insert(self._home, -1)<br>
> self._home.show()<br>
><br>
> - """<br>
> - progress_listener = self._web_view.progress<br>
> - progress_listener.connect('location-changed',<br>
> - self._location_changed_cb)<br>
> - progress_listener.connect('loading-stop', self._loading_stop_cb)<br>
> - """<br>
> + self._web_view.connect('notify::uri', self._uri_changed_cb)<br>
><br>
> - def _location_changed_cb(self, progress_listener, uri):<br>
> + def _uri_changed_cb(self, progress_listener, uri):<br>
> self.update_navigation_buttons()<br>
><br>
> def _loading_stop_cb(self, progress_listener):<br>
> self.update_navigation_buttons()<br>
><br>
> def update_navigation_buttons(self):<br>
> - can_go_back = self._web_view.web_navigation.canGoBack<br>
> - self._back.props.sensitive = can_go_back<br>
> -<br>
> - can_go_forward = self._web_view.web_navigation.canGoForward<br>
> - self._forward.props.sensitive = can_go_forward<br>
> + self._back.props.sensitive = self._web_view.can_go_back()<br>
> + self._forward.props.sensitive = self._web_view.can_go_forward()<br>
><br>
> def _go_back_cb(self, button):<br>
> - self._web_view.web_navigation.goBack()<br>
> + self._web_view.go_back()<br>
><br>
> def _go_forward_cb(self, button):<br>
> - self._web_view.web_navigation.goForward()<br>
> + self._web_view.go_forward()<br>
><br>
> def _go_home_cb(self, button):<br>
> self._web_view.load_uri(HOME)<br>
> --<br>
> 1.7.10<br>
><br>
</div></div><div class="im HOEnZb">> _______________________________________________<br>
> Sugar-devel mailing list<br>
> <a href="mailto:Sugar-devel@lists.sugarlabs.org">Sugar-devel@lists.sugarlabs.org</a><br>
> <a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
<br>
<br>
<br>
</div><span class="HOEnZb"><font color="#888888">--<br>
.. manuq ..<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Sugar-devel mailing list<br>
<a href="mailto:Sugar-devel@lists.sugarlabs.org">Sugar-devel@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
</div></div></blockquote></div><br></div>