2022-09-01 18:05:58 +02:00
import os
2022-09-11 11:52:41 +02:00
import re
2022-09-05 23:13:38 +02:00
import sys
2022-09-11 11:52:41 +02:00
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
2022-08-30 12:28:59 +02:00
2022-09-05 23:13:38 +02:00
def get_sys_directory ( ) - > str :
"""
Recover the path of the application ' s resources.
"""
try :
directory = sys . _MEIPASS
except Exception :
directory = os . getcwd ( )
return directory
2022-09-01 18:05:58 +02:00
def get_config ( ) - > dict :
2022-09-05 23:13:38 +02:00
"""
Retrieve the application configuration
"""
2022-09-01 18:05:58 +02:00
return {
2022-09-05 23:13:38 +02:00
' app_name ' : ' WebPicDownloader ' ,
2022-09-01 18:05:58 +02:00
' app_folder ' : os . getcwd ( ) ,
2022-09-05 23:13:38 +02:00
' app_version ' : ' 1.0.0 ' , # This version must match with the version.txt at root
2022-09-12 00:29:39 +02:00
' 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 ' ,
2022-09-05 23:13:38 +02:00
2022-09-11 11:52:41 +02:00
' sys_version_matcher ' : re . compile ( r ' ^( \ d { 1,2} \ .)( \ d { 1,2} \ .)( \ d { 1,2})$ ' ) ,
2022-09-05 23:13:38 +02:00
' sys_directory ' : get_sys_directory ( ) ,
' about_title ' : ' About WebPicDownloader ' ,
2022-09-06 12:59:37 +02:00
' about_content ' : " This scraping software has been developed by EndMove \n and is fully open-source. The source code is available \n here: https://git.endmove.eu/EndMove/WebPicDownloader \n EndMove is available at the following address for any \n request contact@endmove.eu. In case of problemsplease \n open an issue on the repository. \n \n The logo of the software was made by Gashila "
2022-09-01 18:05:58 +02:00
}
2022-08-30 12:28:59 +02:00
if __name__ == ' __main__ ' :
2022-08-30 21:12:04 +02:00
"""
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
"""
2022-09-01 18:05:58 +02:00
# configuration
config = get_config ( )
2022-08-31 21:05:20 +02:00
# Create utli/model
2022-09-05 23:13:38 +02:00
webpic = WebPicDownloader ( path = config . get ( ' app_folder ' ) )
2022-08-31 21:05:20 +02:00
2022-08-30 21:12:04 +02:00
# Create app controllers
2022-09-01 18:05:58 +02:00
main_controller = MainController ( config )
2022-08-31 21:05:20 +02:00
home_controller = HomeController ( main_controller , webpic )
2022-08-30 21:12:04 +02:00
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
2022-09-05 23:13:38 +02:00
main_window . add_view ( Frames . HOME , home_view )
main_window . add_view ( Frames . INFO , info_controller )
2022-08-30 21:12:04 +02:00
# Choose the launching view
2022-09-05 23:13:38 +02:00
main_window . show_frame ( Frames . HOME )
2022-08-30 21:12:04 +02:00
# Start main windows looping (launch program)
2022-09-05 23:13:38 +02:00
2022-08-31 12:07:43 +02:00
main_window . mainloop ( )