From f44a0e9e536b849f17dcd63246ffafcf26da0705 Mon Sep 17 00:00:00 2001 From: smethan Date: Thu, 1 Nov 2018 09:47:54 -0500 Subject: [PATCH] improved naming for decensored files --- ui.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ui.py b/ui.py index 2595394..867ce98 100644 --- a/ui.py +++ b/ui.py @@ -37,6 +37,7 @@ from tkinter import messagebox from tkinter import filedialog import framework import decensor +import os class PaintApplication(framework.Framework): @@ -178,10 +179,16 @@ class PaintApplication(framework.Framework): combined_img = Image.alpha_composite(self.canvas.img.convert('RGBA'), self.drawn_img) decensorer = decensor.Decensor() print(self.file_name) - decensorer.decensor_image(combined_img.convert('RGB'),combined_img.convert('RGB'), self.file_name + ".png") - save_path = self.file_name + ".png" + orig_name = self.file_name + path, file = os.path.split(self.file_name) + name, ext = os.path.splitext(file) + name = name + "_decensored" + self.file_name = os.path.join(path, name + ext) + print(self.file_name) + decensorer.decensor_image(combined_img.convert('RGB'),combined_img.convert('RGB'), self.file_name) messagebox.showinfo( - "Decensoring", "Decensoring complete! image saved to {save_path}".format(save_path=save_path)) + "Decensoring", "Decensoring complete! image saved to {save_path}".format(save_path=self.file_name)) + self.file_name = orig_name def on_about_menu_clicked(self, event=None): # messagebox.showinfo( # "Decensoring", "Decensoring in progress.")