Minor advance

This commit is contained in:
2022-08-31 23:53:24 +02:00
parent a93a88d344
commit 03e35c18a9
3 changed files with 40 additions and 21 deletions

View File

@@ -1,3 +1,4 @@
import time
from controller.MainController import MainController
@@ -30,6 +31,7 @@ class HomeController:
:view: -> The view that this controller manage.
"""
self.__view = view
self.__webpic.set_messenger_callback(view.add_log)
# END View method
# START View events
@@ -54,6 +56,16 @@ class HomeController:
if url.strip() and name.strip() :
# TODO use webpic here to download files
print(f"url : {url} -- name : {name}")
self.__view.clear_logs() # BUG this process must be asynchrone ...
if self.__webpic.download(url, name):
self.__view.show_success_message("The download has been successfully completed.")
else:
self.__view.show_error_message("A critical error preventing the download occurred, check the logs.")
else:
self.__view.show_error_message("Opss, the url or folder name are not valid!")
# END View events
# START Controller methods
# END Controller methods