+ toolbar WIP
This commit is contained in:
63
gui/gui.py
63
gui/gui.py
@@ -9,7 +9,9 @@ import secrets
|
||||
import logging
|
||||
import time
|
||||
|
||||
#new popup
|
||||
# new popup
|
||||
|
||||
|
||||
class layout_popup:
|
||||
def __init__(self):
|
||||
text_column = [
|
||||
@@ -26,12 +28,13 @@ class layout_popup:
|
||||
]
|
||||
]
|
||||
self.layout = [
|
||||
[
|
||||
sg.Column(text_column),
|
||||
sg.Column(choices),
|
||||
]
|
||||
[
|
||||
sg.Column(text_column),
|
||||
sg.Column(choices),
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
class Gui:
|
||||
|
||||
def __init__(self, theme: str, debug_mode: bool):
|
||||
@@ -51,6 +54,16 @@ class Gui:
|
||||
sg.theme(theme)
|
||||
logging.debug(('Theme = ' + theme))
|
||||
|
||||
|
||||
|
||||
|
||||
toolbar = [
|
||||
[
|
||||
#sg.ButtonMenu('', menu_def),
|
||||
sg.Button('TEST')
|
||||
]
|
||||
]
|
||||
|
||||
input_column = [
|
||||
[
|
||||
sg.Text('Java File'),
|
||||
@@ -85,7 +98,9 @@ class Gui:
|
||||
|
||||
file_list_column = [
|
||||
[
|
||||
sg.Text('Output folder')
|
||||
sg.Text('Output folder'),
|
||||
|
||||
sg.Button(button_text='Refresh', key='-REFRESH-')
|
||||
],
|
||||
[
|
||||
sg.Listbox(
|
||||
@@ -120,12 +135,21 @@ class Gui:
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
layout_with_toolbar = [
|
||||
[
|
||||
sg.Column(toolbar)
|
||||
],
|
||||
[
|
||||
sg.HSeparator(),
|
||||
],
|
||||
[
|
||||
sg.Column(layout)
|
||||
]
|
||||
]
|
||||
|
||||
logging.debug('init layout GUI')
|
||||
|
||||
window = sg.Window('Nassi Viewer', layout, resizable=True)
|
||||
|
||||
window = sg.Window('Nassi Viewer', layout_with_toolbar, resizable=True)
|
||||
|
||||
return window
|
||||
|
||||
@@ -161,7 +185,8 @@ class Gui:
|
||||
('Try create Image with values = ' + str(values)))
|
||||
|
||||
layout_p = layout_popup()
|
||||
popup_3_choice = sg.Window(title='',no_titlebar=True, layout=layout_p.layout, resizable=False)
|
||||
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-':
|
||||
@@ -183,15 +208,16 @@ class Gui:
|
||||
)
|
||||
output_path = values['-OUTPUT FOLDER-']
|
||||
if output_name is None:
|
||||
sg.popup_auto_close('You didn\'t set a name for the image, it will be named randomly.')
|
||||
output_name = secrets.token_hex(16)
|
||||
sg.popup_auto_close(
|
||||
'You didn\'t set a name for the image, it will be named randomly.')
|
||||
output_name = secrets.token_hex(16)
|
||||
|
||||
nassi(input_path=file_path, output_path=output_path, outputname=output_name, gui=self,
|
||||
font_filepath=font_filepath, behaviour=exists_choice)
|
||||
font_filepath=font_filepath, behaviour=exists_choice)
|
||||
|
||||
fnames = output(values)
|
||||
sg.popup_annoying('Successfully created!', title='Created',
|
||||
auto_close_duration=2, auto_close=True, text_color='green')
|
||||
auto_close_duration=2, auto_close=True, text_color='green')
|
||||
window['-OUTPUT FILE LIST-'].update(fnames)
|
||||
|
||||
except JavaSyntaxError as JsE:
|
||||
@@ -255,6 +281,9 @@ class Gui:
|
||||
)
|
||||
window["-TOUT-"].update(filename)
|
||||
window["-IMAGE-"].update(filename=filename)
|
||||
except FileNotFoundError:
|
||||
sg.popup_error('FileNotFoundError',
|
||||
title='FileNotFoundError',)
|
||||
except:
|
||||
pass
|
||||
|
||||
@@ -276,6 +305,12 @@ class Gui:
|
||||
window['-TTF FOLDER-'].update(values['-TTF FILE-'])
|
||||
font_filepath = values['-TTF FILE-']
|
||||
|
||||
# output view
|
||||
|
||||
if event == '-REFRESH-':
|
||||
fnames = output(values)
|
||||
window['-OUTPUT FILE LIST-'].update(fnames)
|
||||
|
||||
window.close()
|
||||
if exists_choice:
|
||||
popup_3_choice.close()
|
||||
Reference in New Issue
Block a user