+ use utils

This commit is contained in:
oleting
2020-12-24 00:23:52 +01:00
parent 5c6cf88991
commit c26ca63a40
2 changed files with 20 additions and 23 deletions

View File

@@ -1,4 +1,4 @@
from gui.utils import nassi
from gui.utils import nassi, output
import PySimpleGUI as sg
import os.path
@@ -59,17 +59,7 @@ def gui():
break
if event == '-OUTPUT FOLDER-':
output_path = values['-OUTPUT FOLDER-']
try:
file_list = os.listdir(output_path)
except:
file_list = []
fnames = [
f
for f in file_list
if os.path.isfile(os.path.join(output_path, f))
and f.lower().endswith(('.png', '.gif'))
]
fnames = output(values)
window['-OUTPUT FILE LIST-'].update(fnames)
elif event == '-OUTPUT FILE LIST-':
try:
@@ -96,18 +86,9 @@ def gui():
except:
pass
output_path = values['-OUTPUT FOLDER-']
nassi(file_path, str(output_path))
try:
file_list = os.listdir(output_path)
except:
file_list = []
fnames = [
f
for f in file_list
if os.path.isfile(os.path.join(output_path, f))
and f.lower().endswith(('.png', '.gif'))
]
nassi(file_path, output_path)
fnames = output(values)
window['-OUTPUT FILE LIST-'].update(fnames)
elif values['-JAVA FOLDER-']:

View File

@@ -1,3 +1,5 @@
import os
from interpreter.NassiShneidermann import NassiShneidermanDiagram
from draw.Iinstruction import *
@@ -7,6 +9,20 @@ def nassi(filepath:str, output_path: str):
NSD.load_from_file(filepath)
NSD.convert_to_image(output_path + "/Nassi-Shneider-Diagramm", 500)
def output(values):
output_path = values['-OUTPUT FOLDER-']
try:
file_list = os.listdir(output_path)
except:
file_list = []
fnames = [
f
for f in file_list
if os.path.isfile(os.path.join(output_path, f))
and f.lower().endswith(('.png', '.gif'))
]
return fnames
if __name__ == "__main__":
"""Debugging"""
nassi("res/input/input.java", "res/output")