organize code

This commit is contained in:
oleting
2020-12-27 20:36:35 +01:00
parent 7552c31ccf
commit 8a529cbe83
5 changed files with 49 additions and 46 deletions

View File

@@ -92,7 +92,6 @@ class Gui:
sg.VSeparator(),
sg.Column(file_list_column),
sg.VSeparator(),
sg.Column(diagramm_viewer_column),
]
]
@@ -112,45 +111,12 @@ class Gui:
while True:
logging.info('test')
event, values = window.read()
if event == 'Exit' or event == sg.WIN_CLOSED:
logging.debug(('Exit GUI'))
break
if event == '-SET OUTPUT NAME-':
output_name = values['-OUTPUT NAME-']
if event == '-CREDITS-':
sg.popup(
'This is made by Plexx, Weckyy and Oleting. Used PySimpleGUI and Pillow', title='Credits')
if event == '-DONATE-':
logging.debug(('event = ' + str(event)))
sg.popup_notify(
('You donated $' + str(random.randint(500, 100000000)) + '.'), title='Thanks')
if event == '-OUTPUT FOLDER-':
logging.debug(('event = ' + str(event) +
' value = ' + str(values['-OUTPUT FOLDER-'])))
fnames = output(values)
window['-OUTPUT FILE LIST-'].update(fnames)
elif event == '-OUTPUT FILE LIST-':
logging.debug(('event = ' + str(event) +
' value = ' + str(values['-OUTPUT FILE LIST-'])))
try:
filename = os.path.join(
values["-OUTPUT FOLDER-"], values["-OUTPUT FILE LIST-"][0]
)
window["-TOUT-"].update(filename)
window["-IMAGE-"].update(filename=filename)
except:
pass
if event == '-JAVA FOLDER-':
logging.debug(('event = ' + str(event) +
' value = ' + str(values['-JAVA FOLDER-'])))
folder = values['-JAVA FOLDER-']
window['-JAVA FOLDER-'].update(values['-JAVA FILE-'])
# execute Column
if event == '-CREATE-':
logging.debug(('event = ' + str(event) +
'values = ' + str(values)))
@@ -168,7 +134,6 @@ class Gui:
if file_there((output_path + '/' + output_name)) is True:
proceed = sg.popup_yes_no(
'File already exist! Continue?', title='File alreday exist!')
print(proceed)
if proceed == 'Yes':
nassi(filepath=file_path, output_path=output_path, outputname=output_name, gui=self,
font_filepath=font_filepath)
@@ -227,6 +192,45 @@ class Gui:
except:
pass
if event == '-CREDITS-':
sg.popup(
'This is made by Plexx, Weckyy and Oleting. Used PySimpleGUI and Pillow', title='Credits')
if event == '-DONATE-':
logging.debug(('event = ' + str(event)))
sg.popup_notify(
('You donated $' + str(random.randint(500, 100000000)) + '.'), title='Thanks')
# needed Input
if event == '-OUTPUT FOLDER-':
logging.debug(('event = ' + str(event) +
' value = ' + str(values['-OUTPUT FOLDER-'])))
fnames = output(values)
window['-OUTPUT FILE LIST-'].update(fnames)
elif event == '-OUTPUT FILE LIST-':
logging.debug(('event = ' + str(event) +
' value = ' + str(values['-OUTPUT FILE LIST-'])))
try:
filename = os.path.join(
values["-OUTPUT FOLDER-"], values["-OUTPUT FILE LIST-"][0]
)
window["-TOUT-"].update(filename)
window["-IMAGE-"].update(filename=filename)
except:
pass
if event == '-JAVA FOLDER-':
logging.debug(('event = ' + str(event) +
' value = ' + str(values['-JAVA FOLDER-'])))
folder = values['-JAVA FOLDER-']
window['-JAVA FOLDER-'].update(values['-JAVA FILE-'])
# optional Input
if event == '-SET OUTPUT NAME-':
output_name = values['-OUTPUT NAME-']
if event == '-TTF FOLDER-':
logging.debug(('event = ' + str(event) +
' value = ' + str(values['-TTF FOLDER-'])))