On Fri, 26 Feb 1999, James Henstridge wrote:
> Do you get the same errors if you call set_active before connecting to its
> signals? That is what I usually do. The way you have your code, that
> page of the property box will always look as if it has had changes applied
> to it, since the call to changed() will always be made.
Didn't try that, perhaps I will...
I allways like to read how you see things, the statments you say are
logical but I never thinked of that...
>
> As for the segfault, at the time when you call set_active(), had you added
> any pages to the property box? My guess is that the segfault was caused
> because there wasn't an `active page'.
You are absolutly right !!!!!!!!!!!!!!!!
Below is a mail I send yesterday to Richad Fish, I describe how the bug
desapears if I update AFTER I used the append_page method.
The thing that bugs me is that I enclose an example where I couldn't
repeat the segfault , It work's perfectly even if a try to update the
buttons BEAFORE I use the append_page.
It's very reconforting that you could have helped me if I couldn't have
found a way to avoid the segfault.
Thanks James !!!!!!! :-)
--------------------------- MAIL TO RICHARD FISH ------------------------
>From [EMAIL PROTECTED] Fri Feb 26 10:52:55 1999
Date: Thu, 25 Feb 1999 13:12:28 -0600 (CST)
From: [EMAIL PROTECTED]
To: Richard Fish <[EMAIL PROTECTED]>
Subject: Re: [pygtk] I can't make work set_active
Thanks a lot for your reply...
> Well, I can't duplicate your problem with the following code:
That's why I put all the program at
ftp://uxmcc3.iimas.unam.mx/pub/gvoice/gvoice_bug.tar.gz
> Note that when you set_active, it is probably triggering the callback to
> properties_box.changed, and something there could be causing your core
> dump. What does properties_box.changed do?
I don't have anything hooked to properties_box.changed It only does the
default think, put's active the "ok" and "apply" butons....
Anyway I more or less fixed the segfault in a dirty way:
The way I had the program before I instanced the Radiobuttons in a GtkVBox
then updated them with set_active and then I packed the hole thing in a
a GnomePropertyBox.
Now I instance the Radiobuttons in a GtkVBox, then packe the hole thing
in a GnomePropertyBox and I update then AFTER y run the GnomePropertyBox
method "append_page" and everything work's find :
class Properties_win(GnomePropertyBox):
#"""Window for setting properties
#
#This is initialized with a Voice object
#"""
def __init__(self,voice_instance):
GnomePropertyBox.__init__(self)
self.voice_instance = voice_instance
self.connect('apply',self.changed_properties)
properties_label = GtkLabel("Audio Properties")
properties_label.show()
self.properties_box = Properties_box(self,voice_instance)
self.properties_box.show()
self.append_page(self.properties_box, properties_label)
self.properties_box.update_properties_box()
Hope you'll never run in a problem like this. I don't know if it is a bug,
but It's very weird because, I tried to make a simple example to repeat
the segfault but it work's find even if I make the update BEFORE the
"append.page".
#-----------------------------------------CUT HERE-----------------------
#!/usr/bin/env python
from gtk import *
from gnome.ui import *
class Bit_num(GnomePropertyBox):
def __init__(self):
GnomePropertyBox.__init__(self)
properties_label = GtkLabel("Audio Properties")
properties_label.show()
self.properties_box = Properties_box()
self.properties_box.show()
self.append_page(self.properties_box, properties_label)
class Properties_box(GtkVBox):
def __init__(self):
GtkVBox.__init__(self)
bit_num_box = GtkHButtonBox()
self.pack_start(bit_num_box)
bit_num_box.show()
bit_label = GtkLabel()
bit_label.set_text("Choose sample size:")
bit_num_box.pack_start(bit_label)
bit_label.show()
self.bit_num_button16 = GtkRadioButton(None, "16 bits")
bit_num_box.pack_start(self.bit_num_button16)
self.bit_num_button8 = GtkRadioButton(self.bit_num_button16, "8 bits")
bit_num_box.pack_start(self.bit_num_button8)
self.bit_num_button8.show()
self.bit_num_button16.show()
change_active_box = GtkHButtonBox()
self.pack_start(change_active_box)
change_active_box.show()
set_active_16_button = GtkButton ("set_active_16_button")
set_active_16_button.connect("clicked", self.set_active_16)
change_active_box.pack_start(set_active_16_button)
set_active_16_button.show()
set_active_8_button = GtkButton ("set_active_8_button")
set_active_8_button.connect("clicked", self.set_active_8)
change_active_box.pack_start(set_active_8_button)
set_active_8_button.show()
self.bit_num_button8.set_active(1) # THIS IS THE LINE THAT MAKES
# MY APPLICATION DUMP A CORE
# BUT HERE IT WORKS FINE
def set_active_8(self,*args):
self.bit_num_button8.set_active(1)
def set_active_16(self,*args):
self.bit_num_button16.set_active(1)
class Debug_state(GnomeApp):
def dummy(self,*args):
pass
def create_properties(self,*args):
self.bit_num_box = Bit_num()
self.bit_num_box.show()
def define_menus(self):
self.configure_menu = [
UIINFO_ITEM_STOCK( 'Properties', None,
self.create_properties,STOCK_MENU_PROP)]
self.menu = [UIINFO_SUBTREE('Configure',self.configure_menu)]
def __init__(self):
GnomeApp.__init__(self,'set_active', 'set_active')
self.define_menus()
self.create_menus(self.menu)
self.connect('delete_event', mainquit)
#self.set_contents()
if __name__ == '__main__':
debug_state = Debug_state()
debug_state.show()
mainloop()
-------------------------------CUT HERE----------------------------------
Do you thinks It's worth mentioning it on the list?????
Thanks a lot for you reply...
Daniel Kornhauser
-------------------- MAIL TO RICHARD FISH --------------------------------
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]