diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..15d44ee --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +__pycache__/ +res/output/ +res/input/ \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..6e0fa0a --- /dev/null +++ b/.vscode/launch.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/Iinstruction.py b/Iinstruction.py index 7561dad..3adb39d 100644 --- a/Iinstruction.py +++ b/Iinstruction.py @@ -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") \ No newline at end of file diff --git a/__pycache__/Iinstruction.cpython-38.pyc b/__pycache__/Iinstruction.cpython-38.pyc deleted file mode 100644 index 6879772..0000000 Binary files a/__pycache__/Iinstruction.cpython-38.pyc and /dev/null differ diff --git a/__pycache__/NassiShneidermann.cpython-38.pyc b/__pycache__/NassiShneidermann.cpython-38.pyc deleted file mode 100644 index 31925b1..0000000 Binary files a/__pycache__/NassiShneidermann.cpython-38.pyc and /dev/null differ diff --git a/__pycache__/code_to_image.cpython-38.pyc b/__pycache__/code_to_image.cpython-38.pyc deleted file mode 100644 index 1a0869f..0000000 Binary files a/__pycache__/code_to_image.cpython-38.pyc and /dev/null differ diff --git a/__pycache__/to_nassi.cpython-38.pyc b/__pycache__/to_nassi.cpython-38.pyc deleted file mode 100644 index 600e92a..0000000 Binary files a/__pycache__/to_nassi.cpython-38.pyc and /dev/null differ diff --git a/code_to_image.py b/code_to_image.py index a5ee50c..6a36690 100644 --- a/code_to_image.py +++ b/code_to_image.py @@ -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) diff --git a/gui.py b/gui.py index 1ffa3ae..17b14c1 100644 --- a/gui.py +++ b/gui.py @@ -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: @@ -103,7 +106,6 @@ while True: except: pass - - + window.close() diff --git a/res/fonts/SpaceGrotesk-Light.ttf b/res/fonts/SpaceGrotesk-Light.ttf new file mode 100644 index 0000000..76a195f Binary files /dev/null and b/res/fonts/SpaceGrotesk-Light.ttf differ diff --git a/to_nassi.py b/to_nassi.py index 239e579..678caa4 100644 --- a/to_nassi.py +++ b/to_nassi.py @@ -5,4 +5,4 @@ from Iinstruction import * def nassi(filepath): NSD = NassiShneidermanDiagram(True) NSD.load_from_file(filepath) - NSD.convert_to_image("Nina", 500) \ No newline at end of file + NSD.convert_to_image("Nassi-Shneider-Diagramm", 500) \ No newline at end of file