Re: [Orbit-python-list] Bonobo control example
Status: Inactive
Brought to you by:
tack
From: Johan D. <zil...@ho...> - 2001-08-28 10:47:24
|
Hi. I attached 4 files: container.py: Container ipctrl.py: Component with a control gtkipentry: Your class. And the thing that your forgot: GNOME_BonoboTutorial_IPCtrl_Control.oaf Bonobo uses oaf for activation of objects. This is done by a daemon, called oafd. Everytime you use a component you must have i registred in oaf. To add your own component, create an .oaf file. In this example we'll need two oaf servers, A factory which is used to create objects and a control. The factory is called GNOME_BonoboTutorial_IPCtrl_ControlFactory and the control is called GNOME_BonoboTutorial_IPCtrl_Control. Oaf searches in $prefix/share/oaf for servers. If you want you can specify new search locations by adding : separeted fields in the OAF_INFO_PATH environment variable. Lets have a closer look at the oaf file. First create an oaf_server, with an iid, type could be factory, shlib or exe, in python we're currently limited to factory and exe. Location is used so oafd know where it can find the component, so if you don't add the path you'll have to modify the PATH and kill oafd, eg. export PATH=$PATH:`pwd` killall oafd <oaf_server iid="OAFIID:GNOME_BonoboTutorial_IPCtrl_ControlFactory" type="exe" location="ipctrl.py"> This is a factory and must support GNOME/ObjectFactory interface <oaf_attribute name="repo_ids" type="stringv"> <item value="IDL:GNOME/ObjectFactory:1.0"/> </oaf_attribute> Name of the component... <oaf_attribute name="name" type="string" value="Sample control factory"/> ... and description. <oaf_attribute name="description" type="string" value="Factory for the sample control"/> </oaf_server> And for the component: Note that the name is ...Control, type is factory because the control is launched through our factory... and location points at our factory. <oaf_server iid="OAFIID:GNOME_BonoboTutorial_IPCtrl_Control" type="factory" location="OAFIID:GNOME_BonoboTutorial_IPCtrl_ControlFactory"> All components must suport Bonobo/Unknown. Our component does also support Bonobo/Control since it's a gui component. <oaf_attribute name="repo_ids" type="stringv"> <item value="IDL:Bonobo/Unknown:1.0"/> <item value="IDL:Bonobo/Control:1.0"/> </oaf_attribute> <oaf_attribute name="name" type="string" value="A Sample control in python"/> <oaf_attribute name="description" type="string" value="A sample Bonobo control."/> </oaf_server> So. Copy all 4 files to a directoy. export PATH=$PATH:`pwd` export OAF_INFO_PATH=$OAF_INFO_PATH:`pwd` export OAF_DEBUG_OUTPUT=1 killall -9 oafd You'll have to kill oafd to make oaf use the new variables. OAF_DEBUG_OUTPUT is also a good idea so you can see what's going on. Nothing silly about the questrions, since you probably newer heard of oaf before :) -- ------------------------------------------------- - Johan Dahlin Address: - - zi...@as... Nygatan 17, nb - - zil...@ho... 523 30 Ulricehamn - - PHONE: +46 (0)321-17559 SWEDEN - - IRC: zilch @ irc.gnome.org - ------------------------------------------------- |