+ fix cancel on progressbar

This commit is contained in:
oleting
2021-01-05 00:46:30 +01:00
parent 63f65250a3
commit b2b4bd79d1
3 changed files with 18 additions and 8 deletions

View File

@@ -98,13 +98,18 @@ class Gui:
'You didn\'t set a name for the image, it will be named randomly.')
output_name = secrets.token_hex(16)
nassi(input_path=file_path, output_path=output_path, outputname=output_name, gui=self,
path = 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-'], output_name)
if path:
fnames = output(path)
sg.popup_annoying('Successfully created!', title='Created',
auto_close_duration=2, auto_close=True, text_color='green')
window['-OUTPUT FILE LIST-'].update(fnames)
else:
fnames = output(output_path, output_name)
sg.popup_annoying('There are some images created!', title='Cancel',
auto_close_duration=2, auto_close=True, text_color='green')
window['-OUTPUT FILE LIST-'].update(fnames)
except JavaSyntaxError as JsE:
logging.error(

View File

@@ -24,7 +24,10 @@ 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)
NSD.convert_to_image(output_directory, on_conflict=behaviour)
cancel = NSD.convert_to_image(output_directory, on_conflict=behaviour)
if not cancel:
return None
return output_directory

View File

@@ -62,7 +62,9 @@ class NassiShneidermanDiagram:
number_of_item = 1
for scope in self.function_scopes:
number_of_item += 1
one_line_progress_meter('Progress', number_of_item, len(self.function_scopes), '-PROGRESSBAR-')
cancel = one_line_progress_meter('Progress', number_of_item, len(self.function_scopes), '-PROGRESSBAR-')
if not cancel:
return False
filepath = f"{output_path}/{scope.name}"
filepath = self.check_conflicts(filepath, on_conflict)