From 53dc4fb2335a8285d74521cd00162fdec2d53e73 Mon Sep 17 00:00:00 2001 From: oleting Date: Mon, 28 Dec 2020 17:44:30 +0100 Subject: [PATCH] wip push --- .vscode/launch.json | 2 +- gui/gui.py | 22 +++------------------- gui/utils.py | 8 +------- 3 files changed, 5 insertions(+), 27 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index e80f071..1ded7e8 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,7 +8,7 @@ "name": "Python: Aktuelle Datei", "type": "python", "request": "launch", - "program": "debug.py", + "program": "run.py", "console": "integratedTerminal" } ] diff --git a/gui/gui.py b/gui/gui.py index 23a0307..af39a26 100644 --- a/gui/gui.py +++ b/gui/gui.py @@ -49,7 +49,7 @@ class Gui: sg.HSeparator(), ], [ - sg.Text('Optional: choose custom font and name.'), + sg.Text('Optional: choose custom font.'), ], [ sg.Text('TTF File'), @@ -137,24 +137,8 @@ class Gui: if file_there((output_path + '/' + output_name)) is True: proceed = sg.popup_yes_no( 'File already exists! Continue?', title='File alreday exists!') - if proceed == 'Yes': - nassi(filepath=file_path, output_path=output_path, outputname=output_name, gui=self, - font_filepath=font_filepath) - - - fnames = output(values) - sg.popup_annoying('Successfully created!', title='Created', - auto_close_duration=2, auto_close=True, text_color='green') - window['-OUTPUT FILE LIST-'].update(fnames) - elif proceed == 'No': - logging.warning('Cancelled. No image created') - else: - logging.warning( - 'You did not make a decision! Try again!') - sg.popup_annoying('You did not make a decision! Try again!', title='FAIL', - auto_close_duration=2, auto_close=True, text_color='orange') - else: - nassi(filepath=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, font_filepath=font_filepath) fnames = output(values) diff --git a/gui/utils.py b/gui/utils.py index 401e23b..cee5b3c 100644 --- a/gui/utils.py +++ b/gui/utils.py @@ -33,10 +33,4 @@ def output(values): def file_there(file): - try: - open((file + '.png')) - return True - except FileNotFoundError: - return False - except: - raise + return os.path.exists(str(file))