Re: [pygtk] ComboBox icon alignment (for selecting file type from icons/text)

2004-10-17 Thread John Finlay

Thomas Mills Hinkle wrote:
On Sat, 16 Oct 2004 15:54:23 -0700 John Finlay [EMAIL PROTECTED]
wrote:
 

Maybe setting the xalign property to 0.0 for the CellRendererPixbuf 
would work assuming that the icons are all the same size.
   

Thanks for the tip! This works very nicely. However, I now see a
stranger problem: when I pull down the menu, all the text fits nicely
(the icons are all aligned along the lefthand side and the text is
centered; the widget is sized so that the largest text just fits).
However, when I select the longest string (which just fits when I pull
down the menu), it is aligned much further to the right, in line with
the other strings, resulting in the text disappearing off of the widget.
Very frustrating. Would this qualify as a gtk bug?
 

Possibly.
I've attached the earlier sample modified to use xalign and modified to
provide an example of the text disappearing off the right.
 

It seems that you want the pixbufs and text both left aligned. For that 
case don't set the xalign property and set expand=False in the first 
pack_start() call.

John
___
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] ComboBox icon alignment (for selecting file type from icons/text)

2004-10-17 Thread Maciej Katafiasz
Dnia 17-10-2004, nie o godzinie 00:27 -0700, John Finlay napisa:
 Maybe setting the xalign property to 0.0 for the CellRendererPixbuf 
 would work assuming that the icons are all the same size.
 
 
 
 Thanks for the tip! This works very nicely. However, I now see a
 stranger problem: when I pull down the menu, all the text fits nicely
 (the icons are all aligned along the lefthand side and the text is
 centered; the widget is sized so that the largest text just fits).
 
 However, when I select the longest string (which just fits when I pull
 down the menu), it is aligned much further to the right, in line with
 the other strings, resulting in the text disappearing off of the widget.
 Very frustrating. Would this qualify as a gtk bug?
   
 
 Possibly.
 
 I've attached the earlier sample modified to use xalign and modified to
 provide an example of the text disappearing off the right.
   
 
 It seems that you want the pixbufs and text both left aligned. For that 
 case don't set the xalign property and set expand=False in the first 
 pack_start() call.

Change xalign for CellRendererText to 0.5, and you'll get it nicely
centered when menu is shown, yet still looking valid when hidden

Cheers,
Maciej

-- 
Tautologizm to co tautologicznego
   Maciej Katafiasz [EMAIL PROTECTED]
 http://mathrick.org

___
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] ComboBox icon alignment (for selecting file type from icons/text)

2004-10-17 Thread Thomas Mills Hinkle
On Sun, 17 Oct 2004 00:27:29 -0700 John Finlay [EMAIL PROTECTED]
wrote:

 It seems that you want the pixbufs and text both left aligned. For
 that case don't set the xalign property and set expand=False in the
 first pack_start() call.

That does it. Thanks! 

I was spending my time in the wrong part of the reference/tutorial -- I
needed to be reading about packing  aligning widgets!

I solved the other problem I mentioned -- wanting to connect to the
FileChooser Entry widget -- by adding a timeout to check what the
filename is and update the ComboBox widget accordingly if the user types
in extension.  The provides the same/similar functionality to what's
described here http://www.gnome.org/~seth/designs/filechooser-spec/

Thanks for all your help!

Tom
___
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] ComboBox icon alignment (for selecting file type from icons/text)

2004-10-16 Thread Thomas Mills Hinkle
On Sat, 16 Oct 2004 11:24:18 -0400 Thomas Mills Hinkle
[EMAIL PROTECTED] wrote:

 I'm trying to create a ComboBox with icons and text for a user to
 select a file type. Everything works well, except that the icons are
 not properly aligned -- they stagger along in a wavy line rather than
 all lining up.

I just had to look a little bit closer to notice that the staggering was
in proportion to the size of the text beside each icon. If I set the
width property on CellRendererText to be a constant, everything lines up
nicely.

Which leads to one other question -- is there a nice way to calculate
width for these items.  Is there a way to ask pango how large each
string will be and then take the largest value to use as my width? (I
can get a PangoFontDescription from the 'font-desc' property of the cell
renderer, but that's as far as I've gotten).

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