+ new Layout

This commit is contained in:
oleting
2020-12-29 00:00:31 +01:00
parent ff2ea29c5d
commit 311d0d5604
4 changed files with 25 additions and 9 deletions

2
.vscode/launch.json vendored
View File

@@ -8,7 +8,7 @@
"name": "Python: Aktuelle Datei",
"type": "python",
"request": "launch",
"program": "debug.py",
"program": "run.py",
"console": "integratedTerminal"
}
]

View File

@@ -6,3 +6,6 @@ class JavaSyntaxError(Exception):
class ScopeNotFoundException(Exception):
pass
class NoPathError(Exception):
pass

View File

@@ -1,5 +1,5 @@
from gui.utils import nassi, output
from interpreter.interpret_source import JavaSyntaxError, ScopeNotFoundException, InterpreterException
from errors.custom import JavaSyntaxError, ScopeNotFoundException, InterpreterException, NoPathError
from enum import IntEnum
import PySimpleGUI as sg
@@ -59,8 +59,12 @@ class Gui:
toolbar = [
[
sg.Button(button_text='Create Image', key='-CREATE-'),
sg.Button(button_text='Credits', key='-CREDITS-'),
# * fun feature
sg.Button(button_text='Donate', key='-DONATE-'),
#sg.ButtonMenu('', menu_def),
sg.Button('TEST')
]
]
@@ -104,7 +108,7 @@ class Gui:
],
[
sg.Listbox(
values=[], enable_events=True, size=(40, 20), key="-OUTPUT FILE LIST-"
values=[], enable_events=True, size=(40, 20), key="-OUTPUT FILE LIST-",
)
],
]
@@ -127,10 +131,11 @@ class Gui:
[
sg.Column(input_column),
sg.VSeparator(),
sg.Column(execute_column),
#sg.Column(execute_column),
sg.VSeparator(),
sg.Column(file_list_column),
sg.VSeparator(),
sg.VSeparator(),
sg.Column(diagramm_viewer_column),
]
]
@@ -149,7 +154,7 @@ class Gui:
logging.debug('init layout GUI')
window = sg.Window('Nassi Viewer', layout_with_toolbar, resizable=True)
window = sg.Window('Nassi Viewer', layout_with_toolbar, resizable=False)
return window
@@ -308,8 +313,14 @@ class Gui:
# output view
if event == '-REFRESH-':
try:
fnames = output(values)
window['-OUTPUT FILE LIST-'].update(fnames)
except NoPathError:
pass
sg.popup_error('You dont set an output path. Try again.')
except:
pass
window.close()
if exists_choice:

View File

@@ -1,7 +1,7 @@
import os
from typing import Optional
from errors.custom import NoPathError
from interpreter.NassiShneidermann import NassiShneidermanDiagram, Overwrite_behaviour, OB
from draw.Iinstruction import *
@@ -17,6 +17,8 @@ def nassi(input_path: str, output_path: str, outputname: str, gui, behaviour: Ov
def output(values):
output_path = values['-OUTPUT FOLDER-']
if output_path == '':
raise NoPathError
try:
file_list = os.listdir(output_path)
except: