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] Wrapping an existing python module with PyXPCOM
by Cyril Giraudon other posts by this author
Feb 26 2007 10:32AM messages near this date
view in the new Beta List Site
Re: [pyxpcom] Wrapping an existing python module with PyXPCOM | [pyxpcom] problem creating mouse events from pyxpcom
Thanks Ed,
>  So yes, you are forced to provide well-defined interfaces, which means
>  that you have to expose all the functionality of titi/toto in an .idl
>  file as well as the corresponding .py..  I'm not sure I get what you
>  were doing in your second solution because xptit would still have to
>  wrap and expose all the functionality of titi, just as you complained
>  about in your first solution..
With the second solution, I have tried to split the "big" component into 
several more little components.
I use a global variable.
The main component xptoto would :
1 set the value of the global variable TMP to xptoto.titi
2 create xptiti which sets ( in __init__() ) xptiti.titi to TMP
3 return xptiti
Finally, we find the same interface as the original python module.

The main problem is to create an "little" xptiti component which can 
communicate with xptoto.titi.

With a huge component, each windows has to grab a reference of this
component, even the sub sub sub window which manipulates a deep object.

For instance :
With a python shell, we would write :
w = window(toto.getTiti().getTutu().color), and change the color inside 
w with
color = "red"

With XPCOM :
w = window(xptoto)
and use xptoto.titiTutuColor = "red" inside w.

The second solution of the preceding message allows the same technique 
as python.
w = window(toto.getTiti().getTutu().color)

The windows model is reusable.

>    But in any case, if you're worried
>  about wrapping the whole module, you can probably write a quick script
>  (if one doesn't already exist) to wrap all the functionality for you..
>  A quick hack would be to import tito and then call and parse
>  help(tito), 
My problem is not really mapping the whole module, I 'd like to be sure 
it's the right
way to accomplish the job (solution 1 or 2 or another ?).

>  but I'm sure there is a more elegant solution using Python
>  Language Services..
> 
Yes, I'm sure. And it's this solution I 'd like learn.
For instance, if xptiti is subclass of titi ( class xptiti(titi) ), is 
there a solution to build
xptiti from xptoto.titi ?

>  Hope that helps..
> 
>  -Ed

Thanks a lot Ed.

Cyril.


_______________________________________________
pyxpcom mailing list
pyxpcom@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Cyril Giraudon
Lekma
Cyril Giraudon
Edward Baafi
Cyril Giraudon

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved