+ small fix and small design change

This commit is contained in:
oleting
2020-12-25 09:13:53 +01:00
parent 4118e91f3c
commit 6ca6d493df

View File

@@ -3,15 +3,17 @@ import PySimpleGUI as sg
import os.path import os.path
import random import random
def gui(): def gui():
#sg.theme_previewer()
sg.theme('DarkGrey11') sg.theme('DarkGrey11')
java_file_list_column = [ java_file_list_column = [
[ [
sg.Text('Java File'), sg.Text('Java File'),
sg.In(size=(25, 1), enable_events=True, key="-JAVA FOLDER-"), sg.In(size=(25, 1), enable_events=True, key="-JAVA FOLDER-"),
sg.FileBrowse(file_types=(('Java-File', '*.java'), ('ALL Files','*.*')), key='-JAVA FILE-'), # ('ALL Files','*.*') sg.FileBrowse(file_types=(('Java-File', '*.java'), ('ALL Files',
'*.*')), key='-JAVA FILE-'), # ('ALL Files','*.*')
], ],
] ]
@@ -29,17 +31,17 @@ def gui():
] ]
diagramm_viewer_column = [ diagramm_viewer_column = [
[sg.Text("Choose your Code. ")], [sg.Text("Choose your Code for preview. ", size=(100, 10))],
[sg.Text(size=(40, 1), key="-TOUT-")], [sg.Text(size=(40, 1), key="-TOUT-")],
[sg.Image(key='-IMAGE-')], [sg.Image(key='-IMAGE-')],
] ]
buttons_column = [ buttons_column = [
[sg.Button(button_text='Create Image', key='-CREATE-')], [sg.Button(button_text='Create Image', key='-CREATE-')],
# * fun feature
[sg.Button(button_text='Donate', key='-DONATE-')], [sg.Button(button_text='Donate', key='-DONATE-')],
] ]
layout = [ layout = [
[ [
sg.Column(java_file_list_column), sg.Column(java_file_list_column),
@@ -60,7 +62,8 @@ def gui():
break break
if event == '-DONATE-': if event == '-DONATE-':
sg.popup_notify(('You donated $'+ str(random.randint(0, 1000000000000000)) + '.') , title='Thanks') sg.popup_notify(
('You donated $' + str(random.randint(0, 1000000000000000)) + '.'), title='Thanks')
if event == '-OUTPUT FOLDER-': if event == '-OUTPUT FOLDER-':
fnames = output(values) fnames = output(values)
@@ -90,20 +93,22 @@ def gui():
fnames = output(values) fnames = output(values)
window['-OUTPUT FILE LIST-'].update(fnames) window['-OUTPUT FILE LIST-'].update(fnames)
sg.popup_notify('Succsessful created!' , title='Created') sg.popup_notify('Succsessful created!',
title='Created')
except: except:
pass pass
elif values['-JAVA FOLDER-']: elif values['-JAVA FOLDER-']:
print('No Output') print('No Output')
sg.popup_annoying('No Output' , title='Error', auto_close_duration=5, auto_close=True) sg.popup_annoying('No Output', title='Error',
auto_close_duration=5, auto_close=True)
elif values['-OUTPUT FOLDER-']: elif values['-OUTPUT FOLDER-']:
print('No Input') print('No Input')
sg.popup_annoying('No Input' , title='Error', auto_close_duration=5, auto_close=True) sg.popup_annoying('No Input', title='Error',
auto_close_duration=5, auto_close=True)
else: else:
sg.popup_annoying('Unexpected Case!' , title='Error') sg.popup_annoying('Unexpected Case!', title='Error')
except: except:
pass pass