Andy,

I don't think there's much more you can do to make it neater.  If you create 
the filter object in your glade file you could get rid of the self.filt = 
gtk.FileFilter() and self.fb.add_filter(self.filt) calls, but then you'd need a 
builder.get_object('filter') before you'd be able to add your pattern.  Glade 
doesn't yet allow you to do anything with the filter object:

http://stackoverflow.com/questions/1705418/can-you-set-the-filefilters-for-a-gtk-dialog-in-glade


Rogge

-----Original Message-----
From: andy pugh [mailto:[email protected]] 
Sent: Wednesday, April 25, 2012 6:11 PM
To: Enhanced Machine Controller (EMC)
Subject: Re: [Emc-users] GladeVCP / File Selector Button

On 25 April 2012 17:10, Daniel Rogge <[email protected]> wrote:

> I don't know about the filter, but the filechooser button works fine.

Thanks for the help, I seem to have what I want now.

    def __init__(self, halcomp, builder, useropts):
        self.fb = builder.get_object('filechooserbutton1')
        self.filt = gtk.FileFilter()
        self.filt.add_pattern('*.bmp')
        self.filt.set_name('Bitmaps')
        self.fb.add_filter(self.filt)

Works. I imagine there are neater ways to code this?
-- 
atp
The idea that there is no such thing as objective truth is, quite simply, wrong.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to