import os import re import sys from webpicdownloader.model.WebPicDownloader import WebPicDownloader from webpicdownloader.controller.HomeController import HomeController from webpicdownloader.controller.InfoController import InfoController from webpicdownloader.controller.MainController import MainController from webpicdownloader.controller.Frames import Frames from webpicdownloader.view.HomeView import HomeView from webpicdownloader.view.InfoView import InfoView from webpicdownloader.view.MainWindow import MainWindow def get_sys_directory() -> str: """ Recover the path of the application's resources. """ try: directory = sys._MEIPASS except Exception: directory = os.getcwd() return directory def get_config() -> dict: """ Retrieve the application configuration """ return { 'app_name': 'WebPicDownloader', 'app_folder': os.getcwd(), 'app_version': '1.0.0', # This version must match with the version.txt at root 'app_version_date': '2022-09-11', 'app_depo_version': 'https://git.endmove.eu/EndMove/WebPicDownloader/raw/branch/master/VERSION', 'app_depo_releases': 'https://git.endmove.eu/EndMove/WebPicDownloader/releases', 'sys_version_matcher': re.compile(r'^(\d{1,2}\.)(\d{1,2}\.)(\d{1,2})$'), 'sys_directory': get_sys_directory(), 'about_title': 'About WebPicDownloader', 'about_content': "This scraping software has been developed by EndMove\nand is fully open-source. The source code is available\nhere: https://git.endmove.eu/EndMove/WebPicDownloader\nEndMove is available at the following address for any\nrequest contact@endmove.eu. In case of problemsplease\nopen an issue on the repository.\n\nThe logo of the software was made by Gashila" } if __name__ == '__main__': """ WebPicDownloader is a program developed and maintened by EndMove under Apache 2.0 License. Stealing code is a crime ! Disclamer : The developer of this application can in no way be held responsible if his application is used for illegal purposes. @author Jérémi Nihart / EndMove @link https://git.endmove.eu/EndMove/WebPicDownloader @version 1.0.0 @since 2022-08-30 """ # configuration config = get_config() # Create utli/model webpic = WebPicDownloader(path=config.get('app_folder')) # Create app controllers main_controller = MainController(config) home_controller = HomeController(main_controller, webpic) info_controller = InfoController(main_controller) # Create app views main_window = MainWindow(main_controller) home_view = HomeView(main_window, home_controller) info_controller = InfoView(main_window, info_controller) # Add views to main window main_window.add_view(Frames.HOME, home_view) main_window.add_view(Frames.INFO, info_controller) # Choose the launching view main_window.show_frame(Frames.HOME) # Start main windows looping (launch program) main_window.mainloop()