Thread: [Orbit-python-list] Bonobo control example
Status: Inactive
Brought to you by:
tack
From: Michele C. <mol...@f2...> - 2001-08-28 07:36:48
|
Hi, back again with my silly questions... I was trying to translate the example from "On writing a Bonobo control" to Python and found that I cannot create a BonoboControl from a custom Python widget... well I can create the control, but the container cannot activate it. I have attached my experiments (please tell me if I'm annoying somebody with my attachements). All is working well if I create the control from a native Gtk+ widget (i.e. one implemented in the C extension), but using a Python class doesn't work... I have also tried to create a gtk.GtkWidget instance passing the object reference [ gtk.GtkWidget(_obj = w._o) ] but that didn't worked either... -- Michele - www.moleskine.f2s.com |
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 - ------------------------------------------------- |
From: Michele C. <mol...@f2...> - 2001-08-28 11:01:59
|
Johan Dahlin wrote: > And the thing that your forgot: > GNOME_BonoboTutorial_IPCtrl_Control.oaf I didn't included it because it the same file from the tutorial. > Bonobo uses oaf for activation of objects. > This is done by a daemon, called oafd. [... snipped lots of good info...] > 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. Didn't know about OAF_DEBUG_OUTPUT, thanks. > Nothing silly about the questrions, since you probably newer heard > of oaf before :) I did know OAF and I also restarted it thousands of times to make my control work, but with no success (it wilked with a GtkLabel or a plain GtkEntry, though). Have you run the scripts? There is a syntax error in container.py: def create_app (): window = bonobo.BonoboWindow ('ipctrl-container', 'a container for ipctrl's') there are three "'"! ;o) -- Michele - www.moleskine.f2s.com |
From: Johan D. <zil...@ho...> - 2001-08-28 11:04:40
|
tis 2001-08-28 klockan 13.04 skrev Michele Campeotto: > Johan Dahlin wrote: > > And the thing that your forgot: > > GNOME_BonoboTutorial_IPCtrl_Control.oaf > > I didn't included it because it the same file from the tutorial. > Okay, but you would still have to change location in your factory, to point it at control.py > > Bonobo uses oaf for activation of objects. > > This is done by a daemon, called oafd. > [... snipped lots of good info...] > > 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. > > Didn't know about OAF_DEBUG_OUTPUT, thanks. > > > Nothing silly about the questrions, since you probably newer heard > > of oaf before :) > > I did know OAF and I also restarted it thousands of times to make my > control work, but with no success (it wilked with a GtkLabel or a plain > GtkEntry, though). > > Have you run the scripts? There is a syntax error in container.py: > def create_app (): > window = bonobo.BonoboWindow ('ipctrl-container', > 'a container for ipctrl's') > > there are three "'"! ;o) Oops, i just fixed it up to make it look nicer :) But yeah, i tried them. > -- ------------------------------------------------- - Johan Dahlin Address: - - zi...@as... Nygatan 17, nb - - zil...@ho... 523 30 Ulricehamn - - PHONE: +46 (0)321-17559 SWEDEN - - IRC: zilch @ irc.gnome.org - ------------------------------------------------- |
From: Michele C. <mol...@f2...> - 2001-08-28 11:09:29
|
Johan Dahlin wrote: >> I didn't included it because it the same file from the tutorial. > Okay, but you would still have to change location in your factory, to > point it at control.py Yes, I had ipctrl.py in /tmp and /tmp/ipctrl.py in the .oaf The main problem is that my scripts was working when usign a GtkLabel in ipctrl.py (see my original code, it works). Anyhow, will try yours when I get home. Thanks, Michele -- Michele - www.moleskine.f2s.com |
From: Johan D. <zil...@ho...> - 2001-08-28 11:12:35
|
tis 2001-08-28 klockan 13.12 skrev Michele Campeotto: > Johan Dahlin wrote: > >> I didn't included it because it the same file from the tutorial. > > Okay, but you would still have to change location in your factory, to > > point it at control.py > > Yes, I had ipctrl.py in /tmp and /tmp/ipctrl.py in the .oaf > The main problem is that my scripts was working when usign a GtkLabel > in ipctrl.py (see my original code, it works). > Anyhow, will try yours when I get home. > > Thanks, > Michele Oh, finally got it... So if you'd used OAF_INFO_PATH python would showed a traceback when it couldn't find gtkipentry module. -- ------------------------------------------------- - Johan Dahlin Address: - - zi...@as... Nygatan 17, nb - - zil...@ho... 523 30 Ulricehamn - - PHONE: +46 (0)321-17559 SWEDEN - - IRC: zilch @ irc.gnome.org - ------------------------------------------------- |
From: Michele C. <mol...@f2...> - 2001-08-28 18:32:12
|
Ok, your scripts (and mine, too) are working now. I was obviously doing something wrong when launching them. Still don't know what... Now I'm going to add property bags and listeners... hoping for the best... Thanks Johan -- -- Michele - www.moleskine.f2s.com "I haven't fucked much with the past, but I have fucked plenty with the future." -- Patti Smith, "Babelogue" |