How make a full screen Flash activity opened using hulahop.webview.WebView close from Flash?

Gonzalo Odiard gonzalo at laptop.org
Thu May 16 10:47:42 EDT 2013


Do you need your activity run in old Sugar versions?
Because hulahop is deprecated, and new Browse use webkit.

Gonzalo


On Thu, May 16, 2013 at 11:40 AM, Frank Cancio <frank at gsc.uy> wrote:

> Hi all,
>
> I have Flash activity in which all user interaction is done through
> Flash. Basically what I did was create a hulahop.webview.WebView
> instance and make it load a HTML (see code at the end) that load a
> .swf file in full screen. So far so good, the problem come when I try
> close the entire activity from inside Flash UI (with a close button).
>
> One solution I saw was try to enable the "window.close();" JavaScript
> sentence and then from the Flash app "execute it". I create a simple
> HTML file with just a button and a "window.close();" in the onclick
> event and make it work using the Browse activity. For that, I changed
> the gecko profile used by the Browse activity (setting the variable
> "dom.allow_scripts_to_close_windows" to true). That made possible
> close the entire Browse activity using the "window.close();"
> JavaScript sentence.  I did the same with my activity but nothing,
> even I made it using the same profile that worked for the Browse
> activity, but the "window.close();" JavaScript sentence don't work in
> my activity.
>
> I think that the problem is related to the way my activity manager the
> hulahop.webview.WebView instance. I know Python but I'm a completely
> newbie in GTK, Sugar and hulahop, and  is hard to me find out the
> problem. I write to this list hoping that someone with the enough
> experience in those tech could take few minutes and help me.
>
> Thanks in advance
> Frank
>
> hulahop.startup(os.path.join(env.get_profile_path(), 'gecko'))
> from hulahop.webview import WebView
>
> HTML = os.getcwd()+'/index.html'
>
> class SierratestActivity(activity.Activity):
>         def __init__(self, handle):
>                 activity.Activity.__init__(self, handle, False)
>
>                 canvas = gtk.HBox()
>                 self.set_canvas(canvas)
>
>                 self.browser = WebBrowser()
>
>                 canvas.pack_start(self.browser.getBrowser(),True,True,0)
>                 self.connect("destroy", self.destroy)
>                 self.show_all()
>
>         def destroy(self, widget=None):
>                 sys.exit(0)
>
>
> class WebBrowser():
>         def __init__(self):
>                 self.browser = None
>
>         def getBrowser(self):
>                 self.browser = WebView()
>                 self.browser.load_uri(HTML)
>
>
>
> return self.browser
> _______________________________________________
> Devel mailing list
> Devel at lists.laptop.org
> http://lists.laptop.org/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.laptop.org/pipermail/devel/attachments/20130516/0c5a38f4/attachment.html>


More information about the Devel mailing list