[pygtk] Yet another threads problem

Adolfo González Blázquez listas at infinicode.org
Mon Feb 18 21:19:36 WST 2008


El s=E1b, 16-02-2008 a las 14:19 +1300, John Stowers escribi=F3:
> On Fri, 2008-02-15 at 14:05 +0100, Adolfo Gonz=E1lez Bl=E1zquez wrote:
> > Hello,
> > =

> > I'm writing a little app that needs 2 windows, a main window, and
> > another for entering data. I'm writing it using Glade, so both windows
> > are defined in one glade file. The second one, emulates a entry dialog,
> > and is modal.
> > =

> > My problem is that i want the second window displayed when i click in a
> > button in the main window, and then, when i press "Close" in the second
> > window, get the text and do some things, and update the main window
> > status bar.
> =

> I dont quite understand you here, it doesnt sound like a threads issue,
> more a design issue.
> =

> When I want to return stuff from a dialog I typically create my own
> dialog subclass [1] which returns a tuple of the dialog specific
> information from the (overridden run method). For example (excuse broken
> pseudocode)
> =

> class MyDialog(gtk.Dialog)
>      def __init__(self, setting1, setting2, setting3)
>          #call super
>          #save old settings
>          self.oldsetting1 =3D setting1
>          ...etc
>          #construct dialog
>          self.widget1 =3D gtk.Entry()
>          self.widget1.set_text(setting1)
>          ...etc
>          =

>      def run(self):
>          if gtk.Dialog.run(self) =3D=3D gtk.RESPONSE_OK:
>               setting1 =3D self.widget1.get_text()
>               setting2 =3D self.widget2.get_text()
>               setting3 =3D self.widget3.get_text()
>               return setting1, setting2, setting3
>          else:
>               return self.oldsetting1, self.oldsettin2, self.oldsetting3
> =

> then run it with
> dialog =3D MyDialog(a,b,c)
> a,b,c =3D dialog.run()
> dialog.distroy()

Well, I've subclassed gtk.Dialog as you point, and I'm still having the
same issue.

I run the dialog, enter the data and click OK. Then it was supposed to
hide the dialog, and update the statusbar while things are happening,
but in fact the gui freezes till the end.

The related code is here:
http://pastebin.com/mb2ea398

And a screencast of what is happening in here:
http://www.infinicode.org/code/out.ogg

Any idea?

> =

> Regards,
> =

> John
> =

> [1] http://davyd.livejournal.com/237414.html
> =

> > =

> > Here's a screencast of what i'm doing:
> > http://www.infinicode.org/code/out.ogg
> > =

> > What it was supposed to do is:
> > - Open the add window
> > - Enter the text and click close
> > - The add window closes
> > - In the main window status bar appears "Conectando..."
> > - The status bar changes to "Conectado!"
> > - A error dialog appers
> > =

> > Relevant code here:
> > http://pastebin.com/f6bf4e71b
> > =

> > =

> > Thanks in advance for any help
> > =

> > -- adolfo
> > _______________________________________________
> > pygtk mailing list   pygtk at daa.com.au
> > http://www.daa.com.au/mailman/listinfo/pygtk
> > Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
> =

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Esta parte del mensaje =3D?ISO-8859-1?Q?est=3DE1?=3D firmada
	digitalmente
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20080218/aa6f2ad2/a=
ttachment.pgp


More information about the pygtk mailing list