On 21/08/2003 6:04 AM, Ben Liblit wrote:

I am trying to create a simple CORBA service in Python. I'd like to use Bonobo where appropriate to simplify activation. The service has a standalone PyGTK GUI, but is not intended for embedding via bonobo.ui.Component.

<http://www.pycage.de/howto_bonobo.html> has gotten me off to a good start, but unfortunately, the only code examples I can find use widget embedding via bonobo.ui.Component.

I've got my OAF .server file, with an "exec" entry for the factory and a "factory" entry for the service itself. I've got my .idl file, and the typelib built from it. My server imports the typelib and creates the factory. But when a client requests a server object, I get a Bonobo.GeneralError exception. :-(

From "sampler.server":

  ...
  <oaf_server iid="OAFIID:SamplerUploader_Factory:www.cs.berkeley.edu"
    type="exe"
    location="server">

    <oaf_attribute name="repo_ids" type="stringv">
      <item value="IDL:Bonobo/GenericFactory:1.0"/>
      <item value="IDL:Bonobo/Unknown:1.0"/>
    </oaf_attribute>

</oaf_server>

  <oaf_server iid="OAFIID:SamplerUploader:www.cs.berkeley.edu"
    type="factory"
    location="OAFIID:SamplerUploader_Factory:www.cs.berkeley.edu">

    <oaf_attribute name="repo_ids" type="stringv">
      <item value="IDL:Sampler/Uploader:1.0"/>
      <item value="IDL:Bonobo/Unknown:1.0"/>
    </oaf_attribute>

</oaf_server>


From "sampler.idl":


    module Sampler {
        interface Uploader : Bonobo::Unknown { ... };
    };

From my server script:

ORBit.load_typelib('sampler')

    import CORBA
    import Sampler__POA

...

    class Uploader(Sampler__POA.Uploader):
        ....

def uploader_factory(factory, iid)
print 'called uploader_factory'
return Uploader()

the Uploader object here is a Servant object, while the factory function is required to return a bonobo.Object instance. It is currently not possible to do this for custom interfaces in Python.


There is some new APIs that will be in the Gnome 2.4 version of libbonobo that will make it easy to aggregate a custom interface implemented in Python with a C bonobo.Object. Gustavo also has some Python code to make use of this API. However, I want to get gnome-python-2.0 out before looking at these new APIs (which should hopefully happen soon).

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to