def __init__(self, image_folder, filterchain): self.image_folder = ImageFolder() self.image_folder.return_file_name = True self.image_folder.read_folder(image_folder) self.chain = chain.read(filterchain) self.precisions = {} self.noises = {}
def on_btnOpen_clicked(self, widget): if self.is_state_modified_or_created(): result = self.msg_confirm_save_before_new() if result == Gtk.ResponseType.YES: pass elif result == Gtk.ResponseType.CANCEL: return dialog = Gtk.FileChooserDialog("Choose a filterchain file", None, Gtk.FileChooserAction.OPEN, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK)) ff = Gtk.FileFilter() ff.set_name('Filterchain') ff.add_pattern('*.filterchain') dialog.set_filter(ff) response = dialog.run() if response == Gtk.ResponseType.OK: c = chain.read(dialog.get_filename()) if c is not None: self.use_new_chain(c) self.txtFilterChain.set_text(dialog.get_filename()) self.set_state_show() dialog.destroy()