+ fix output view

This commit is contained in:
oleting
2021-01-04 20:08:54 +01:00
parent fbec8d2f18
commit 6dc2723e45
2 changed files with 14 additions and 6 deletions

View File

@@ -101,7 +101,7 @@ class Gui:
nassi(input_path=file_path, output_path=output_path, outputname=output_name, gui=self, 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) 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', sg.popup_annoying('Successfully created!', title='Created',
auto_close_duration=2, auto_close=True, text_color='green') auto_close_duration=2, auto_close=True, text_color='green')
window['-OUTPUT FILE LIST-'].update(fnames) window['-OUTPUT FILE LIST-'].update(fnames)
@@ -165,9 +165,14 @@ class Gui:
logging.debug(('event = ' + str(event) + logging.debug(('event = ' + str(event) +
' value = ' + str(values['-OUTPUT FILE LIST-']))) ' value = ' + str(values['-OUTPUT FILE LIST-'])))
try: try:
filename = os.path.join( if output_name:
values["-OUTPUT FOLDER-"], values["-OUTPUT FILE LIST-"][0] 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["-TOUT-"].update(filename)
window["-IMAGE-"].update(filename=filename) window["-IMAGE-"].update(filename=filename)
except FileNotFoundError: except FileNotFoundError:
@@ -175,7 +180,7 @@ class Gui:
title='FileNotFoundError',) title='FileNotFoundError',)
except Exception as e: except Exception as e:
sg.popup_cancel(str(e), title='Error') 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: except:
logging.error('Try to open a .png. Unknown error.') logging.error('Try to open a .png. Unknown error.')
pass pass

View File

@@ -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 == '': if output_path == '':
raise NoPathError raise NoPathError
if output_name:
output_path = output_path + '/' + output_name
try: try:
file_list = os.listdir(output_path) file_list = os.listdir(output_path)
except: except: