Re: [pygtk] Use of gtk.threads_enter()

2003-01-24 Thread Oistein Aanensen
Use gtk.threads_enter() when you are inside a thread to every call to
gtk. Use it only in pair with gtk.threads_leave() when you are finished
interogating with gtk.

Why: Else will the program crash with segfault or X11 async.

Øistein

On Fri, 2003-01-24 at 14:25, Pablo Endres wrote:
 
   Hi Guys,
 
   I've been debugging an app and I think the problem
   comes from un inapropriate use of this insctruccion.
 
   I've checked around and found very little documentation
   about it.  Can anyone point me out on the correct use 
   of this instrction: when  why should I use it?
 
   thanks in advance
 
   Pablo
 
 
 -- 
 Muchas personas creen que piensan,
 cuando en realidad sólo están reordenando sus
 prejuicios.
 - William James
 
 Pablo Endres
 Centro de Datos
 
 GSM:  +584127347610
 
 
 ___
 pygtk mailing list   [EMAIL PROTECTED]
 http://www.daa.com.au/mailman/listinfo/pygtk
 Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



[pygtk] PrgressBar

2003-01-21 Thread Oistein Aanensen
Hi,


DeprecationWarning: use GtkProgressBar

Any idea why I'm getting this warning, i assume that I shall use
gtk.ProgressBar? I'm receiving this earing on the following lines in my
code:

self.progress.set_format_string(%v %%)
self.progress.set_show_text(1)

self.progress.set_percentage((size/totsize))


In addition to that the set_percentage method is crashing with a lot of
debug msg + a x async message. The set_percentage is called within a
thread. And yes, I'm using gtk.threads_enter, gtk,threads_leave around
it. I've also initialized gtk threads. The same applies for the
progress.update and progress.set_fraction.

I appreciate very much any ideas regarding this matter.

Best regards
Øistein Aanensen






___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



Re: [pygtk] TreeView and CellRenders

2003-01-14 Thread Oistein Aanensen
On Tue, 2003-01-14 at 09:44, James Henstridge wrote:
 Omar Kilani wrote:
 
 Hello,
 
 I was wondering if someone could advise on a way of doing conditional
 colouring of cells. Say I have:
 
 -|--|
  one | four |
 -|--|
  two | five |
 -|--|
 three|  six |
 
 And I wanted to give each cell a different colour (based on its contents
 or cell data.) How would I do it?
 
 CellRendererText seems to apply the background/foreground colours to the
 whole column.
 
 Do I need to implement my own cell renderer?
 
 I may be able to do it with treeview.get_cell_area, but I'm not sure how
 to pass in the GdkRectangle argument.
   
 
 Simply create a column in your model of type string which contains the 
 colour you want for the cell.  Then when setting up the tree view 
 column, map that column to the cell_foreground or cell_background 
 properties of the cell renderer.
 
Hi,

I wondered about the same thing some weeks ago. Sorry for being silly,
but I don't understand how that method is going to give you different
colors in individual cells and not just alter the colors in different
columns.

Best regards
Øistein

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



Re: [pygtk] pipe.read - interrupted system call what's the story?

2002-12-12 Thread Oistein Aanensen
I asked the same question a week ago or something. I was receiving
IOError, errno 4 when I was using pipe.readlines() together with pygtk.

However the solution that solved my problem was to wait for the to
finish before a was reading its output. I have actually never seen this
problem using popen2 and read one line at the time.

Øistein

On Thu, 2002-12-12 at 20:32, Christian Reis wrote:
 On Thu, Dec 12, 2002 at 07:19:10PM +, Stephen Kennedy wrote:
  
  I've seen several threads in the pygtk archives over this point,
  but they've recieved no replies :(
  
  pygtk seems to do something strange which causes normal pipe reads to fail
  See:
  
http://www.google.com/search?hl=enlr=ie=ISO-8859-1safe=offq=pygtk+interrupted+system+callbtnG=Google+Search
 
 If you can give us a *small* testcase or futz a bit with gdb to find out
 we may have more luck debugging :-)
 
 Take care,
 --
 Christian Reis, Senior Engineer, Async Open Source, Brazil.
 http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
 ___
 pygtk mailing list   [EMAIL PROTECTED]
 http://www.daa.com.au/mailman/listinfo/pygtk
 Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



[pygtk] IOError: [Errno 4] Interrupted system call

2002-12-02 Thread Oistein Aanensen
Hi,

I'm getting some strange behaviour when i'm trying to use either
os.popen m popen2.Popen3 or popen2.Popen4 in my pygtk programs.
Occasionally i'm receiving 

IOError: [Errno 4] Interrupted system call

when i issue the readlines() call on fromchild descriptor, or reads from
the fd that comes from fd.os.popen(cmd,'r'). Trying this code
standalone, i.e. not pygtk they works fine each time. When i run the
code from hitting a button in a libglade, pygtk program i receive this
weird behaviour.

Anybody have a clue.

Thanks for all feedback.

Best regards
Øistein Aanensen



___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



Re: [pygtk] pygtk threading

2002-11-26 Thread Oistein Aanensen
Hi,

I would have changed two things.

On Fri, 2002-11-22 at 21:42, Marc Miller wrote:
 
 Hi!
 
 I'm hoping someone can tell me what I'm doing wrong.  It seems like 
 gtk.main() is blocking all my python threads.  When gtk.main() exits, then 
 my threads execute, but not before.  The following python program _does_not_ 
 print anything (I am runing RH8):
 
 -[ foo.py ]---
 import gtk
 import thread
 
 def testThreading():
 print ***  you should see this ***
 
 thread.start_new_thread(testThreading, ())

  gtk.threads_init() #Need if you plan to use any of the gtk threads

 #gtk.main() replace with gtk.mainloop() and it will work  
  
  gtk.mainloop()


Regards Øistein

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/