cleanup @oleting
This commit is contained in:
@@ -5,6 +5,7 @@ __author__ = "Weckyy702"
|
|||||||
|
|
||||||
|
|
||||||
from typing import Dict, List, Optional
|
from typing import Dict, List, Optional
|
||||||
|
import typing
|
||||||
from PySimpleGUI import one_line_progress_meter
|
from PySimpleGUI import one_line_progress_meter
|
||||||
import logging
|
import logging
|
||||||
from enum import IntEnum
|
from enum import IntEnum
|
||||||
@@ -51,7 +52,7 @@ class NassiShneidermanDiagram:
|
|||||||
if os.path.exists(filepath + ".png"):
|
if os.path.exists(filepath + ".png"):
|
||||||
if behavoiur == OB.SKIP:
|
if behavoiur == OB.SKIP:
|
||||||
return None
|
return None
|
||||||
elif behavoiur == OB.OVERWWRITE:
|
elif behavoiur == OB.OVERWRITE:
|
||||||
return filepath
|
return filepath
|
||||||
else:
|
else:
|
||||||
while os.path.exists(filepath+".png"):
|
while os.path.exists(filepath+".png"):
|
||||||
@@ -59,12 +60,9 @@ class NassiShneidermanDiagram:
|
|||||||
return filepath
|
return filepath
|
||||||
return filepath
|
return filepath
|
||||||
|
|
||||||
def convert_to_image(self, output_path: str, on_conflict: Overwrite_behaviour=OB.SKIP) -> bool:
|
def convert_to_image(self, output_path: str, on_conflict: Overwrite_behaviour=OB.SKIP):
|
||||||
i = 0
|
i = 1
|
||||||
for scope in self.function_scopes:
|
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 = f"{output_path}/{scope.name}"
|
||||||
filepath = self.check_conflicts(filepath, on_conflict)
|
filepath = self.check_conflicts(filepath, on_conflict)
|
||||||
@@ -80,11 +78,8 @@ class NassiShneidermanDiagram:
|
|||||||
logging.error(f"Failed to save image {filepath}. Unknown error")
|
logging.error(f"Failed to save image {filepath}. Unknown error")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
#This is also bad
|
#yield i #for reporting progress
|
||||||
if not cancel:
|
|
||||||
return False
|
|
||||||
i+=1
|
i+=1
|
||||||
return True
|
|
||||||
|
|
||||||
def load_from_file(self, filepath:str, itp_custom_tags: Optional[Dict[str, List[str]]]):
|
def load_from_file(self, filepath:str, itp_custom_tags: Optional[Dict[str, List[str]]]):
|
||||||
itp = JavaInterpreter(filepath)
|
itp = JavaInterpreter(filepath)
|
||||||
|
|||||||
Reference in New Issue
Block a user