def run(self): self.update_patch() result = super().run() if result < 0: self.hide() return # Copy patch to clipboard if result == 1: buf = self.textview.get_buffer() start, end = buf.get_bounds() clip = Gtk.Clipboard.get_default(Gdk.Display.get_default()) clip.set_text(buf.get_text(start, end, False), -1) clip.store() # Save patch as a file else: gfile = prompt_save_filename(_("Save Patch")) if gfile: self.save_patch(gfile) self.hide()