Re: Updating GUI during long operation

2013-04-27 Thread Kip Warner
On Fri, 2013-04-26 at 20:22 -0700, Simon Feltman wrote: > To clarify, Python threading is probably the wrong tool for CPU bou d > operations unless those operations free up the GIL. This might be, but ideally this is really something the designers of the various interpreters should be more concer

Re: Updating GUI during long operation

2013-04-26 Thread Simon Feltman
On Fri, Apr 26, 2013 at 6:16 AM, Colomban Wendling < lists@herbesfolles.org> wrote: > That's weird. However, although I don't know much about Python > threading (and another guy in this thread suggests it's not really > good), I'm wondering whether your thread couldn't be simply locking > stu

Re: Updating GUI during long operation

2013-04-26 Thread Kip Warner
On Fri, 2013-04-26 at 13:52 +0200, Nicola Fontana wrote: > gdk_threads_add_idle() is only a convenient way of calling > g_idle_add() > without the need of decorating the callback code with a > gdk_threads_enter()/gdk_threads_leave() pair: > > http://developer.gnome.org/gdk/stable/gdk-Threads.html#

Re: Updating GUI during long operation

2013-04-26 Thread Kip Warner
On Fri, 2013-04-26 at 15:16 +0200, Colomban Wendling wrote: > That's weird. However, although I don't know much about Python > threading (and another guy in this thread suggests it's not really > good), I'm wondering whether your thread couldn't be simply locking > stuff used by both GUI and worke

Re: Updating GUI during long operation

2013-04-26 Thread Colomban Wendling
Le 26/04/2013 03:59, Kip Warner a écrit : > On Sat, 2013-04-20 at 18:54 +0200, Colomban Wendling wrote: >> Just never do something time consuming in the main loop thread. If you >> don't there should not be any lag. > > Hey Colomban. The time consuming task is in its own separate thread, but >

Re: Updating GUI during long operation

2013-04-26 Thread Nicola Fontana
Il Fri, 26 Apr 2013 02:24:01 -0700 Kip Warner scrisse: > On Thu, 2013-04-25 at 22:18 -0700, Simon Feltman wrote: > > > Similarly, use > > Gdk.threads_add_idle instead of GObject.idle_add for scheduling GUI updates > > from worker threads. The necessity of these is still somewhat unclear to me > >

Re: Updating GUI during long operation

2013-04-26 Thread Kip Warner
On Thu, 2013-04-25 at 22:18 -0700, Simon Feltman wrote: > A brief look at the source and it seems there is nothing calling > Gdk.threads_init which I think is needed. Hey Simon. I'm actually calling GObject.threads_init() over in Main.py. I've been told by others that this is enough, whereas othe

Re: Updating GUI during long operation

2013-04-26 Thread Kip Warner
On Fri, 2013-04-26 at 10:14 +0100, Lucas Levrel wrote: > Maybe do you "only" need to lower the worker priority? I think OSes by > default set new threads to the same priority as the spawner. Hey Lucas. Great idea, and I'd love to do that. My worker thread is derived from a Python threading.Thread.

Re: Updating GUI during long operation

2013-04-26 Thread Kip Warner
On Thu, 2013-04-25 at 20:54 -0600, Michael Torrie wrote: > As both Chris and Colomban have state, triggering an event flush isn't > going to help. If the events are already getting filed up, trying to > flush them isn't going to work. You have to figure out why the events > are piling up. Becaus

Re: Updating GUI during long operation

2013-04-25 Thread Simon Feltman
On Sat, Apr 20, 2013 at 4:25 PM, Kip Warner wrote: > A brief look at the source and it seems there is nothing calling Gdk.threads_init which I think is needed. Similarly, use Gdk.threads_add_idle instead of GObject.idle_add for scheduling GUI updates from worker threads. T

Re: Updating GUI during long operation

2013-04-25 Thread Michael Torrie
On 04/25/2013 08:04 PM, Kip Warner wrote: > Hey Chris. Your message was not very useful again, but thanks anyways. > As you realized after, the problem may be too many graphical related > events through the main loop. I will try adjusting the animation's > framerate and seeing if I can get the work

Re: Updating GUI during long operation

2013-04-25 Thread Kip Warner
On Thu, 2013-04-25 at 22:53 -0400, Allin Cottrell wrote: > I have a situation which might, perhaps, be akin to yours. From the > GUI, my app calls an iterative numerical procedure that can be quite > time consuming. Without any special treatment, this causes the GUI > to appear "frozen" and unre

Re: Updating GUI during long operation

2013-04-25 Thread Allin Cottrell
On Thu, 25 Apr 2013, Kip Warner wrote: I will try adjusting the animation's framerate and seeing if I can get the worker thread to give a breather to the main thread which seems to be working when using an idle_add() callback to trigger an event flush. I have a situation which might, perhaps

Re: Updating GUI during long operation

2013-04-25 Thread Kip Warner
On Sun, 2013-04-21 at 11:33 +0100, Chris Vine wrote: > The code to which you refer does not block, so something else is > blocking the loop. The point you need to understand is that in normal > code there will very rarely be a reason to call "while > Gtk.events_pending(): Gtk.main_iteration()" in a

Re: Updating GUI during long operation

2013-04-25 Thread Kip Warner
On Sat, 2013-04-20 at 18:54 +0200, Colomban Wendling wrote: > Just never do something time consuming in the main loop thread. If you > don't there should not be any lag. Hey Colomban. The time consuming task is in its own separate thread, but it's making a GIF animation lag and user interface r

Re: Updating GUI during long operation

2013-04-21 Thread Chris Vine
On Sun, 21 Apr 2013 11:33:45 +0100 Chris Vine wrote: > On Sat, 20 Apr 2013 16:25:50 -0700 > Kip Warner wrote: > > On Sat, 2013-04-20 at 23:35 +0100, Chris Vine wrote: > > > If you have a main loop running, this is completely unnecessary, > > > unless you are doing something to block the loop, whi

Re: Updating GUI during long operation

2013-04-21 Thread Chris Vine
On Sat, 20 Apr 2013 16:25:50 -0700 Kip Warner wrote: > On Sat, 2013-04-20 at 23:35 +0100, Chris Vine wrote: > > If you have a main loop running, this is completely unnecessary, > > unless you are doing something to block the loop, which you > > shouldn't do. > > Hey Chris. Although your response

Re: Updating GUI during long operation

2013-04-20 Thread Kip Warner
On Sat, 2013-04-20 at 23:35 +0100, Chris Vine wrote: > If you have a main loop running, this is completely unnecessary, unless > you are doing something to block the loop, which you shouldn't do. Hey Chris. Although your response was not particularly constructive, I'll give you the benefit of the

Re: Updating GUI during long operation

2013-04-20 Thread Chris Vine
On Sat, 20 Apr 2013 09:10:11 -0700 Kip Warner wrote: > Hey list, > > I have a separate thread from the main loop that performs some long > and resource intensive operation. The GUI displays an animated GIF > while this process takes place via Gdk.PixbufAnimation. > > Sometimes the animation an

Re: Updating GUI during long operation

2013-04-20 Thread Colomban Wendling
Hi, Le 20/04/2013 18:10, Kip Warner a écrit : > Hey list, > > I have a separate thread from the main loop that performs some long and > resource intensive operation. The GUI displays an animated GIF while > this process takes place via Gdk.PixbufAnimation. > > Sometimes the animation and the re