Merge branch 'main' of https://github.com/plexx-dev/Nassi-Shneiderman-Diagramm-Generator into main
This commit is contained in:
11
gui/gui.py
11
gui/gui.py
@@ -83,6 +83,7 @@ class Gui:
|
||||
[
|
||||
sg.Text('Output name'),
|
||||
sg.In(size=(25, 1), enable_events=True, key='-OUTPUT NAME-'),
|
||||
sg.Button('Confirm', key='-SET OUTPUT NAME-'),
|
||||
],
|
||||
[
|
||||
sg.HSeparator(),
|
||||
@@ -211,10 +212,10 @@ class Gui:
|
||||
'You didn\'t set a name for the image, it will be named randomly.')
|
||||
output_name = secrets.token_hex(16)
|
||||
|
||||
folder = nassi(input_path=file_path, output_path=output_path, outputname=output_name, gui=self,
|
||||
nassi(input_path=file_path, output_path=output_path, outputname=output_name, gui=self,
|
||||
font_filepath=font_filepath, behaviour=exists_choice)
|
||||
|
||||
fnames = output(folder=folder)
|
||||
fnames = output(values)
|
||||
sg.popup_annoying('Successfully created!', title='Created',
|
||||
auto_close_duration=2, auto_close=True, text_color='green')
|
||||
window['-OUTPUT FILE LIST-'].update(fnames)
|
||||
@@ -270,7 +271,7 @@ class Gui:
|
||||
if event == '-OUTPUT FOLDER-':
|
||||
logging.debug(('event = ' + str(event) +
|
||||
' value = ' + str(values['-OUTPUT FOLDER-'])))
|
||||
fnames = output(values['-OUTPUT FOLDER-'])
|
||||
fnames = output(values)
|
||||
window['-OUTPUT FILE LIST-'].update(fnames)
|
||||
elif event == '-OUTPUT FILE LIST-':
|
||||
logging.debug(('event = ' + str(event) +
|
||||
@@ -299,7 +300,7 @@ class Gui:
|
||||
|
||||
# optional Input
|
||||
|
||||
if event == '-OUTPUT NAME-':
|
||||
if event == '-SET OUTPUT NAME-':
|
||||
output_name = values['-OUTPUT NAME-']
|
||||
|
||||
if event == '-TTF FOLDER-':
|
||||
@@ -313,7 +314,7 @@ class Gui:
|
||||
|
||||
if event == '-REFRESH-':
|
||||
try:
|
||||
fnames = output(values['-OUTPUT FOLDER-'])
|
||||
fnames = output(values)
|
||||
window['-OUTPUT FILE LIST-'].update(fnames)
|
||||
except NoPathError:
|
||||
pass
|
||||
|
||||
16
gui/utils.py
16
gui/utils.py
@@ -1,10 +1,9 @@
|
||||
import os
|
||||
from typing import Optional
|
||||
|
||||
from errors.custom import NoPathError
|
||||
from interpreter.NassiShneidermann import NassiShneidermanDiagram, Overwrite_behaviour, OB
|
||||
|
||||
from typing import Optional
|
||||
import os
|
||||
import logging
|
||||
|
||||
from draw.Iinstruction import *
|
||||
|
||||
def nassi(input_path: str, output_path: str, outputname: str, gui, behaviour: Overwrite_behaviour, font_filepath: Optional[str]=None):
|
||||
NSD = NassiShneidermanDiagram(gui.debug_mode)
|
||||
@@ -27,12 +26,9 @@ def nassi(input_path: str, output_path: str, outputname: str, gui, behaviour: Ov
|
||||
return output_directory
|
||||
|
||||
|
||||
def output(folder):
|
||||
if folder:
|
||||
output_path = folder
|
||||
else:
|
||||
raise
|
||||
|
||||
def output(values):
|
||||
output_path = values['-OUTPUT FOLDER-']
|
||||
if output_path == '':
|
||||
raise NoPathError
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user