~ small fix

This commit is contained in:
oleting
2021-01-24 21:26:14 +01:00
parent 0265556055
commit 5e024f07f5
5 changed files with 23 additions and 10 deletions

View File

@@ -99,9 +99,12 @@ class Gui:
'You didn\'t set a name for the image, it will be named randomly.')
output_name = secrets.token_hex(16)
path = nassi(input_path=file_path, output_path=output_path, outputname=output_name, gui=self,
path, file_is_empty = 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)
if path:
if file_is_empty:
sg.popup_annoying('Our interpreter did not find anything. --> blame Kons or yourself!', title='Empty')
elif path:
fnames = output(path)
sg.popup_annoying('Successfully created!', title='Created',
auto_close_duration=2, auto_close=True, text_color='green')
@@ -163,10 +166,14 @@ class Gui:
# handle event select output folder
if event == '-OUTPUT FOLDER-':
try:
logging.debug(('event = ' + str(event) +
' value = ' + str(values['-OUTPUT FOLDER-'])))
fnames = output(values['-OUTPUT FOLDER-'])
window['-OUTPUT FILE LIST-'].update(fnames)
except Exception as e:
logging.error(str(e))
sg.popup_error(str(e))
elif event == '-OUTPUT FILE LIST-':
logging.debug(('event = ' + str(event) +
' value = ' + str(values['-OUTPUT FILE LIST-'])))

View File

@@ -23,13 +23,14 @@ def nassi(input_path: str, output_path: str, outputname: str, types, remove_tags
custom_tags = {"comments" : comments, "ignore" : remove_tags, "types" : types}
NSD.load_from_file(input_path, custom_tags)
is_empty = NSD.load_from_file(input_path, custom_tags)
cancel = NSD.convert_to_image(output_directory, on_conflict=behaviour)
if not cancel:
return None
return output_directory
return output_directory, is_empty

View File

@@ -85,3 +85,8 @@ class NassiShneidermanDiagram:
itp = JavaInterpreter(filepath)
itp.reset_tags(itp_custom_tags)
self.function_scopes = itp.load_instruction_scopes()
if not self.function_scopes:
return True
else:
return False