+ add settings WIP

This commit is contained in:
oleting
2021-01-04 19:30:22 +01:00
parent c7875f45d7
commit 02b25355db
3 changed files with 50 additions and 25 deletions

View File

@@ -1,5 +1,5 @@
from gui.utils import nassi, output
from gui.new_window_layouts import Layout_popup, Layout_std
from gui.new_window_layouts import Layout_popup, Layout_std, Layout_settings
from errors.custom import JavaSyntaxError, ScopeNotFoundException, InterpreterException, NoPathError
from interpreter.NassiShneidermann import OB
@@ -32,9 +32,9 @@ class Gui:
sg.theme(theme)
layout_s = Layout_std(theme=theme)
layoutStd = layout_s.layout()
window = sg.Window('Nassi Viewer', layoutStd, resizable=False)
layout_s = Layout_std()
# layoutStd = layout_s.layout()
window = sg.Window('Nassi Viewer', layout_s.layout_with_toolbar, resizable=False)
return window
@@ -44,7 +44,7 @@ class Gui:
font_filepath = None
output_name = None
exists_choice = None
exists_choice = OB.SKIP
types = None
comments = None
modifier = None
@@ -61,17 +61,16 @@ class Gui:
break
# toolbar
if event == '-CREATE-':
logging.debug(('event = ' + str(event) +
'values = ' + str(values)))
try:
if values['-JAVA IN-'] and values['-OUTPUT FOLDER-']:
logging.debug(
('Try create Image with values = ' + str(values)))
if event =='-SETTINGS-':
layout_settings = Layout_settings()
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)
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-':
@@ -84,9 +83,20 @@ class Gui:
if event_popup == '-SKIP-':
exists_choice = OB.SKIP
break
if event == sg.WIN_CLOSED or event == 'Quit':
if event_popup == sg.WIN_CLOSED or event == 'Exit':
break
popup_3_choice.close()
if event_settings == sg.WIN_CLOSED or event == 'Quit':
break
window_settings.close()
if event == '-CREATE-':
logging.debug(('event = ' + str(event) +
'values = ' + str(values)))
try:
if values['-JAVA IN-'] and values['-OUTPUT FOLDER-']:
logging.debug(
('Try create Image with values = ' + str(values)))
try:
file_path = os.path.join(
values["-JAVA IN-"],
@@ -244,6 +254,4 @@ class Gui:
window.close()
# if the own popwp is there close it
if exists_choice:
popup_3_choice.close()

View File

@@ -2,15 +2,12 @@ import PySimpleGUI as sg
class Layout_std:
def __init__(self, theme: str):
self.theme = theme
def layout(self):
sg.theme(self.theme)
def __init__(self):
toolbar = [
[
sg.Button(button_text='Create Image', key='-CREATE-'),
sg.Button(button_text='Credits', key='-CREDITS-'),
sg.Button(button_text='Settings', key='-SETTINGS-'),
# * fun feature
sg.Button(button_text='Donate', key='-DONATE-'),
]
@@ -104,7 +101,7 @@ class Layout_std:
]
]
layout_with_toolbar = [
self.layout_with_toolbar = [
[
sg.Column(toolbar)
],
@@ -116,7 +113,27 @@ class Layout_std:
]
]
return layout_with_toolbar
class Layout_settings():
def __init__(self):
text_column = [
[
sg.Text('conflict_behaviour')
]
]
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):