diff --git a/gui/gui.py b/gui/gui.py index 463b14e..efcb2c6 100644 --- a/gui/gui.py +++ b/gui/gui.py @@ -63,8 +63,6 @@ class Gui: sg.Button(button_text='Credits', key='-CREDITS-'), # * fun feature sg.Button(button_text='Donate', key='-DONATE-'), - #sg.ButtonMenu('', menu_def), - ] ] @@ -83,7 +81,7 @@ class Gui: [ sg.Text('Output name'), sg.In(size=(25, 1), enable_events=True, key='-OUTPUT NAME-'), - sg.Button('Confirm', key='-SET OUTPUT NAME-'), + #sg.Button('Confirm', key='-SET OUTPUT NAME-'), ], [ sg.HSeparator(), @@ -97,6 +95,18 @@ class Gui: sg.FileBrowse(file_types=(('TTF-File', '*.ttf'), ('ALL Files', '*.*')), key='-TTF FILE-'), ], + [ + sg.Button(button_text='Add costum types', key='-TYPES-') + ], + [ + # modifier + sg.Button(button_text='Add costum modifier', key='-MODIFIER-') + # comments + ], + [ + sg.Button(button_text='Add costum comments', key='-COMMENTS-') + # comments + ], ] @@ -163,6 +173,9 @@ class Gui: font_filepath = None output_name = None exists_choice = None + types = None + comments = None + modifier = None sg.popup('The whole program is WIP.', auto_close=True, auto_close_duration=5) @@ -175,7 +188,7 @@ class Gui: logging.debug(('Exit GUI')) break - # execute Column + # toolbar if event == '-CREATE-': logging.debug(('event = ' + str(event) + 'values = ' + str(values))) @@ -213,7 +226,7 @@ class Gui: 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, types=types, remove_tages=modifier, comments=comments) fnames = output(values) sg.popup_annoying('Successfully created!', title='Created', @@ -266,6 +279,7 @@ class Gui: sg.popup_notify( ('You donated $' + str(random.randint(500, 100000000)) + '.'), title='Thanks') + # needed Input if event == '-OUTPUT FOLDER-': @@ -300,7 +314,7 @@ class Gui: # optional Input - if event == '-SET OUTPUT NAME-': + if event == '-OUTPUT NAME-': output_name = values['-OUTPUT NAME-'] if event == '-TTF FOLDER-': @@ -310,6 +324,30 @@ class Gui: window['-TTF FOLDER-'].update(values['-TTF FILE-']) font_filepath = values['-TTF FILE-'] + if event == '-TYPES-': + # + raw_types = sg.popup_get_text('Enter customn keywords (int, double, ...): ', default_text=types) + try: + raw_types = raw_types.replace(' ', '') + types = raw_types.split(',') + except: + sg.popup_error('You do not hit "Enter"') + + if event == '-MODIFIER-': + raw_modifier = sg.popup_get_text('Enter customn modifier (public, private, ...): ', default_text=modifier) + try: + raw_modifier = raw_modifier.replace(' ', '') + modifier = raw_modifier.split(',') + except: + sg.popup_error('You do not hit "Enter"') + + if event == '-COMMENTS-': + raw_comments = sg.popup_get_text('Enter customn comments (//, #, ...): ', default_text=comments) + try: + raw_comments = raw_comments.replace(' ', '') + comments = raw_comments.split(',') + except: + sg.popup_error('You do not hit "Enter"') # output view if event == '-REFRESH-': diff --git a/gui/utils.py b/gui/utils.py index 93feead..cb52ec5 100644 --- a/gui/utils.py +++ b/gui/utils.py @@ -5,8 +5,8 @@ from typing import Optional import os import logging - -def nassi(input_path: str, output_path: str, outputname: str, gui, behaviour: Overwrite_behaviour, font_filepath: Optional[str]=None): +#types=types, remove_tages=modifier, comments=comments +def nassi(input_path: str, output_path: str, outputname: str, types, remove_tags, comments, gui, behaviour: Overwrite_behaviour, font_filepath: Optional[str]=None): NSD = NassiShneidermanDiagram(gui.debug_mode) output_directory = output_path + '/' + outputname @@ -21,7 +21,7 @@ def nassi(input_path: str, output_path: str, outputname: str, gui, behaviour: Ov except: raise - NSD.load_from_file(input_path) + NSD.load_from_file(input_path, types, remove_tags, comments) NSD.convert_to_image(output_directory, on_conflict=behaviour, x_size=750) return output_directory