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