From c5e4c56cf1e418ce12e03fef31a2ebfecdfbcb7f Mon Sep 17 00:00:00 2001 From: weckyy702 Date: Tue, 9 Feb 2021 16:02:33 +0100 Subject: [PATCH 1/2] so i dont have to merge --- interpreter/NassiShneidermann.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interpreter/NassiShneidermann.py b/interpreter/NassiShneidermann.py index b6e35cb..5ae77b3 100644 --- a/interpreter/NassiShneidermann.py +++ b/interpreter/NassiShneidermann.py @@ -62,6 +62,7 @@ class NassiShneidermanDiagram: def convert_to_image(self, output_path: str, on_conflict: Overwrite_behaviour=OB.SKIP) -> bool: i = 0 for scope in self.function_scopes: + #No. This is bad cancel = one_line_progress_meter('Progress', i+1, len(self.function_scopes), '-PROGRESSBAR-') @@ -79,6 +80,7 @@ class NassiShneidermanDiagram: logging.error(f"Failed to save image {filepath}. Unknown error") raise + #This is also bad if not cancel: return False i+=1 From 9fa32ac7f951adc8297d03854873502feb005d81 Mon Sep 17 00:00:00 2001 From: weckyy702 Date: Tue, 9 Feb 2021 16:11:43 +0100 Subject: [PATCH 2/2] cleanup @oleting --- interpreter/NassiShneidermann.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/interpreter/NassiShneidermann.py b/interpreter/NassiShneidermann.py index 5ae77b3..c6ba7da 100644 --- a/interpreter/NassiShneidermann.py +++ b/interpreter/NassiShneidermann.py @@ -5,6 +5,7 @@ __author__ = "Weckyy702" from typing import Dict, List, Optional +import typing from PySimpleGUI import one_line_progress_meter import logging from enum import IntEnum @@ -51,7 +52,7 @@ class NassiShneidermanDiagram: if os.path.exists(filepath + ".png"): if behavoiur == OB.SKIP: return None - elif behavoiur == OB.OVERWWRITE: + elif behavoiur == OB.OVERWRITE: return filepath else: while os.path.exists(filepath+".png"): @@ -59,12 +60,9 @@ class NassiShneidermanDiagram: return filepath return filepath - def convert_to_image(self, output_path: str, on_conflict: Overwrite_behaviour=OB.SKIP) -> bool: - i = 0 + def convert_to_image(self, output_path: str, on_conflict: Overwrite_behaviour=OB.SKIP): + i = 1 for scope in self.function_scopes: - #No. This is bad - cancel = one_line_progress_meter('Progress', i+1, len(self.function_scopes), '-PROGRESSBAR-') - filepath = f"{output_path}/{scope.name}" filepath = self.check_conflicts(filepath, on_conflict) @@ -80,11 +78,8 @@ class NassiShneidermanDiagram: logging.error(f"Failed to save image {filepath}. Unknown error") raise - #This is also bad - if not cancel: - return False + #yield i #for reporting progress i+=1 - return True def load_from_file(self, filepath:str, itp_custom_tags: Optional[Dict[str, List[str]]]): itp = JavaInterpreter(filepath)