changeset 615:70872a83ef15 frontends_multi_profiles

browser side (web panel): add an option to hide url headed + use it for public blog
author Goffi <goffi@goffi.org>
date Tue, 10 Feb 2015 20:52:02 +0100
parents 14bdf5394ae9
children 1c0d5a87c554
files src/browser/libervia_main.py src/browser/sat_browser/panels.py
diffstat 2 files changed, 10 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/libervia_main.py	Tue Feb 10 20:43:26 2015 +0100
+++ b/src/browser/libervia_main.py	Tue Feb 10 20:52:02 2015 +0100
@@ -404,7 +404,7 @@
         elif "public_blog" in data:
             # TODO: use the bare instead of node when all blogs can be retrieved
             node = jid.JID(data['public_blog']).node
-            web_widget = self.widgets.getOrCreateWidget(panels.WebPanel, "/blog/{}".format(node), profile=C.PROF_KEY_NONE, on_new_widget=None, on_existing_widget=C.WIDGET_RECREATE) # FIXME: won't work with unicode nodes
+            web_widget = self.widgets.getOrCreateWidget(panels.WebPanel, "/blog/{}".format(node), show_url=False, profile=C.PROF_KEY_NONE, on_new_widget=None, on_existing_widget=C.WIDGET_RECREATE) # FIXME: won't work with unicode nodes
             self.addTab("{}'s blog".format(unicode(node)), web_widget)
         else:
             dialog.InfoDialog("Error",
--- a/src/browser/sat_browser/panels.py	Tue Feb 10 20:43:26 2015 +0100
+++ b/src/browser/sat_browser/panels.py	Tue Feb 10 20:52:02 2015 +0100
@@ -452,7 +452,7 @@
 class WebPanel(quick_widgets.QuickWidget, base_widget.LiberviaWidget):
     """ (mini)browser like widget """
 
-    def __init__(self, host, target, profiles=None):
+    def __init__(self, host, target, show_url=True, profiles=None):
         """
         @param host: SatWebFrontend instance
         @param target: url to open
@@ -464,15 +464,14 @@
         self._url = dialog.ExtTextBox(enter_cb=self.onUrlClick)
         self._url.setText(target or "")
         self._url.setWidth('100%')
-        hpanel = HorizontalPanel()
-        hpanel.add(self._url)
-        btn = Button("Go", self.onUrlClick)
-        hpanel.setCellWidth(self._url, "100%")
-        #self.setCellWidth(btn, "10%")
-        hpanel.add(self._url)
-        hpanel.add(btn)
-        self._vpanel.add(hpanel)
-        self._vpanel.setCellHeight(hpanel, '20px')
+        if show_url:
+            hpanel = HorizontalPanel()
+            hpanel.add(self._url)
+            btn = Button("Go", self.onUrlClick)
+            hpanel.setCellWidth(self._url, "100%")
+            hpanel.add(btn)
+            self._vpanel.add(hpanel)
+            self._vpanel.setCellHeight(hpanel, '20px')
         self._frame = Frame(target or "")
         self._frame.setSize('100%', '100%')
         DOM.setStyleAttribute(self._frame.getElement(), "position", "relative")