Re: [pygtk] Which is the active radiobutton?

2010-06-03 Thread Brian Rowlands (Greymouth High School)
Thanks for all the good advice.

Found my mental block.

Solution:
radio = [r for r in cbc['radio_ped'].get_group() if r.get_active()][0] 
radiolabel = radio.get_label()

where radio_ped is the group name of the radio buttons

Brian

___
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] getting desktop path

2010-06-03 Thread Mike Sheldon
On Thu, 2010-06-03 at 16:20 +0200, Pasquale Boemio wrote:
> If your sistem is well configurated there is a file in your home
> directory that set some variables.
> Here is mine:
> p...@littlemonkey ~ $ cat .config/user-dirs.dirs 
> XDG_DESKTOP_DIR="$HOME/Desktop"
> XDG_MUSIC_DIR="/media/PausExt/Musica"
> XDG_DOWNLOAD_DIR="$HOME/Downloads"
> XDG_PUBLICSHARE_DIR="$HOME/Dropbox"
> XDG_PICTURES_DIR="$HOME/Pictures"
> 
> you can use this, but look that some users maybe don't have it!

 It might be better to use the pyxdg module[1] rather than attempting to
read that file directly, that way it can fall back on the system-wide
defaults if a user doesn't have anything configured (or the
freedesktop.org defaults if nothing is specified at the system level).

 Cheers, 
  Mike.

[1] http://www.freedesktop.org/wiki/Software/pyxdg

___
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] getting desktop path

2010-06-03 Thread Timo
On 03-06-10 15:47, Gabriele Lanaro wrote:
> How to get, for example the desktop path of the current user? 
> (localization-aware)
> Would be nice to obtain for example also the default download-path.
> Is that possible?
I don't know a Python approach to do this. But most Linux systems have 
the xdg-utils installed though, so the following works:

$ xdg-user-dir DESKTOP
/home/timo/Bureaublad

Cheers,
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/


[pygtk] Custom classes, Glade, and gtk.Builder

2010-06-03 Thread Robin Munn
I'm trying to learn to use Glade to create UIs with gtk.Builder, and
there's one thing I can't figure out how to do. What I want to do is
something like this:

class MainWindow(gtk.Window):
def on_window_destroy(self):
gtk.main_quit()
def handle_some_other_event(self):
do_something()

builder = gtk.Builder()
builder.add_from_file('main_window.ui')
wnd = builder.get_object('mainwindow')
builder.connect_signals(wnd)
wnd.show()

However, I can't find anywhere in Glade to specify that I want to use
my MainWindow class rather than the gtk.Window class, so the "wnd"
object ends up as a gtk.Window instance and doesn't have the event
handler functions (on_window_destroy(), handle_some_other_event(), and
so on). If I edit the UI XML file by hand and change
'class="gtk.Window"' to 'class="MainWindow"', gtk.Builder doesn't know
where to find the MainWindow class to instantiate it.

I can work around this by putting the event names and handler
functions in a dict and passing that dict to gtk.Builder, but that
feels like unnecessary duplication. Glade lets me type in signal
handler names, and I have functions of those names in the class... so
how do I make this work? How do I tell gtk.Builder that I want to
instantiate my MainWindow class rather than the gtk.Window class?

-- 
Robin Munn
robin.m...@gmail.com
GPG key 0x4543D577
___
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] getting desktop path

2010-06-03 Thread Pasquale Boemio
If your sistem is well configurated there is a file in your home
directory that set some variables.
Here is mine:
p...@littlemonkey ~ $ cat .config/user-dirs.dirs 
XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_MUSIC_DIR="/media/PausExt/Musica"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_PUBLICSHARE_DIR="$HOME/Dropbox"
XDG_PICTURES_DIR="$HOME/Pictures"

you can use this, but look that some users maybe don't have it!


On Thu, 2010-06-03 at 15:47 +0200, Gabriele Lanaro wrote:
> How to get, for example the desktop path of the current user?
> (localization-aware)
> Would be nice to obtain for example also the default download-path.
> Is that possible?
> ___
> 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/


[pygtk] getting desktop path

