Re: GUI freeze and long blocking operation

2013-06-15 Thread jcupitt
On 15 June 2013 01:33, Kip Warner k...@thevertigo.com wrote: as a last resort. Maybe you have some debugging tips? I'm finding it hard to debug in Python compared to all the many frontends to GDB for native code. I never found the Python debuggers very useful. Event-driven programs are not a

Re: GUI freeze and long blocking operation

2013-06-15 Thread Kip Warner
On Sat, 2013-06-15 at 09:54 +0100, jcup...@gmail.com wrote: I never found the Python debuggers very useful. Event-driven programs are not a great fit with traditional debuggers, in my opinion, because execution is so non-linear. You are running tiny scraps of code all over the place in an

Re: GUI freeze and long blocking operation

2013-06-14 Thread Tristan Van Berkom
On Fri, Jun 14, 2013 at 8:28 AM, Kip Warner k...@thevertigo.com wrote: On Thu, 2013-06-13 at 08:59 +0100, jcup...@gmail.com wrote: Hi Kip, Hey John, There are two easy ways to do a long operation in Python. First, with idle_add(). Your callback should run for no more than 50ms or so

Re: GUI freeze and long blocking operation

2013-06-14 Thread Kip Warner
On Fri, 2013-06-14 at 15:08 +0900, Tristan Van Berkom wrote: On Fri, Jun 14, 2013 at 8:28 AM, Kip Warner k...@thevertigo.com wrote: On Thu, 2013-06-13 at 08:59 +0100, jcup...@gmail.com wrote: Hi Kip, Hey John, There are two easy ways to do a long operation in Python. First, with

Re: GUI freeze and long blocking operation

2013-06-14 Thread jcupitt
On 14 June 2013 07:29, Kip Warner k...@thevertigo.com wrote: Hey Tristan. I see what you mean, but I think I should have provided more code to show that what I was actually doing I think was what your followup suggestion was. Namely do some short work, update the GUI, do some more short work,

Re: GUI freeze and long blocking operation

2013-06-14 Thread Kip Warner
On Fri, 2013-06-14 at 10:22 +0100, jcup...@gmail.com wrote: From a quick look your code ought to work. I've written stuff very like this which works fine. Hey John. Yeah, I'm stumped too. I think you'll need to make a complete example I can try running, sorry. Coming up with a minimal for

Re: GUI freeze and long blocking operation

2013-06-13 Thread jcupitt
Hi Kip, On 13 June 2013 06:40, Kip Warner k...@thevertigo.com wrote: If I start the long job function from within my assistant's prepare signal callback, as opposed to en-queueing it there via idle_add(), then the GUI doesn't refresh throughout the duration of the long job. This happens even

Re: GUI freeze and long blocking operation

2013-06-13 Thread Kip Warner
On Thu, 2013-06-13 at 08:59 +0100, jcup...@gmail.com wrote: Hi Kip, Hey John, There are two easy ways to do a long operation in Python. First, with idle_add(). Your callback should run for no more than 50ms or so before returning. If you need to do more work than that, just wait to be

Re: GUI freeze and long blocking operation

2013-06-12 Thread jcupitt
On 12 June 2013 01:52, Kip Warner k...@thevertigo.com wrote: My GtkAssistant on one page in particular performs a long operation which would otherwise block the GUI from refreshing, if it were not for intermittent... while Gtk.events_pending(): Gtk.main_iteration() To

Re: GUI freeze and long blocking operation

2013-06-12 Thread Kip Warner
On Wed, 2013-06-12 at 09:50 +0100, jcup...@gmail.com wrote: Do you need to use idle_add()? Hey John, If I start the long job function from within my assistant's prepare signal callback, as opposed to en-queueing it there via idle_add(), then the GUI doesn't refresh throughout the duration of