I would only like a sub-set of the file types the ImageBrowser supports and it would be nice if a method could be provided for this.
I can do it (see below) but as I just found out the internal way ImageBrowser is dealing with the file types has changed without me realizing it, which obviously introduced a bug in my application.
I am currently I do this:
dlg = ib.ImageDialog(self, initial_dir)
# Change list of files to be supported
dlg.fl_ext_types = (
("All supported formats", "All"),
("BMP (*.bmp)", "*.bmp"),
("GIF (*.gif)", "*.gif"),
("PNG (*.png)", "*.png"),
("JPEG (*.jpeg)", "*.jpeg"),
("JPG (*.jpg)", "*.jpg"),
)
dlg.set_type,self.fl_ext = dlg.fl_ext_types[0] # initial file filter setting
dlg.fl_types = [ x[0] for x in dlg.fl_ext_types ]
dlg.sel_type.Clear()
dlg.sel_type.AppendItems(dlg.fl_types)
dlg.sel_type.SetSelection(0)
dlg.fl_ext_types = dict(dlg.fl_ext_types)
dlg.Centre()
But it would be nice if a method along these lines could be added to ImageBrowser:
def ChangeFileTypes(self, ft_tuple)
# Change list of file types to be supported
self.fl_ext_types = ft_tuple
self.set_type, self.fl_ext = self.fl_ext_types[0] # initial file filter setting
self.fl_types = [ x[0] for x in self.fl_ext_types ]
self.sel_type.Clear()
self.sel_type.AppendItems(self.fl_types)
self.sel_type.SetSelection(0)
self.fl_ext_types = dict(self.fl_ext_types)
Werner