MacUntu
September 2nd, 2008, 03:35 PM
I want to have a file chooser dialog that doesn't display hidden files per default. After a bit of API reading setting the chooser's show_hidden attribut via set_show_hidden(False) should do the trick but it fails.
get_show_hidden() always returns the state that is set in the dialog with Ctrl+H - is this a backend problem?
import pygtk
pygtk.require("2.0")
import gtk
fcd = gtk.FileChooserDialog("Select source directory...",
None,
gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
gtk.STOCK_OPEN, gtk.RESPONSE_OK))
fcd.set_default_response(gtk.RESPONSE_OK)
print fcd.get_show_hidden() # True/False
fcd.set_show_hidden(False)
print fcd.get_show_hidden() # False
response = fcd.run()
print fcd.get_show_hidden() # True/False
if response == gtk.RESPONSE_OK:
print fcd.get_filename()
elif response == gtk.RESPONSE_CANCEL:
print 'No folder selected.'
fcd.destroy()
get_show_hidden() always returns the state that is set in the dialog with Ctrl+H - is this a backend problem?
import pygtk
pygtk.require("2.0")
import gtk
fcd = gtk.FileChooserDialog("Select source directory...",
None,
gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
gtk.STOCK_OPEN, gtk.RESPONSE_OK))
fcd.set_default_response(gtk.RESPONSE_OK)
print fcd.get_show_hidden() # True/False
fcd.set_show_hidden(False)
print fcd.get_show_hidden() # False
response = fcd.run()
print fcd.get_show_hidden() # True/False
if response == gtk.RESPONSE_OK:
print fcd.get_filename()
elif response == gtk.RESPONSE_CANCEL:
print 'No folder selected.'
fcd.destroy()