From 6dc2723e4553d52e1313389f6917c3207be5ec0f Mon Sep 17 00:00:00 2001 From: oleting Date: Mon, 4 Jan 2021 20:08:54 +0100 Subject: [PATCH] + fix output view --- gui/gui.py | 15 ++++++++++----- gui/utils.py | 5 ++++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/gui/gui.py b/gui/gui.py index 5418796..7a08b14 100644 --- a/gui/gui.py +++ b/gui/gui.py @@ -101,7 +101,7 @@ class Gui: nassi(input_path=file_path, output_path=output_path, outputname=output_name, gui=self, font_filepath=font_filepath, behaviour=exists_choice, types=types, remove_tags=modifier, comments=comments) - fnames = output(values['-OUTPUT FOLDER-']) + fnames = output(values['-OUTPUT FOLDER-'], output_name) sg.popup_annoying('Successfully created!', title='Created', auto_close_duration=2, auto_close=True, text_color='green') window['-OUTPUT FILE LIST-'].update(fnames) @@ -165,9 +165,14 @@ class Gui: logging.debug(('event = ' + str(event) + ' value = ' + str(values['-OUTPUT FILE LIST-']))) try: - filename = os.path.join( - values["-OUTPUT FOLDER-"], values["-OUTPUT FILE LIST-"][0] - ) + if output_name: + filename = os.path.join( + (values["-OUTPUT FOLDER-"]+ '/' + output_name), values["-OUTPUT FILE LIST-"][0] + ) + else: + filename = os.path.join( + values["-OUTPUT FOLDER-"], values["-OUTPUT FILE LIST-"][0] + ) window["-TOUT-"].update(filename) window["-IMAGE-"].update(filename=filename) except FileNotFoundError: @@ -175,7 +180,7 @@ class Gui: title='FileNotFoundError',) except Exception as e: sg.popup_cancel(str(e), title='Error') - logging.error('Try to open a .png. {e}') + logging.error(f'Try to open a .png. {e}') except: logging.error('Try to open a .png. Unknown error.') pass diff --git a/gui/utils.py b/gui/utils.py index 2ed610b..afe4ef6 100644 --- a/gui/utils.py +++ b/gui/utils.py @@ -30,9 +30,12 @@ def nassi(input_path: str, output_path: str, outputname: str, types, remove_tags -def output(output_path): +def output(output_path, output_name=None): + if output_path == '': raise NoPathError + if output_name: + output_path = output_path + '/' + output_name try: file_list = os.listdir(output_path) except: