Re: [Sugar-devel] [PATCH] Browse: Set and restore index in the history - Fix OLPC #10779 / SL #2499
On Sat, Jun 18, 2011 at 11:23 AM, Gonzalo Odiard wrote: > > > On Sat, Jun 18, 2011 at 8:44 AM, Sascha Silbe < > sascha-ml-reply-to-201...@silbe.org> wrote: > >> Excerpts from Gonzalo Odiard's message of Wed Jun 08 17:04:41 +0200 2011: >> >> > To test with multiple tabs, in F14 I needed to replace: >> > >> > -self._disable_multiple_tabs = cairo.cairo_version() >= 10810 >> > +self._disable_multiple_tabs = cairo.cairo_version() >= 10810 \ >> > +and cairo.cairo_version() < 11002 >> > >> > I don't know if is in your plans restore multiple tabs, functionality in >> > F14, >> > but the cairo bug is gone. >> >> That's great news! I'd appreciate if someone could check which cairo >> version (at least of those that are shipped by distributions) was the >> first to fix all the tabbing related bugs (IIRC there were several >> different bugs) so we can adjust the check accordingly. >> > > Anybody with a F13 or F12 environment? > I can only confirm the F14 case, and I think the next images from OLPC and > AC > will be based in it. > Just tested this with a little change under F11 (cairo.cairo_version()=11000), it works, so we can change the patch to +self._disable_multiple_tabs = cairo.cairo_version() >= 10810 \ > +and cairo.cairo_version() < 11000 Should work for all the posterior F versions. > > Gonzalo > > >> We only deactivate the UI for creating new tabs, BTW - they can still be >> created using JavaScript, which is how I tested your patch. >> >> Sascha >> >> The code comment > -- >> http://sascha.silbe.org/ >> http://www.infra-silbe.de/ >> >> ___ >> Sugar-devel mailing list >> Sugar-devel@lists.sugarlabs.org >> http://lists.sugarlabs.org/listinfo/sugar-devel >> >> > > ___ > Sugar-devel mailing list > Sugar-devel@lists.sugarlabs.org > http://lists.sugarlabs.org/listinfo/sugar-devel > > ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH] Browse: Set and restore index in the history - Fix OLPC #10779 / SL #2499
Thanks by the review. Gonzalo On Sat, Jun 18, 2011 at 8:33 AM, Sascha Silbe < sascha-ml-reply-to-201...@silbe.org> wrote: > Excerpts from godiard's message of Wed Jun 08 17:09:14 +0200 2011: > > > If the user go back, or select any page in the history and > > close the activity, need restore at the next start, the history, > > and the index in the history too. > > Thanks for the patch! Pushed as 7072ec5 [1]. > > Sascha > > [1] > http://git.sugarlabs.org/browse/mainline/commit/7072ec5913ff6e1447666adf825c46edb0074a93 > -- > http://sascha.silbe.org/ > http://www.infra-silbe.de/ > > ___ > Sugar-devel mailing list > Sugar-devel@lists.sugarlabs.org > http://lists.sugarlabs.org/listinfo/sugar-devel > > ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH] Browse: Set and restore index in the history - Fix OLPC #10779 / SL #2499
On Sat, Jun 18, 2011 at 8:44 AM, Sascha Silbe < sascha-ml-reply-to-201...@silbe.org> wrote: > Excerpts from Gonzalo Odiard's message of Wed Jun 08 17:04:41 +0200 2011: > > > To test with multiple tabs, in F14 I needed to replace: > > > > -self._disable_multiple_tabs = cairo.cairo_version() >= 10810 > > +self._disable_multiple_tabs = cairo.cairo_version() >= 10810 \ > > +and cairo.cairo_version() < 11002 > > > > I don't know if is in your plans restore multiple tabs, functionality in > > F14, > > but the cairo bug is gone. > > That's great news! I'd appreciate if someone could check which cairo > version (at least of those that are shipped by distributions) was the > first to fix all the tabbing related bugs (IIRC there were several > different bugs) so we can adjust the check accordingly. > Anybody with a F13 or F12 environment? I can only confirm the F14 case, and I think the next images from OLPC and AC will be based in it. Gonzalo > We only deactivate the UI for creating new tabs, BTW - they can still be > created using JavaScript, which is how I tested your patch. > > Sascha > > -- > http://sascha.silbe.org/ > http://www.infra-silbe.de/ > > ___ > Sugar-devel mailing list > Sugar-devel@lists.sugarlabs.org > http://lists.sugarlabs.org/listinfo/sugar-devel > > ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH] Browse: Set and restore index in the history - Fix OLPC #10779 / SL #2499
Excerpts from Gonzalo Odiard's message of Wed Jun 08 17:04:41 +0200 2011: > To test with multiple tabs, in F14 I needed to replace: > > -self._disable_multiple_tabs = cairo.cairo_version() >= 10810 > +self._disable_multiple_tabs = cairo.cairo_version() >= 10810 \ > +and cairo.cairo_version() < 11002 > > I don't know if is in your plans restore multiple tabs, functionality in > F14, > but the cairo bug is gone. That's great news! I'd appreciate if someone could check which cairo version (at least of those that are shipped by distributions) was the first to fix all the tabbing related bugs (IIRC there were several different bugs) so we can adjust the check accordingly. We only deactivate the UI for creating new tabs, BTW - they can still be created using JavaScript, which is how I tested your patch. Sascha -- http://sascha.silbe.org/ http://www.infra-silbe.de/ signature.asc Description: PGP signature ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH] Browse: Set and restore index in the history - Fix OLPC #10779 / SL #2499
Excerpts from godiard's message of Wed Jun 08 17:09:14 +0200 2011: > If the user go back, or select any page in the history and > close the activity, need restore at the next start, the history, > and the index in the history too. Thanks for the patch! Pushed as 7072ec5 [1]. Sascha [1] http://git.sugarlabs.org/browse/mainline/commit/7072ec5913ff6e1447666adf825c46edb0074a93 -- http://sascha.silbe.org/ http://www.infra-silbe.de/ signature.asc Description: PGP signature ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH] Browse: Set and restore index in the history - Fix OLPC #10779 / SL #2499
Thanks Rafael Gonzalo On Wed, Jun 15, 2011 at 1:31 PM, Rafael Ortiz wrote: > > > On Wed, Jun 15, 2011 at 7:01 AM, Gonzalo Odiard wrote: > >> Any of the Browse developers is interested in review this patch? >> Thanks >> > > I'm not a Browse developer but I've tested this change and works for me. > > btw I also tested with your cairo modification on sugar-0.88/sweets for > multitabs (should be in another patch) but must be added also. > > Cheers > >> Gonzalo >> >> ___ >> Sugar-devel mailing list >> Sugar-devel@lists.sugarlabs.org >> http://lists.sugarlabs.org/listinfo/sugar-devel >> >> > -- Gonzalo Odiard ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH] Browse: Set and restore index in the history - Fix OLPC #10779 / SL #2499
On Wed, Jun 15, 2011 at 7:01 AM, Gonzalo Odiard wrote: > Any of the Browse developers is interested in review this patch? > Thanks > I'm not a Browse developer but I've tested this change and works for me. btw I also tested with your cairo modification on sugar-0.88/sweets for multitabs (should be in another patch) but must be added also. Cheers > Gonzalo > > ___ > Sugar-devel mailing list > Sugar-devel@lists.sugarlabs.org > http://lists.sugarlabs.org/listinfo/sugar-devel > > ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH] Browse: Set and restore index in the history - Fix OLPC #10779 / SL #2499
Any of the Browse developers is interested in review this patch? Thanks Gonzalo ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH] Browse: Set and restore index in the history - Fix OLPC #10779 / SL #2499
Sasha: In this patch I have addressed your comments. To test with multiple tabs, in F14 I needed to replace: -self._disable_multiple_tabs = cairo.cairo_version() >= 10810 +self._disable_multiple_tabs = cairo.cairo_version() >= 10810 \ +and cairo.cairo_version() < 11002 I don't know if is in your plans restore multiple tabs, functionality in F14, but the cairo bug is gone. Gonzalo On Wed, Jun 8, 2011 at 12:09 PM, wrote: > From: Gonzalo Odiard > > If the user go back, or select any page in the history and > close the activity, need restore at the next start, the history, > and the index in the history too. > --- > browser.py |7 ++- > webactivity.py | 26 ++ > webtoolbar.py |1 + > 3 files changed, 17 insertions(+), 17 deletions(-) > > diff --git a/browser.py b/browser.py > index b9c1f69..3cef766 100644 > --- a/browser.py > +++ b/browser.py > @@ -281,7 +281,6 @@ class Browser(WebView): > > def do_setup(self): > WebView.do_setup(self) > - > listener = xpcom.server.WrapObject(ContentInvoker(self), >interfaces.nsIDOMEventListener) > self.window_root.addEventListener('click', listener, False) > @@ -351,6 +350,12 @@ class Browser(WebView): > interfaces.nsIMarkupDocumentViewer) > markupDocumentViewer.fullZoom -= _ZOOM_AMOUNT > > +def get_history_index(self): > +return self.web_navigation.sessionHistory.index > + > +def set_history_index(self, index): > +self.web_navigation.gotoIndex(index) > + > > class PopupDialog(gtk.Window): > def __init__(self): > diff --git a/webactivity.py b/webactivity.py > index 48cb3ed..8ad95a6 100644 > --- a/webactivity.py > +++ b/webactivity.py > @@ -458,6 +458,10 @@ class WebActivity(activity.Activity): > link['owner'], -1, link['hash']) > logging.debug('## reading %s', data) > self._tabbed_view.set_session(self.model.data['history']) > +for number, tab in enumerate(self.model.data['currents']): > +browser = self._tabbed_view.get_nth_page(number) > +browser.set_history_index(tab['history_index']) > + > > self._tabbed_view.set_current_page(self.model.data['current_tab']) > elif self.metadata['mime_type'] == 'text/uri-list': > data = self._get_data_from_file_path(file_path) > @@ -469,19 +473,6 @@ class WebActivity(activity.Activity): > 'list of multiple uris by now.') > else: > self._tabbed_view.props.current_browser.load_uri(file_path) > -self._load_urls() > - > -def _load_urls(self): > -if self.model.data['currents'] != None: > -first = True > -for current_tab in self.model.data['currents']: > -if first: > -browser = self._tabbed_view.current_browser > -first = False > -else: > -browser = Browser() > -self._tabbed_view._append_tab(browser) > -browser.load_uri(current_tab['url']) > > def write_file(self, file_path): > if not self.metadata['mime_type']: > @@ -503,9 +494,12 @@ class WebActivity(activity.Activity): > for n in range(0, self._tabbed_view.get_n_pages()): > n_browser = self._tabbed_view.get_nth_page(n) > if n_browser != None: > -nsiuri = browser.progress.location > -ui_uri = browser.get_url_from_nsiuri(nsiuri) > -info = {'title': browser.props.title, 'url': ui_uri} > +nsiuri = n_browser.progress.location > +ui_uri = n_browser.get_url_from_nsiuri(nsiuri) > +history_index = n_browser.get_history_index() > +info = {'title': n_browser.props.title, 'url': ui_uri, > +'history_index': history_index} > + > self.model.data['currents'].append(info) > > f = open(file_path, 'w') > diff --git a/webtoolbar.py b/webtoolbar.py > index 8b0e108..6cb3ee7 100644 > --- a/webtoolbar.py > +++ b/webtoolbar.py > @@ -355,6 +355,7 @@ class PrimaryToolbar(ToolbarBase): > self._history = browser.history > self._session_history_changed_hid = self._history.connect( > 'session-history-changed', > self._session_history_changed_cb) > +self._reload_session_history() > > if self._browser is not None: > self._browser.disconnect(self._title_changed_hid) > -- > 1.7.4.4 > > -- Gonzalo Odiard ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH] Browse: Set and restore index in the history - Fix OLPC #10779 / SL #2499
From: Gonzalo Odiard If the user go back, or select any page in the history and close the activity, need restore at the next start, the history, and the index in the history too. --- browser.py |7 ++- webactivity.py | 26 ++ webtoolbar.py |1 + 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/browser.py b/browser.py index b9c1f69..3cef766 100644 --- a/browser.py +++ b/browser.py @@ -281,7 +281,6 @@ class Browser(WebView): def do_setup(self): WebView.do_setup(self) - listener = xpcom.server.WrapObject(ContentInvoker(self), interfaces.nsIDOMEventListener) self.window_root.addEventListener('click', listener, False) @@ -351,6 +350,12 @@ class Browser(WebView): interfaces.nsIMarkupDocumentViewer) markupDocumentViewer.fullZoom -= _ZOOM_AMOUNT +def get_history_index(self): +return self.web_navigation.sessionHistory.index + +def set_history_index(self, index): +self.web_navigation.gotoIndex(index) + class PopupDialog(gtk.Window): def __init__(self): diff --git a/webactivity.py b/webactivity.py index 48cb3ed..8ad95a6 100644 --- a/webactivity.py +++ b/webactivity.py @@ -458,6 +458,10 @@ class WebActivity(activity.Activity): link['owner'], -1, link['hash']) logging.debug('## reading %s', data) self._tabbed_view.set_session(self.model.data['history']) +for number, tab in enumerate(self.model.data['currents']): +browser = self._tabbed_view.get_nth_page(number) +browser.set_history_index(tab['history_index']) + self._tabbed_view.set_current_page(self.model.data['current_tab']) elif self.metadata['mime_type'] == 'text/uri-list': data = self._get_data_from_file_path(file_path) @@ -469,19 +473,6 @@ class WebActivity(activity.Activity): 'list of multiple uris by now.') else: self._tabbed_view.props.current_browser.load_uri(file_path) -self._load_urls() - -def _load_urls(self): -if self.model.data['currents'] != None: -first = True -for current_tab in self.model.data['currents']: -if first: -browser = self._tabbed_view.current_browser -first = False -else: -browser = Browser() -self._tabbed_view._append_tab(browser) -browser.load_uri(current_tab['url']) def write_file(self, file_path): if not self.metadata['mime_type']: @@ -503,9 +494,12 @@ class WebActivity(activity.Activity): for n in range(0, self._tabbed_view.get_n_pages()): n_browser = self._tabbed_view.get_nth_page(n) if n_browser != None: -nsiuri = browser.progress.location -ui_uri = browser.get_url_from_nsiuri(nsiuri) -info = {'title': browser.props.title, 'url': ui_uri} +nsiuri = n_browser.progress.location +ui_uri = n_browser.get_url_from_nsiuri(nsiuri) +history_index = n_browser.get_history_index() +info = {'title': n_browser.props.title, 'url': ui_uri, +'history_index': history_index} + self.model.data['currents'].append(info) f = open(file_path, 'w') diff --git a/webtoolbar.py b/webtoolbar.py index 8b0e108..6cb3ee7 100644 --- a/webtoolbar.py +++ b/webtoolbar.py @@ -355,6 +355,7 @@ class PrimaryToolbar(ToolbarBase): self._history = browser.history self._session_history_changed_hid = self._history.connect( 'session-history-changed', self._session_history_changed_cb) +self._reload_session_history() if self._browser is not None: self._browser.disconnect(self._title_changed_hid) -- 1.7.4.4 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel