Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

i have been doing this web browser for roughly a day now, i have got the main look of the browser set up how i want it.

i have now decided to add a little progress bar at the bottom of the main window to show how far along a page is load. The progress bar has been added using quickly (so i have the look in the interface) but now i can not for the life of me figure out how to get the progress bar to work when the page is being loaded.

Any idea's on how i can do this guys?

My code for the web browser is as follows

import gettext
from gettext import gettext as _
gettext.textdomain('dm-web-browser')

from gi.repository import Gtk, WebKit # pylint: disable=E0611
import logging
logger = logging.getLogger('dm_web_browser')

from dm_web_browser_lib import Window
from dm_web_browser.AboutDmWebBrowserDialog import AboutDmWebBrowserDialog
from dm_web_browser.PreferencesDmWebBrowserDialog import PreferencesDmWebBrowserDialog

# See dm_web_browser_lib.Window.py for more details about how this class works
class DmWebBrowserWindow(Window):
    __gtype_name__ = "DmWebBrowserWindow"

    def finish_initializing(self, builder): # pylint: disable=E1002
        """Set up the main window"""
        super(DmWebBrowserWindow, self).finish_initializing(builder)

        self.AboutDialog = AboutDmWebBrowserDialog
        self.PreferencesDialog = PreferencesDmWebBrowserDialog

        # Code for other initialization actions should be added here.
        self.backbutton = self.builder.get_object("backbutton")
        self.forwardbutton = self.builder.get_object("forwardbutton")
        self.refreshbutton = self.builder.get_object("refreshbutton")
        self.stopbutton = self.builder.get_object("stopbutton")
        self.urlentry = self.builder.get_object("urlentry")
        self.scrolledwindow = self.builder.get_object("scrolledwindow")
        self.toolbar = self.builder.get_object("toolbar")


        self.webview = WebKit.WebView()

        self.scrolledwindow.add(self.webview)
        self.webview.show()

    def on_backbutton_clicked(self, widget):
        self.webview.go_back()

    def on_forwardbutton_clicked(self,widget):
        self.webview.go_forward()


    def on_refreshbutton_clicked(self, widget):
        self.webview.reload()

    def on_stopbutton_clicked(self, widget):
        self.webview.stop_loading()

as you can see i am using WebKit and WebView with python and quickly.

any ideas of code that will get this progress bar to work would be really appreciated

this is the code i am using to call the progress bar :

fetcher = UrlFetchProgressBox("http://" + url)
    fetcher.connect("downloaded",self, on_urlentry_activate)
    fetcher.show()
    self.builder.get_object("vbox1").pack_start(fetcher,false,false)

any help me sort this please

share|improve this question

1 Answer 1

I haven't used progress bar widgets, but quickly has its own widget for your purpose:

from quickly.widgets import url_fetch_progressbar

Check out code for usage. You have to install quickly-widgets package. Heres a demo

share|improve this answer
    
B ive looked at the check out code bit, would i need to add the progress bar to the UI in glade or do i just add the code? what is the best option? –  DriftedMass Apr 19 '13 at 21:01
    
B ive tried adding the code to my script when i go to run the web browser under command prompt (quickly run) i get this error message : Traceback (most recent call last): File "bin/dm-web-browser", line 32, in <module> import dm_web_browser File "/home/matty/dm-web-browser/dm_web_browser/__init__.py", line 14, in <module> from dm_web_browser import DmWebBrowserWindow File "/home/matty/dm-web-browser/dm_web_browser/DmWebBrowserWindow.py", line 19, in <module> from quickly.widgets import url_fetch_progressbar ImportError: No module named widgets any ideas? –  DriftedMass Apr 19 '13 at 21:56
    
Sorry, i forgot it's a separate package. apt-get install quickly-widgets –  Ian B. Apr 20 '13 at 0:24
    
B cheers i should have thought about it being a additional package. Thanks for your help –  DriftedMass Apr 20 '13 at 0:39
    
B ive put in the code you stated above (from quickly.widgets import url_fetch_progressbox) ive added to where the rest of my connectors are, but i still can not figure out how to get it to work any ideas? –  DriftedMass Apr 20 '13 at 1:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.