Ejemplo n.º 1
0
 def __update_toolbars(self, event):
     """
         Update toolbar content with on self
         @param event as WebKit2.LoadEvent
     """
     self._window.toolbar.title.update_load_indicator(self)
     parsed = urlparse(self.uri)
     wanted_scheme = parsed.scheme in ["http", "https", "file"]
     if event == WebKit2.LoadEvent.STARTED:
         self._window.container.current.find_widget.set_search_mode(False)
         profile = name_from_profile_id(self.profile)
         self._window.toolbar.title.set_title("%s%s" % (profile, self.uri))
         self._window.toolbar.title.show_readable_button(False)
         if wanted_scheme:
             self._window.toolbar.title.show_spinner(True)
         else:
             # Give focus to url bar
             self._window.toolbar.title.start_search()
         self._window.toolbar.title.show_indicator(Indicator.NONE)
         # Turn off reading mode if needed
         if self._window.container.current.reading:
             self._window.container.current.switch_read_mode()
         self._window.toolbar.title.progress.show()
     elif event == WebKit2.LoadEvent.COMMITTED:
         profile = name_from_profile_id(self.profile)
         self._window.toolbar.title.set_title("%s%s" % (profile, self.uri))
     elif event == WebKit2.LoadEvent.FINISHED:
         self._window.toolbar.title.show_spinner(False)
         self._window.toolbar.title.progress.set_fraction(1.0)
         # Give focus to webview
         if wanted_scheme:
             GLib.idle_add(self.grab_focus)
Ejemplo n.º 2
0
 def update(self, webview):
     """
         Update window
         @param webview as WebView
     """
     uri = webview.uri
     if uri is not None:
         self.toolbar.title.set_uri(uri)
         accept_tls = El().websettings.get_accept_tls(uri)
         self.toolbar.end.show_tls_button(accept_tls)
     self.toolbar.title.update_load_indicator(webview)
     if webview.popups:
         self.toolbar.title.show_indicator(Indicator.POPUPS)
     else:
         self.toolbar.title.show_indicator(Indicator.NONE)
     if webview.is_loading():
         self.toolbar.title.show_spinner(True)
         self.toolbar.title.progress.show()
     else:
         self.toolbar.title.progress.hide()
         readable_content = webview.readable_content
         self.toolbar.title.show_readable_button(readable_content != "")
     profile = name_from_profile_id(webview.profile)
     title = webview.title
     if title:
         self.toolbar.title.set_title("%s%s" % (profile, title))
     elif uri:
         self.toolbar.title.set_title("%s%s" % (profile, uri))
     self.toolbar.actions.set_actions(webview)
Ejemplo n.º 3
0
 def __on_title_changed(self, webview, title):
     """
         Update title
         @param webview as WebView
         @param title as str
     """
     if webview.get_mapped():
         profile = name_from_profile_id(self.profile)
         self._window.toolbar.title.set_title("%s%s" % (profile, title))
     self._window.container.sites_manager.update_label(self.view)