+ new Layout
This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -8,7 +8,7 @@
|
|||||||
"name": "Python: Aktuelle Datei",
|
"name": "Python: Aktuelle Datei",
|
||||||
"type": "python",
|
"type": "python",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "debug.py",
|
"program": "run.py",
|
||||||
"console": "integratedTerminal"
|
"console": "integratedTerminal"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -6,3 +6,6 @@ class JavaSyntaxError(Exception):
|
|||||||
|
|
||||||
class ScopeNotFoundException(Exception):
|
class ScopeNotFoundException(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class NoPathError(Exception):
|
||||||
|
pass
|
||||||
25
gui/gui.py
25
gui/gui.py
@@ -1,5 +1,5 @@
|
|||||||
from gui.utils import nassi, output
|
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
|
from enum import IntEnum
|
||||||
import PySimpleGUI as sg
|
import PySimpleGUI as sg
|
||||||
@@ -59,8 +59,12 @@ class Gui:
|
|||||||
|
|
||||||
toolbar = [
|
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.ButtonMenu('', menu_def),
|
||||||
sg.Button('TEST')
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -104,7 +108,7 @@ class Gui:
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
sg.Listbox(
|
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.Column(input_column),
|
||||||
sg.VSeparator(),
|
sg.VSeparator(),
|
||||||
sg.Column(execute_column),
|
#sg.Column(execute_column),
|
||||||
sg.VSeparator(),
|
sg.VSeparator(),
|
||||||
sg.Column(file_list_column),
|
sg.Column(file_list_column),
|
||||||
sg.VSeparator(),
|
sg.VSeparator(),
|
||||||
|
sg.VSeparator(),
|
||||||
sg.Column(diagramm_viewer_column),
|
sg.Column(diagramm_viewer_column),
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
@@ -149,7 +154,7 @@ class Gui:
|
|||||||
|
|
||||||
logging.debug('init layout 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
|
return window
|
||||||
|
|
||||||
@@ -308,8 +313,14 @@ class Gui:
|
|||||||
# output view
|
# output view
|
||||||
|
|
||||||
if event == '-REFRESH-':
|
if event == '-REFRESH-':
|
||||||
fnames = output(values)
|
try:
|
||||||
window['-OUTPUT FILE LIST-'].update(fnames)
|
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()
|
window.close()
|
||||||
if exists_choice:
|
if exists_choice:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
from errors.custom import NoPathError
|
||||||
from interpreter.NassiShneidermann import NassiShneidermanDiagram, Overwrite_behaviour, OB
|
from interpreter.NassiShneidermann import NassiShneidermanDiagram, Overwrite_behaviour, OB
|
||||||
from draw.Iinstruction import *
|
from draw.Iinstruction import *
|
||||||
|
|
||||||
@@ -17,6 +17,8 @@ def nassi(input_path: str, output_path: str, outputname: str, gui, behaviour: Ov
|
|||||||
|
|
||||||
def output(values):
|
def output(values):
|
||||||
output_path = values['-OUTPUT FOLDER-']
|
output_path = values['-OUTPUT FOLDER-']
|
||||||
|
if output_path == '':
|
||||||
|
raise NoPathError
|
||||||
try:
|
try:
|
||||||
file_list = os.listdir(output_path)
|
file_list = os.listdir(output_path)
|
||||||
except:
|
except:
|
||||||
|
|||||||
Reference in New Issue
Block a user