ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> pyxpcom
pyxpcom
Re: [pyxpcom] queryInterface, browser, python and xul
by Mark Hammond other posts by this author
Jul 1 2007 9:50PM messages near this date
view in the new Beta List Site
[pyxpcom] queryInterface, browser, python and xul | Re: [pyxpcom] queryInterface, browser, python and xul
It may be that the method you want is not defined in an IDL file at all, but
with custom code supporting only JS.  For example, to implement an
openDialog() method, I ended up with code:

        svc = components.classes['@mozilla.org/embedcomp/window-watcher;1']
                .getService(components.interfaces.nsIWindowWatcher)
        # Wrap in an nsIArray with special support for Python being able to
        # access the raw objects if the call-site is smart enough
        args = _nsdom.MakeArray(args)
        ret = svc.openWindow(self._comobj_, url, name, features, args)
        # and re-wrap in one of our "dom" objects
        ...

Although this relies on features only in the nsdom code, the underlying
point is that you may be able to convince the window-watcher to do what you
need, but sadly I've no time to dig deeper into this today...

Cheers,

Mark

>  Hello.
>  Spent last night trying to figure out how to port mybrowser (
>  http://benjamin.smedbergs.us/xulrunner/mybrowser-0.2.2.xulapp ) from
>  JavaScript to Python.
>  It fails at LoadURI() - AttributeError: XPCOM component
>  '<unknown>' has
>  no attribute 'LoadURI'
>  I tried to get all available interfaces and blindly query
>  browser for them:
> 
>      browser = document.getElementById("browser")
>      for name, iid in components.interfaces.items():
>      try:
>              browser.queryInterface(iid)
>              dump(str(name)+'\n')
>      except:
>              donothing()
> 
>  Here is what i got:
> 
>  nsISupportsWeakReference
>  nsIObserver
>  nsIDOMXULElement
>  nsIDOM3Node
>  nsIDOM3EventTarget
>  nsIDOMEventTarget
>  nsIAccessibleProvider
>  nsIDOMNSEventTarget
>  nsIDOMElementCSSInlineStyle
>  nsIDOMNode
>  nsIDOMEventListener
>  nsIDOMNSElement
>  nsIClassInfo
>  nsISupports
>  nsIDOMElement
> 
>  Checked all of them, and it seems that none is capable of
>  anything that
>  browser is supposed to do (like, loading URI).
>  So...this is not implemented, or it's just my poor
>  Python/XPCOM skills?
>  _______________________________________________
>  pyxpcom mailing list
>  pyxpcom@[...].com
>  To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 

_______________________________________________
pyxpcom mailing list
pyxpcom@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Lord Ruslan Nightmare
Mark Hammond
Shane Caraveo

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved