+ fix prieview after create

This commit is contained in:
oleting
2020-12-23 23:58:00 +01:00
parent e1cabd5ab0
commit dca758b597
3 changed files with 18 additions and 5 deletions

21
gui.py
View File

@@ -60,15 +60,14 @@ while True:
if event == '-OUTPUT FOLDER-': if event == '-OUTPUT FOLDER-':
output_path = values['-OUTPUT FOLDER-'] output_path = values['-OUTPUT FOLDER-']
folder = values['-OUTPUT FOLDER-']
try: try:
file_list = os.listdir(folder) file_list = os.listdir(output_path)
except: except:
file_list = [] file_list = []
fnames = [ fnames = [
f f
for f in file_list for f in file_list
if os.path.isfile(os.path.join(folder, f)) if os.path.isfile(os.path.join(output_path, f))
and f.lower().endswith(('.png', '.gif')) and f.lower().endswith(('.png', '.gif'))
] ]
window['-OUTPUT FILE LIST-'].update(fnames) window['-OUTPUT FILE LIST-'].update(fnames)
@@ -95,8 +94,22 @@ while True:
sg.popup_annoying('Succsessful created!' , title='Info') sg.popup_annoying('Succsessful created!' , title='Info')
except: except:
print('No file selected') pass
output_path = values['-OUTPUT FOLDER-']
nassi(file_path, str(output_path)) nassi(file_path, str(output_path))
try:
file_list = os.listdir(output_path)
except:
file_list = []
fnames = [
f
for f in file_list
if os.path.isfile(os.path.join(output_path, f))
and f.lower().endswith(('.png', '.gif'))
]
window['-OUTPUT FILE LIST-'].update(fnames)
elif values['-JAVA FOLDER-']: elif values['-JAVA FOLDER-']:
print('No Output') print('No Output')
sg.popup_annoying('No Output' , title='Error', auto_close_duration=5, auto_close=True) sg.popup_annoying('No Output' , title='Error', auto_close_duration=5, auto_close=True)