Re: [sugar] Using threads in an Activity
On Sun, Jul 20, 2008 at 4:26 AM, Shikhar [EMAIL PROTECTED] wrote: Hi, I am trying to use threads in my activity. However, the UI locks up while the thread runs. Actually, it is somewhat strange what happens: the thread is already initialized and running, waiting on a Queue for a work request. After I make a request, this is when the UI locks up (although the request completes) I have tried both gtk.gdk.threads_init() and gobject.threads_init() in my activity initialization before I call super I think you need to do it earlier, in the module scope. HTH, Tomeu ___ Sugar mailing list Sugar@lists.laptop.org http://lists.laptop.org/listinfo/sugar
Re: [sugar] Using threads in an Activity
Here is some code which runs multiple threads successfully on an xo. Look for ServerThread: http://mediamods.com/public-svn/map-activity/Map.activity/map.py On Sat, Jul 19, 2008 at 10:26 PM, Shikhar [EMAIL PROTECTED] wrote: Hi, I am trying to use threads in my activity. However, the UI locks up while the thread runs. Actually, it is somewhat strange what happens: the thread is already initialized and running, waiting on a Queue for a work request. After I make a request, this is when the UI locks up (although the request completes) I have tried both gtk.gdk.threads_init() and gobject.threads_init() in my activity initialization before I call super What am I missing? Hope not being very inane... Thanks, Shikhar http://lists.laptop.org/listinfo/sugar ___ Sugar mailing list Sugar@lists.laptop.org http://lists.laptop.org/listinfo/sugar
Re: [sugar] Using threads in an Activity
Hi Shikar, You might want to look at how James Simmons uses threads in his ReadEtexts Activity to do speech synthesis using a thread too.. http://dev.laptop.org/git?p=activities/readetexts;a=blob;f=ReadEtextsActivity.py;h=c8c7086a4dd9448a2f81b96150dcb551c6d5d217;hb=HEAD Around line 56 or so... Hope it helps :) Best, Hemant ___ Sugar mailing list Sugar@lists.laptop.org http://lists.laptop.org/listinfo/sugar
Re: [sugar] Using threads in an Activity
Thank you for all the replies, I fixed the problem by simplifying things a little, the code examples helped :-) ___ Sugar mailing list Sugar@lists.laptop.org http://lists.laptop.org/listinfo/sugar
[sugar] Using threads in an Activity
Hi, I am trying to use threads in my activity. However, the UI locks up while the thread runs. Actually, it is somewhat strange what happens: the thread is already initialized and running, waiting on a Queue for a work request. After I make a request, this is when the UI locks up (although the request completes) I have tried both gtk.gdk.threads_init() and gobject.threads_init() in my activity initialization before I call super What am I missing? Hope not being very inane... Thanks, Shikhar ___ Sugar mailing list Sugar@lists.laptop.org http://lists.laptop.org/listinfo/sugar
Re: [sugar] Using threads in an Activity
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Shikhar wrote: | What am I missing? Where's the code? The Distance activity uses threads, gtk, and dbus without any problem, so that may be a good reference code. - --Ben -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkiCozMACgkQUJT6e6HFtqTGZwCfb0VFmJbJbKV/BNzCWcz/M9z9 yu0AniAIRZHqB/4YycDBq5yi0XRpcqsw =nEdg -END PGP SIGNATURE- ___ Sugar mailing list Sugar@lists.laptop.org http://lists.laptop.org/listinfo/sugar