This commit is contained in:
weckyy702
2020-12-21 13:39:26 +01:00
11 changed files with 31 additions and 11 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
__pycache__/
res/output/
res/input/

15
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Aktuelle Datei",
"type": "python",
"request": "launch",
"program": "gui.py",
"console": "integratedTerminal"
}
]
}

View File

@@ -131,5 +131,5 @@ if __name__ == "__main__":
if_instruction("shouldNiet()", [ generic_instruction("hiet()") ], [generic_instruction("hiet()")]),
])
NSD_init(500, 500)
test.to_image(0, 0, 250, 500)
test.to_image(0, 0, 500, 500)
NSD_save("Iinstruction")

Binary file not shown.

View File

@@ -17,15 +17,15 @@ def NSD_init(x: float, y: float):
img = Image.new("RGB", (x, y), "white")
output_img = ImageDraw.Draw(img)
#font = ImageFont.load_default()
font = ImageFont.truetype("res/fonts/NotoSans-Regular.ttf", 12)
font = ImageFont.truetype("res/fonts/SpaceGrotesk-Light.ttf", 12)
def draw_generic_instruction(instruction: str, x, y, xsize, ysize) -> Iterable[float]:
if not output_img:
raise Exception("Output image was not initialized! Make sure to call NSD_init first")
#size shit
text_y_size = font.getsize(instruction, direction="ltr")[1]
ysize = max(text_y_size, ysize) # ensure it is alway at least big enought to fit the text
#text_y_size = font.getsize(instruction, direction="ltr")[1]
#ysize = max(text_y_size, ysize) # ensure it is alway at least big enought to fit the text
#draw shit
output_img.rectangle((x,y) + (x + xsize, y + ysize), outline=(0), width=1)

12
gui.py
View File

@@ -4,6 +4,9 @@ from to_nassi import nassi
import PySimpleGUI as sg
import os.path
#sg.theme_previewer()
sg.theme('DarkGrey11')
java_file_list_column = [
[
sg.Text('Java Folder'),
@@ -42,13 +45,14 @@ layout = [
[
sg.Column(java_file_list_column),
sg.VSeparator(),
sg.Column(file_list_column),
sg.VSeparator(),
#sg.Column(file_list_column),
#sg.VSeparator(),
sg.Column(diagramm_viewer_column),
]
]
window = sg.Window('Nassi Viewer', layout)
window = sg.Window('Nassi Viewer', layout, resizable=True)
while True:
event, values = window.read()
@@ -80,7 +84,6 @@ while True:
pass
if event == '-JAVA FOLDER-':
folder = values['-JAVA FOLDER-']
print(folder)
try:
file_list = os.listdir(folder)
except:
@@ -105,5 +108,4 @@ while True:
pass
window.close()

Binary file not shown.

View File

@@ -5,4 +5,4 @@ from Iinstruction import *
def nassi(filepath):
NSD = NassiShneidermanDiagram(True)
NSD.load_from_file(filepath)
NSD.convert_to_image("Nina", 500)
NSD.convert_to_image("Nassi-Shneider-Diagramm", 500)