[pygtk] Whole App Cursor Setting

2005-10-28 Thread Loris Caren
I'm trying to put up a watch cursor while my app is busy. I've found 
how to do it for one widget, but I really want to freeze up the whole 
GUI.  http://www.daa.com.au/pipermail/pygtk/2000-October/000435.html
looks just what I'm after. However, it seems to have suffered from 
software ageing and half the calls don't seem to be present (in 
2.6.2). Can anybody offer a current equivalent of his fragment?
___
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/


Re: [pygtk] gtk threading tutorial.

2005-10-28 Thread Antoon Pardon
On Thu, Oct 27, 2005 at 07:47:41AM -0700, Brian wrote:
 On Thu, 2005-27-10 at 14:06 +0200, Antoon Pardon wrote:
  I have written a small gtk threading tutorial with a number
  of demo's and an (IMO) helpfull module. I don't fancy
  myself to be a good writer, but I thought the demo's
  would make up for that. Let me know what you think.
  
  http://www.pardon-sleeuwaegen.be/antoon/python/page0.html
  
 
 That is a nice tutorial.  I have not had a chance to study it in detail,
 but from looking at your iotube.py and idletube.py scripts I think they
 might be more complex than needed.

Well that depends on your point of view. Originally the tube idea
wasn't gtk related. I was just not satisfied with what Queues
gave us.

 I will study it more later.  Attached
 is the dispatcher.py script that another developer on our project came
 up with and I tweaked a little and has been working very good for us.

Well I don't doubt that.

 The dispatcher instance can be based from any thread and allows a
 queue'd set of data arguments to be passed back to it without collision.
 It is also very generic and most any python data types can be passed
 thru it.

Well I made a version of my demo program based on this dispatcher, it
is at http://www.pardon-sleeuwaegen.be/antoon/python/demo3c.py

Unfortunatly I managed to deadlock it. Could you have a look at it,
to see I'm using it as it is supposed to.

-- 
Antoon Pardon
___
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/


Re: [pygtk] gtk threading tutorial.

2005-10-28 Thread Brian
On Fri, 2005-28-10 at 14:35 +0200, Antoon Pardon wrote:

 
 Well I made a version of my demo program based on this dispatcher, it
 is at http://www.pardon-sleeuwaegen.be/antoon/python/demo3c.py
 
 Unfortunatly I managed to deadlock it. Could you have a look at it,
 to see I'm using it as it is supposed to.
 

A quick look thru (this morning before I go to work)...  You are using 1
global instance of Dispatcher for several threads.  That is where the
trouble is.  Several threads trying to access it at the same time will
deadlock it.  Instead pass each thread an instance of Dispatcher as
parameter for it's private use.  There is no need to assign an instance
to a variable name.


class Counting (Thread):

  def __init__(self, Id, dispatcher):
self.Id = Id
self.dispatcher = dispatcher
self.ctrl = True
self.Running = False
self.ShowMode = 0
self.Time = 0
self.Value = 250
self.lock = Lock()
self.lock.acquire()
self.PRG = Random()
Thread.__init__(self)
  #end __init__

snip

later replace:

gtkdispatch(self.Id, self.ShowTime, self.ShowValue)

with (2 spots): self.dispatcher(self.Id, self.ShowTime, self.ShowValue)

change:  Worker = [ Counting(i) for i in xrange(7) ]
to : Worker = [ Counting(i,Dispatcher(canvas.Adjust)) for i in xrange(7) ]

delete: gtkdispatch = Dispatcher(canvas.Adjust)

That should fix it.  Note:  untested,  gotta go I'm going to be late :)
-- 
Brian [EMAIL PROTECTED]

___
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/