Friday, 9 August 2013

Add filter on executable files in filechooser dialog using pygtk when OS is Ubuntu

Add filter on executable files in filechooser dialog using pygtk when OS
is Ubuntu

I am using pygtk to create a file chooser widget. I am using Ubuntu OS. I
want to put a filter in selecting files. My chooser widget should only
select executable files (diamond icons or in Ubuntu). I am trying to use
below code:
dialog =
gtk.FileChooserDialog(title=None,action=gtk.FILE_CHOOSER_ACTION_OPEN,
buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OK,gtk.RESPONSE_OK))
filter_file = gtk.FileFilter()
filter_file.add_pattern("*.bin")
filter_file.add_pattern("*.run")
filter_file.add_pattern("*.sh")
dialog.add_filter(filter_images)
dialog.show()
It is not working. It does not show the executable files in chooser
window. Is there any way we can put filter on executable files because it
seems like Ubuntu does not have any extension for executable files.

No comments:

Post a Comment