Pygtk FileChooser multiple_selection
I'am trying to implement a fileChooser widget.The problem I am facing is, when you select multiple files and hit return or space the selection deselects, except one file. Because of this, when I handle the "file-activated" signal and use get_filenames(), it only returns one filename.
This is my code:
def file_chooser_box2(self): box = gtk.HBox(False, 0) file_ = gtk.FileChooserWidget() file_.set_current_folder("/home/marco") file_.set_show_hidden(False) file_.set_select_multiple(True) file_.connect("file-activated", self.files_selected, file_.get_filenames()) #hide stuff file_box = file_.get_children().get_children().get_children().get_children() file_box.hide() box.pack_start(file_, True, True, 0) file_.show() box.show() return box def files_selected(self, widget, data = None): print data
Managed to find a way around.It might help someone.The way I solved the issue is by connecting to the "changed" signal of the treeselection and remebering the last two selections. Now when you hit enter you don't take the changed selection but you take the previous one you remembered.