From fbec8d2f185460ae37b69c7431c532c03c8a4f85 Mon Sep 17 00:00:00 2001 From: oleting Date: Mon, 4 Jan 2021 20:00:14 +0100 Subject: [PATCH] + settings work for now --- gui/gui.py | 31 +++++++++++-------------------- gui/new_window_layouts.py | 27 +++++---------------------- 2 files changed, 16 insertions(+), 42 deletions(-) diff --git a/gui/gui.py b/gui/gui.py index fb5e170..5418796 100644 --- a/gui/gui.py +++ b/gui/gui.py @@ -1,5 +1,5 @@ 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 interpreter.NassiShneidermann import OB @@ -67,27 +67,18 @@ class Gui: window_settings = sg.Window(title='Settings', layout=layout_settings.layout, resizable=False) event_settings, values_settings = window_settings.read() while event_settings != '-EXIT-': - if event_settings == '-CONFLICT_BEHAVIOUR-': - 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 - break - if event_popup == '-EXPICIT-': - exists_choice = OB.RANDOM_NAME - break - if event_popup == '-SKIP-': - exists_choice = OB.SKIP - break - if event_popup == sg.WIN_CLOSED or event == 'Exit': - break - popup_3_choice.close() + if event_settings == '-OVERWRITE-' and exists_choice != OB.OVERWWRITE: + exists_choice = OB.OVERWWRITE + break + if event_settings == '-EXPICIT-' and exists_choice != OB.RANDOM_NAME: + exists_choice = OB.RANDOM_NAME + break + if event_settings == '-SKIP-' and exists_choice != OB.SKIP: + exists_choice = OB.SKIP + break if event_settings == sg.WIN_CLOSED or event == 'Quit': break + window_settings.close() if event == '-CREATE-': logging.debug(('event = ' + str(event) + diff --git a/gui/new_window_layouts.py b/gui/new_window_layouts.py index 9461b37..b206d6a 100644 --- a/gui/new_window_layouts.py +++ b/gui/new_window_layouts.py @@ -123,28 +123,8 @@ class Layout_settings(): ] choices = [ - [ - sg.Button(button_text='conflict_behaviour', key='-CONFLICT_BEHAVIOUR-'), - ] - ] - 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.Text('What should the program do if a file already exist?'), sg.Button(button_text='skip', key='-SKIP-'), sg.Button(button_text='overwrite', key='-OVERWRITE-'), sg.Button(button_text='create expicit name', key='-EXPICIT-'), @@ -157,3 +137,6 @@ class Layout_popup: ] ] + + +