[pygtk] gtk.FileChooserButton and custom gtk.FileChooseDialog

Stefano Esposito ragnacruxer at gmail.com
Mon Sep 12 23:41:24 WST 2005


Hi, all

i tried to set a gtk.FileChooseButton to use a gtk.FileChooserDialog defined by me. It all works fine, but when i choose a file from the dialog and click "Open" button, the selected file won't be shown in the button.

Here how i define button and dialog:

class filechooser(gtk.FileChooserButton):

    def __init__(self, hbox):

        gtk.FileChooserButton.__init__(self, filedlg())
        
	hbox.pack_start(self, False, True, 0)
        hbox.reorder_child(self, 1)

class filedlg(gtk.FileChooserDialog):

    def __init__(self):

        gtk.FileChooserDialog.__init__(self, 
						   "Select a package",
					           None,
				 	gtk.FILE_CHOOSER_ACTION_OPEN,
                                                  (gtk.STOCK_OPEN,
						   gtk.RESPONSE_OK,
                                                   gtk.STOCK_CANCEL,
                                                 gtk.RESPONSE_CANCEL))

        pkgfilter = gtk.FileFilter()
        pkgfilter.add_pattern("*.pkg.tar.gz")
        pkgfilter.set_name("Packages")
        self.add_filter(pkgfilter)

        allfilter = gtk.FileFilter()
        allfilter.add_pattern("*")
        allfilter.set_name("All files")
        self.add_filter(allfilter)

-- 
"Solo due cose sono infinite: l'universo e la stupidità umana... e per quanto riguarda l'universo non sono sicuro"

Albert Einstein

# GnuPG/PGP Key Id: 0x5646B7D4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20050912/a5b629d1/attachment.pgp


More information about the pygtk mailing list