def on_export_clicked(self, w: Gtk.MenuToolButton): self.img.palettes = make_palette_colors_unique(self.img.palettes) md = SkyTempleMessageDialog( MainController.window(), Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.MessageType.INFO, Gtk.ButtonsType.OK, _("This will export the currently selected image with the currently selected palette. " "The image file itself contains all palettes, you can choose to import the edited palettes on import." ), title=_("Export Images")) md.run() md.destroy() dialog = Gtk.FileChooserNative.new( _("Export current image to folder..."), MainController.window(), Gtk.FileChooserAction.SAVE, _('_Save'), None) response = dialog.run() fn = dialog.get_filename() dialog.destroy() if response == Gtk.ResponseType.ACCEPT: if '.' not in fn: fn += '.png' self.img.to_pil(self.image_idx, self.palette_idx).save(fn)
def on_make_unique_button_clicked(self, *args): self.palettes = make_palette_colors_unique(self.palettes) self._init_page(self.notebook.get_current_page()) md = SkyTempleMessageDialog(self.dialog, Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.MessageType.INFO, Gtk.ButtonsType.OK, _("Made colors unique."), title=_("Palette Editor"), is_success=True) md.set_position(Gtk.WindowPosition.CENTER) md.run() md.destroy()