+ fix cancel on progressbar
This commit is contained in:
17
gui/gui.py
17
gui/gui.py
@@ -98,13 +98,18 @@ class Gui:
|
|||||||
'You didn\'t set a name for the image, it will be named randomly.')
|
'You didn\'t set a name for the image, it will be named randomly.')
|
||||||
output_name = secrets.token_hex(16)
|
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)
|
font_filepath=font_filepath, behaviour=exists_choice, types=types, remove_tags=modifier, comments=comments)
|
||||||
|
if path:
|
||||||
fnames = output(values['-OUTPUT FOLDER-'], output_name)
|
fnames = output(path)
|
||||||
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)
|
||||||
|
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:
|
except JavaSyntaxError as JsE:
|
||||||
logging.error(
|
logging.error(
|
||||||
|
|||||||
@@ -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}
|
custom_tags = {"comments" : comments, "ignore" : remove_tags, "types" : types}
|
||||||
|
|
||||||
NSD.load_from_file(input_path, custom_tags)
|
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
|
return output_directory
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,9 @@ class NassiShneidermanDiagram:
|
|||||||
number_of_item = 1
|
number_of_item = 1
|
||||||
for scope in self.function_scopes:
|
for scope in self.function_scopes:
|
||||||
number_of_item += 1
|
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 = f"{output_path}/{scope.name}"
|
||||||
filepath = self.check_conflicts(filepath, on_conflict)
|
filepath = self.check_conflicts(filepath, on_conflict)
|
||||||
|
|||||||
Reference in New Issue
Block a user