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 am trying to enable flash in my Quickly app.
I have a WebKit/webview in a scrolledwindow.

I know on Android you need to enable javascript an plugins.

I have look in the WebKit2GTK+ Reference Manual

So my code look like this:

#gets the WebView and scrolledwindow wiget object.  
self.scrolledwindow = builder.get_object("scrolledwindow")  
self.webview = WebKit.WebView()   

#webview->settings.
self.settings = self.webview.get_settings()
self.settings.set_property("enable-plugins", True)
self.settings.set_property("enable-javascript", True)

But it does not work :( Or in fact, I can hear the sound from the video, just not see images.

The terminal response look like this:

finish_initializing  
    self.settings.set_property("enable-javascript", True)  
TypeError: object of type `WebKitWebSettings' does not have property `enable-javascript'  

It can run with out the self.settings.set_property("enable-javascript", True) line, but so again no image on the video.

NB: I'm on my first week with python, so I am a noob to Python ;)

share|improve this question

3 Answers 3

Here's a rendition of some working code. Note how the settings are instantiated and later the browser is told to set those settings.

    self._browser = webkit.WebView()

    browser_settings=webkit.WebSettings()
    useragent=browser_settings.get_property('user-agent')

    browser_settings.set_property('user-agent', ' '.'abc')
    self._browser.set_settings(browser_settings)

(Looks like the useragent= line is superfluous.)

share|improve this answer
    
John thank you very much :) your code actually helped me lot, I have added an ipod-user-agent then it run on my laptop.. Voidcode ;) –  Voidcode Aug 18 '12 at 21:48

You don't have a variable on the object returned. Terminal has no idea what the "object" is.

share|improve this answer
    
Yes.. but in the WebKit2GTK+ Reference Manual there is property call 'enable-javascript' and it gets no error with the 'enable-plugins'. –  Voidcode Jul 24 '12 at 2:53

After trying John S Gruber´s code.

I try with a ipod-user-agent.

Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10

This works :)

I don´t know how, I´am using an Aspira 5750 Laptop for testing.

It looks like it switch to an default-player, and not the dr.dk´s flash-player. but it works!!

self.webview = WebKit.WebView()

#gets webview.get_settings object.
self.browser_settings = self.webview.get_settings()

self.browser_settings.set_property('user-agent', 'Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10')

self.webview.set_settings(self.browser_settings)

NB: If I try with user-agent like this Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:14.0) Gecko/20100101 Firefox/14.0.1 Then the video runs slow and do NOT work !!

share|improve this answer

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.