I am not sure if this helps, but this is how I check missing fields (before submitting data to a database) using a gtkDialog:
def submitDB(self, widget):
while True:
try:
name = self.wTree.get_widget("entry1").get_text()
age = self.wTree.get_widget("entry2").get_text()
size = self.wTree.get_widget("entry3").get_text()
assert name != ""
assert age != ""
assert size != ""
dataUsr = name, age, size
sd = DBStuff.Eb_db(host, user, passwd, db)
sd.subMit(dataUsr)
break
except AssertionError:
self.wDialog = gtk.glade.XML("project2.glade", "dbWarningEmpty")
close = self.wDialog.get_widget("dbWarningEmpty")
response = close.run()
if response == gtk.RESPONSE_CLOSE:
close.destroy()
break
except DBStuff.MySQLdb.IntegrityError:
def callback():
self.wDialog = gtk.glade.XML("project2.glade", "dbWarningOverwrite")
close = self.wDialog.get_widget("dbWarningOverwrite")
response = close.run()
if response == gtk.RESPONSE_CANCEL:
close.destroy()
if response == gtk.RESPONSE_OK:
sd.delRow(name)
wd = DBStuff.Eb_db(host, user, passwd, db)
wd.subMit(dataUsr)
close.destroy()
callback()
break
bye,
Dimitri
On 6/3/05, Mark Cooke <[EMAIL PROTECTED]> wrote:
Hi,
Sorry if this may sound like a simple question, but I've just started
learning gtk/pygtk and still pretty sketchy.
I have a very small/basic app built using Glade, that has a gtk.Dialog
popup window (from a menu toolbar) that allows a user to enter some
details in a few text fields.
I'm then checking to see if they have clicked the OK button (by seeing
if the response is a gtk.RESPONSE_OK), and if they have check to see if
the fields contain the correct details, and if not display an error dialog.
The problem I'm having, is that once they has pressed the OK and if they
have missed any fields, and they then correct the missing fields,
pressing it a second time has no effect.
Is this the best way of dealing with this?
Thanks
Mark Cooke
_______________________________________________
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/
--
Please visit dimitri's website: www.serpia.com
_______________________________________________ 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/