From 46966dca7a3bfa0055f3e74230984c52628ad2a1 Mon Sep 17 00:00:00 2001 From: oleting Date: Tue, 5 Jan 2021 00:27:54 +0100 Subject: [PATCH] + add progress bar --- gui/gui.py | 2 +- gui/new_window_layouts.py | 10 ++++------ interpreter/NassiShneidermann.py | 5 +++++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/gui/gui.py b/gui/gui.py index 7a08b14..628b715 100644 --- a/gui/gui.py +++ b/gui/gui.py @@ -97,7 +97,7 @@ class Gui: 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, types=types, remove_tags=modifier, comments=comments) diff --git a/gui/new_window_layouts.py b/gui/new_window_layouts.py index b206d6a..32fa7d5 100644 --- a/gui/new_window_layouts.py +++ b/gui/new_window_layouts.py @@ -46,7 +46,7 @@ class Layout_std: sg.Text('TTF File'), sg.In(size=(25, 1), enable_events=True, key="-TTF FOLDER-"), sg.FileBrowse(file_types=(('TTF-File', '*.ttf'), ('ALL Files', - '*.*')), key='-TTF FILE-'), + '*.*')), key='-TTF FILE-'), ], [ sg.Button(button_text='Add costum types', key='-TYPES-') @@ -92,7 +92,7 @@ class Layout_std: [ sg.Column(input_column), sg.VSeparator(), - #sg.Column(execute_column), + # sg.Column(execute_column), sg.VSeparator(), sg.Column(file_list_column), sg.VSeparator(), @@ -107,7 +107,7 @@ class Layout_std: ], [ sg.HSeparator(), - ], + ], [ sg.Column(layout) ] @@ -123,7 +123,7 @@ class Layout_settings(): ] choices = [ - [ + [ sg.Text('What should the program do if a file already exist?'), sg.Button(button_text='skip', key='-SKIP-'), sg.Button(button_text='overwrite', key='-OVERWRITE-'), @@ -138,5 +138,3 @@ class Layout_settings(): ] - - diff --git a/interpreter/NassiShneidermann.py b/interpreter/NassiShneidermann.py index 227b55b..be8e214 100644 --- a/interpreter/NassiShneidermann.py +++ b/interpreter/NassiShneidermann.py @@ -1,6 +1,7 @@ from os import stat from interpreter.interpret_source import Function_scope from typing import Dict, List, Optional +from PySimpleGUI import one_line_progress_meter import logging from enum import IntEnum import os.path @@ -59,7 +60,11 @@ class NassiShneidermanDiagram: return filepath def convert_to_image(self, output_path: str, on_conflict: Overwrite_behaviour=OB.SKIP): + number_of_item = 1 for scope in self.function_scopes: + number_of_item += 1 + one_line_progress_meter('Progress', number_of_item, len(self.function_scopes), '-PROGRESSBAR-') + filepath = f"{output_path}/{scope.name}" filepath = self.check_conflicts(filepath, on_conflict) if filepath is not None: