Re: [pygtk] Memory leak when using pangocairo for animation

2008-10-01 Thread Kyle Schaffrick
On Tue, 30 Sep 2008 09:28:51 -0400
Seth Remington [EMAIL PROTECTED] wrote:

 Hello,
 
 I am not a member of the list but can confirm the OP's discovery of
 the memory leak. I was Googling for this and found this mailing list
 post and then noticed that the date was only three days ago (thanks
 for the quick indexing Google) and thought I should chime in.
 

Thanks, I was still waiting to hear if anyone was able to reproduce it.
My code does it on two different Linux distros so far. I was hoping I'd
someone would just say it's because you forgot to X, but unfortunately
I'm beginning to think it's a bug.

 I have a custom cairo widget inheriting from a gtk.DrawingArea that
 displays some text and refreshes very frequently. Using cairo's
 built-in text rendering (i.e. show_text()) I do not see the memory
 leak but when I switched to using pangocairo then I saw the massive
 memory growth.
 

Good to know the Cairo native rendering doesn't leak, I may have to work
around it this way. Unfortunately, I don't think the built-in Cairo
text rendering supports any sort of markup like Pango does; I am using
that heavily in my app. If I'm right, it would be lots of tedious code
to position things and set fonts and so forth by hand. :(

-Kyle
___
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] cell.set_property and colors - SOLVED

2008-10-01 Thread Alessandro Dentella
On Thu, Sep 25, 2008 at 05:48:54PM +0200, Alessandro Dentella wrote:
 Hi,
 
I want to color single cells in a TreeView (totals of a table).
Since I'm using cell_data_func to set value of property text I tried
using that same function to set colors but it turns out all cells get
colored... 
 
 def dict_cell_data_func(self, column, cell, model, iter, (col_num, name)):
 obj = model.get_value(iter, col_num) 
 value = getattr(obj, name)
 cell.set_property(text, value)
 if value == 'venice':
 cell.set_property(cell-background, 'yellow')

 
can anybody help me understanding why?


It turns out that if you set 'cell-background' you need to set it in
*any* cell. You can set it to None and it will use the default (that may
happen to be an alternating scheme).

I still don't really udertand if the cell object I'm setting the property is
a unique instance for the whole column (I think so) or one instance each
cell.


sandro

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] Cell renderer repository?

2008-10-01 Thread Alessandro Dentella
Hi,

  I'm in the need to write a cell render for what I believe a common thing:
  a text editor for log text that is not easy to edit in the standard
  CellRendererText. 

  I'm wandering if there exist already such a renderer or a repository of
  cell renderer ready to use. A second one I need is
  Date/DateTimeRenderer. I guess I'm not the first one that need such a
  beast... 

  sandro
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] limit width of gtk.ComboBox

2008-10-01 Thread Karl Ostmo
From the PyGTK FAQ (http://faq.pygtk.org/index.py?req=all#12.2), it appears
that there is not a way to limit the horizontal space the widget requests.

I am aware of the set_ellipsize() method of gtk.Label (
http://www.pygtk.org/docs/pygtk/class-gtklabel.html#method-gtklabel--set-ellipsize),
but is there a method that will accomplish the same thing for Combo Boxes?
I have some really wide text entries that I wouldn't mind popping out at
full width, but I would like for the combo box itself to have a fixed width
and truncate the currently selected text.

I suspect there might be a way to write a custom CellRenderer to pull off
this effect, but I'm not sure how to use it with the ComboBox.

Thanks,
Karl
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] Downloading a file without locking the GUI

2008-10-01 Thread Timo
Thomas Guettler schreef:
 Timo schrieb:
 I want to download a file by pressing a button in my GUI, all works 
 so that's okay. Offcourse my GUI locks up during the download.
 I tried some things like writing a thread and using gobject.idle_add. 
 But none of these worked.
 Anyone can point me out to some kind of example or tutorial?

   
 Hi,

 You could use PixbufLoader, non-blocking IO and idle_add. This 
 solution works without
 threads. I try to avoid them.

 Sorry, that's not an example or tutorial, but if you found idle_add, 
 you will get this done, too.

 HTH,
  Thomas

I don't get the pixbufloader thing, since I don't download images. But 
maybe I'm just missing something.

Well, after searching and trying again, still no progress. I guess I'm 
just missing something.

Here's what I want to do, maybe someone has an idea how to do this:

def buttonclicked(widget):
urllib.urlretrieve(url, downloadpath)

I was also thinking about adding a progressbar during download, but if I 
can't even get this done...

Thanks,
Timo


___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Downloading a file without locking the GUI

2008-10-01 Thread Steve McClure

On Oct 1, 2008, at 2:16 PM, Timo wrote:

 Thomas Guettler schreef:
 Timo schrieb:
 I want to download a file by pressing a button in my GUI, all works
 so that's okay. Offcourse my GUI locks up during the download.
 I tried some things like writing a thread and using  
 gobject.idle_add.
 But none of these worked.
 Anyone can point me out to some kind of example or tutorial?


 Hi,

 You could use PixbufLoader, non-blocking IO and idle_add. This
 solution works without
 threads. I try to avoid them.

 Sorry, that's not an example or tutorial, but if you found idle_add,
 you will get this done, too.

 HTH,
 Thomas

 I don't get the pixbufloader thing, since I don't download images. But
 maybe I'm just missing something.

 Well, after searching and trying again, still no progress. I guess I'm
 just missing something.

 Here's what I want to do, maybe someone has an idea how to do this:

 def buttonclicked(widget):
urllib.urlretrieve(url, downloadpath)

 I was also thinking about adding a progressbar during download, but  
 if I
 can't even get this done...

If you just wanted progress you could use a reporthook function passed  
to urlretrieve that would update the UI then

 while gtk.events_pending():
 gtk.mainiteration(False)

to update the UI. That should make your UI responsive to the user to  
and you just have to be careful that you don't call mainiteration, or  
mainloop, from multiple places.  Keep in mind that my application is  
so old that I use 1.x so the programming model, or just names, might  
have changed in 2.x.



 Thanks,
 Timo


 ___
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/listinfo/pygtk
 Read the PyGTK FAQ: http://faq.pygtk.org/


--
Steve McClure
[EMAIL PROTECTED]

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Downloading a file without locking the GUI

2008-10-01 Thread John Stowers
On Wed, 2008-10-01 at 20:16 +0200, Timo wrote:
 Thomas Guettler schreef:
  Timo schrieb:
  I want to download a file by pressing a button in my GUI, all works 
  so that's okay. Offcourse my GUI locks up during the download.
  I tried some things like writing a thread and using gobject.idle_add. 
  But none of these worked.
  Anyone can point me out to some kind of example or tutorial?
 

  Hi,
 
  You could use PixbufLoader, non-blocking IO and idle_add. This 
  solution works without
  threads. I try to avoid them.
 
  Sorry, that's not an example or tutorial, but if you found idle_add, 
  you will get this done, too.
 
  HTH,
   Thomas
 
 I don't get the pixbufloader thing, since I don't download images. But 
 maybe I'm just missing something.
 
 Well, after searching and trying again, still no progress. I guess I'm 
 just missing something.

Please post your code so we can take a look.

 
 Here's what I want to do, maybe someone has an idea how to do this:
 
 def buttonclicked(widget):
 urllib.urlretrieve(url, downloadpath)
 
 I was also thinking about adding a progressbar during download, but if I 
 can't even get this done...

Did you check out the examples at the link I sent you?

John

 
 Thanks,
 Timo
 
 
 ___
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/listinfo/pygtk
 Read the PyGTK FAQ: http://faq.pygtk.org/

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] limit width of gtk.ComboBox

2008-10-01 Thread Casey McGinty
I think this is what you want.

  cell = gtk.CellRendererText()
  cell.props.ellipsize = pango.ELLIPSIZE_END
  ls = gtk.ListStore( object)
  cb = gtk.ComboBox( ls)
  cb.pack_start( cell, True)

- Casey
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] Cell renderer repository?

2008-10-01 Thread Mitko Haralanov
On Wed, 1 Oct 2008 17:22:58 +0200
Alessandro Dentella [EMAIL PROTECTED] wrote:

   I'm wandering if there exist already such a renderer or a repository of
   cell renderer ready to use. A second one I need is
   Date/DateTimeRenderer. I guess I'm not the first one that need such a
   beast... 

At one point, a long time ago, I did this by setting a custom data
function for a cell with (C func)
gtk_tree_view_column_set_cell_data_func.

The custom data function would get the value from the tree model,
format it as needed, and then set the text attribute of that cell's
renderer. The renderer itself was a text renderer.

Looking that the pygtk reference manual, this can be accomplished with
gtk.TreeView.insert_column_with_data_func()

HTH

-- 
Mitko Haralanov
==
Computer programmers do it byte by byte.
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/