2010-06-03 Thread Gabriele Lanaro
How to get, for example the desktop path of the current user?
(localization-aware)
Would be nice to obtain for example also the default download-path.
Is that possible?
___
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] little icon trouble

2010-06-03 Thread Pasquale Boemio
I've resolved with a simpler gtk.checkmenuitem..

if anybody is concerned, could give a look at my project. Is a mpd
player for the gnome-panel.
It is still in svn version, but it is usable!
All kind of comments are well accepted, thanks

http://code.google.com/p/simplerc/

On Thu, 2010-06-03 at 10:00 +0200, Timo wrote:
> 
> 
> pygtk@daa.com.au
> 
--- 
Pasquale Boemio
boemianraps...@gmail.com
pa.boe...@studenti.unina.it
MSN
Skype
Twitter
boemianraps...@yahoo.com
boemianrapsodi
HelloIAmPau

___
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] little icon trouble

2010-06-03 Thread Pasquale Boemio
I've resolved with a simpler gtk.checkmenuitem..

if anybody is concerned, could give a look at my project. Is a mpd
player for the gnome-panel.
It is still in svn version, but it is usable!
All kind of comments are well accepted, thanks

On Thu, 2010-06-03 at 10:00 +0200, Timo wrote:
> 
> 
> pygtk@daa.com.au
> 
--- 
Pasquale Boemio
boemianraps...@gmail.com
pa.boe...@studenti.unina.it
MSN
Skype
Twitter
boemianraps...@yahoo.com
boemianrapsodi
HelloIAmPau

___
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] Which is the active radiobutton?

2010-06-03 Thread John Stowers
On Thu, Jun 3, 2010 at 8:05 PM, Timo  wrote:
> On 03-06-10 03:38, Brian Rowlands (Greymouth High School) wrote:
>>
>> Hi Guys
>>
>> Just a newbie using Python & Glade and have the code below:
>>
>> The GUI contains 4 radio buttons [ I'll call them four, three, two,
>> one  ] in a group called four. My research came across:
>>
>> radio = [r for r in cbc['four'].get_group() if r.get_active()]
>>
>> which gets me the active button with print radio giving me:
>>
>> []
>>
>> My question: how do i get the 'name' of the button which is active?
>>
> Every widget has the get_name() method. You could try that.

This is very likely not what you want, for example get_name() on a
gtk.Dialog returns "GtkDialog"

What I suspect happened was you did this

radio = [r for r in cbc['four'].get_group() if r.get_active()]
radio.get_label()

Which fails because radio is a list (not a gtk radiobutton). You
probably want something like

radio[0].get_label().get_text()

John
___
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] Which is the active radiobutton?

2010-06-03 Thread Timo
On 03-06-10 03:38, Brian Rowlands (Greymouth High School) wrote:
>
> Hi Guys
>
> Just a newbie using Python & Glade and have the code below:
>
> The GUI contains 4 radio buttons [ I'll call them four, three, two, 
> one  ] in a group called four. My research came across:
>
> radio = [r for r in cbc['four'].get_group() if r.get_active()]
>
> which gets me the active button with print radio giving me:
>
> []
>
> My question: how do i get the 'name' of the button which is active?
>
Every widget has the get_name() method. You could try that.

Cheers,
Timo


> Tried print radio.get_label() and that failed as there is no attribute 
> called label.
>
> Any help appreciated. Even a reference.
>
> Thanks
>
>
> ___
> 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] little icon trouble

2010-06-03 Thread Timo
On 02-06-10 20:26, Pasquale Boemio wrote:
> But now, anyone knows the gtk name for the icons "shuffle" and
> "repeat"??
>
All stock items are listed here: 
http://www.pygtk.org/docs/pygtk/gtk-stock-items.html

But it looks like shuffle and repeat aren't there. Maybe these icons are 
in one of the latest PyGTK versions and the docs aren't updated yet.

You could also look at other PyGTK mediaplayers sourcecode to see how 
they do it.

Cheers,
Timo

> thanks
>
> ---
> Pasquale Boemio
> boemianraps...@gmail.com
> pa.boe...@studenti.unina.it
> MSN
> Skype
> Twitter
> boemianraps...@yahoo.com
> boemianrapsodi
> HelloIAmPau
>
> ___
> 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/