Hello all,

I've been having a ton of trouble with this custom gtk dialog I am
trying to create. The code "runs" however I receive a GtkWarning message
saying:

/home/maddog39/Projects/mmoalert/actiondialog.py:42: GtkWarning: 
gtk_box_pack_end: assertion `child->parent == NULL' failed
  self.message_hbox.pack_end(self.message_entry)

For the life of me, I can't seem to figure out what going on and why
this is happening. As usual, its probably something very simple that
keeps passing by me. Here's the code for the dialog.


import gtk, utils

ACTIONDIALOG_TYPE_ADD  = 0
ACTIONDIALOG_TYPE_EDIT = 1

class ActionDialog(gtk.Dialog):
        def __init__(self, type, app, title=None, content=None):
                gtk.Dialog.__init__(self, None, None, gtk.DIALOG_MODAL)
                
                if type == ACTIONDIALOG_TYPE_ADD:
                        self.set_title("Add New Article")
                else:
                        self.set_title("Edit Article")
                
                # Setup dialog widgets
                self.title_label = gtk.Label("Title")
                self.title_entry = gtk.Entry(max=180)
                self.message_label= gtk.Label("Message")
                self.message_entry = utils.TextField()
                self.message_entry.set_wrap_mode(gtk.WRAP_WORD)
                
                # Fill fields with data if in edit mode
                if title != None and content != None:
                        self.title_entry.set_text(title)
                        self.message_entry.set_text(content)
                
                # Create boxes to hold widgets
                self.title_hbox = gtk.HBox()
                self.title_hbox.pack_start(self.title_label)
                self.title_hbox.pack_end(self.title_entry)
                self.message_hbox = gtk.HBox()
                self.message_hbox.pack_start(self.message_label)
                self.message_hbox.pack_end(self.message_entry)
                # DEBUG: not working properly
                # Pack Widgets into vertical box
                self.vbox.pack_start(self.title_hbox)
                self.vbox.pack_start(self.message_hbox)
                
                # Add the buttons to the dialog
                self.add_button(gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT)
                self.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)


Help much appreciated.

Thanks!
-- 
Alec Hussey

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

Reply via email to