+ settings work for now

This commit is contained in:
oleting
2021-01-04 20:00:14 +01:00
parent 02b25355db
commit fbec8d2f18
2 changed files with 16 additions and 42 deletions

View File

@@ -1,5 +1,5 @@
from gui.utils import nassi, output from gui.utils import nassi, output
from gui.new_window_layouts import Layout_popup, Layout_std, Layout_settings from gui.new_window_layouts import Layout_std, Layout_settings
from errors.custom import JavaSyntaxError, ScopeNotFoundException, InterpreterException, NoPathError from errors.custom import JavaSyntaxError, ScopeNotFoundException, InterpreterException, NoPathError
from interpreter.NassiShneidermann import OB from interpreter.NassiShneidermann import OB
@@ -67,27 +67,18 @@ class Gui:
window_settings = sg.Window(title='Settings', layout=layout_settings.layout, resizable=False) window_settings = sg.Window(title='Settings', layout=layout_settings.layout, resizable=False)
event_settings, values_settings = window_settings.read() event_settings, values_settings = window_settings.read()
while event_settings != '-EXIT-': while event_settings != '-EXIT-':
if event_settings == '-CONFLICT_BEHAVIOUR-': if event_settings == '-OVERWRITE-' and exists_choice != OB.OVERWWRITE:
layout_p = Layout_popup()
popup_3_choice = sg.Window(
title='', no_titlebar=True, layout=layout_p.layout, resizable=False)
event_popup, values_popup = popup_3_choice.read()
while event_popup != '-OVERWRITE-' or event_popup != '-EXPICIT-' or event_popup != '-SKIP-':
if event_popup == '-OVERWRITE-':
exists_choice = OB.OVERWWRITE exists_choice = OB.OVERWWRITE
break break
if event_popup == '-EXPICIT-': if event_settings == '-EXPICIT-' and exists_choice != OB.RANDOM_NAME:
exists_choice = OB.RANDOM_NAME exists_choice = OB.RANDOM_NAME
break break
if event_popup == '-SKIP-': if event_settings == '-SKIP-' and exists_choice != OB.SKIP:
exists_choice = OB.SKIP exists_choice = OB.SKIP
break break
if event_popup == sg.WIN_CLOSED or event == 'Exit':
break
popup_3_choice.close()
if event_settings == sg.WIN_CLOSED or event == 'Quit': if event_settings == sg.WIN_CLOSED or event == 'Quit':
break break
window_settings.close() window_settings.close()
if event == '-CREATE-': if event == '-CREATE-':
logging.debug(('event = ' + str(event) + logging.debug(('event = ' + str(event) +

View File

@@ -124,27 +124,7 @@ class Layout_settings():
choices = [ choices = [
[ [
sg.Button(button_text='conflict_behaviour', key='-CONFLICT_BEHAVIOUR-'), sg.Text('What should the program do if a file already exist?'),
]
]
self.layout = [
[
sg.Column(text_column),
sg.Column(choices),
]
]
class Layout_popup:
def __init__(self):
text_column = [
[
sg.Text('What should the program do if a file already exist?')
]
]
choices = [
[
sg.Button(button_text='skip', key='-SKIP-'), sg.Button(button_text='skip', key='-SKIP-'),
sg.Button(button_text='overwrite', key='-OVERWRITE-'), sg.Button(button_text='overwrite', key='-OVERWRITE-'),
sg.Button(button_text='create expicit name', key='-EXPICIT-'), sg.Button(button_text='create expicit name', key='-EXPICIT-'),
@@ -157,3 +137,6 @@ class Layout_popup:
] ]
] ]