Merge branch 'main' of https://github.com/plexx-dev/Nassi-Shneiderman-Diagramm-Generator into main
This commit is contained in:
@@ -39,14 +39,14 @@ class NassiShneidermanDiagram:
|
|||||||
h += inst.getblksize()
|
h += inst.getblksize()
|
||||||
return int(h)
|
return int(h)
|
||||||
|
|
||||||
def _save_scope(self, scope_name: str, scope_instructions: List[Iinstruction]):
|
def _save_scope(self, scope_index: int, output_path: str, x_size: int):
|
||||||
"""DEBUGING ONLY"""
|
"""DEBUGING ONLY"""
|
||||||
image_y_sz = 1000
|
scope = self.function_scopes[scope_index]
|
||||||
x, y, = 0, 0
|
image_y_sz = self._get_image_height(scope_index)
|
||||||
with NSD_writer(f"./{scope_name}", 1000, image_y_sz):
|
with NSD_writer(output_path, x_size, image_y_sz):
|
||||||
x, y = 0, 0
|
x, y = 0, 0
|
||||||
for instruction in scope_instructions:
|
for instruction in scope.contents:
|
||||||
x, y = instruction.to_image(x, y, 1000)
|
x, y = instruction.to_image(x, y, x_size)
|
||||||
|
|
||||||
def check_conflicts(self, filepath:str, behavoiur: Overwrite_behaviour):
|
def check_conflicts(self, filepath:str, behavoiur: Overwrite_behaviour):
|
||||||
if os.path.exists(filepath + ".png"):
|
if os.path.exists(filepath + ".png"):
|
||||||
@@ -67,16 +67,11 @@ class NassiShneidermanDiagram:
|
|||||||
if filepath is not None:
|
if filepath is not None:
|
||||||
logging.info(f"Saving NSD to {filepath}...")
|
logging.info(f"Saving NSD to {filepath}...")
|
||||||
|
|
||||||
image_y_sz = self._get_image_height(i)
|
|
||||||
try:
|
try:
|
||||||
with NSD_writer(filepath, x_size, image_y_sz):
|
self._save_scope(i, filepath, x_size)
|
||||||
scope = self.function_scopes[i].contents
|
|
||||||
x, y = 0, 0
|
|
||||||
for instruction in scope:
|
|
||||||
x, y = instruction.to_image(x, y, x_size)
|
|
||||||
logging.info("Done!")
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"Failed to save image {filepath} with error '{e}'")
|
logging.error(f"Failed to save image {filepath} with error '{e}'")
|
||||||
|
raise e
|
||||||
except:
|
except:
|
||||||
logging.error(f"Failed to save image {filepath}. Unknown error")
|
logging.error(f"Failed to save image {filepath}. Unknown error")
|
||||||
raise
|
raise
|
||||||
|
|||||||
Reference in New Issue
Block a user