Frame switching system done

This commit is contained in:
2022-08-30 21:12:04 +02:00
parent 746b40fa18
commit dce1b2f9a5
8 changed files with 241 additions and 117 deletions

View File

@@ -2,5 +2,17 @@ from enum import Enum
class Frames(Enum):
"""
Enumeration - Frames
Lists the different windows of the program in order to facilitate
their call during the execution. Each parameter of the enumeration
represents a Frame/Tab.
@author Jérémi Nihart / EndMove
@link https://git.endmove.eu/EndMove/WebPicDownloader
@version 1.0.0
@since 2022-08-30
"""
Home = 1 # Home view
Info = 2 # Info & copyright view

View File

@@ -1,26 +1,50 @@
from controller.MainController import MainController
class HomeController:
"""
Controller - HomeController
Controller - HomeController
desc...
@author Jérémi Nihart / EndMove
@link https://git.endmove.eu/EndMove/WebPicDownloader
@version 1.0.0
@since 2022-08-30
"""
# Variables
main_controller = None
view = None
__main_controller = None
__view = None
# Constructor
def __init__(self, controller: MainController) -> None:
self.main_controller = controller
self.__main_controller = controller
# START View methods
def set_view(self, view) -> None:
"""
[function for view]
:view: -> The view that this controller manage.
"""
self.view = view
self.__view = view
# END View method
# START View events
def on_change_view(self, frame) -> None:
"""
[event function for view]
:frame: -> The frame we want to launch.
"""
self.__main_controller.change_frame(frame)
def on_download_started(self, url: str, name: str) -> None:
"""
[event function for view]
:url: -> The url of the website to use for pic-download.\n
:name: -> The name of the folder in which put pictures.
"""
pass
# END View events

View File

@@ -0,0 +1,41 @@
from controller.MainController import MainController
class InfoController:
"""
Controller - InfoController
desc...
@author Jérémi Nihart / EndMove
@link https://git.endmove.eu/EndMove/WebPicDownloader
@version 1.0.0
@since 2022-08-30
"""
# Variables
__main_controller = None
__view = None
# Constructor
def __init__(self, controller: MainController) -> None:
self.__main_controller = controller
# START View methods
def set_view(self, view) -> None:
"""
[function for view]
:view: -> The view that this controller manage.
"""
self.__view = view
# END View method
# START View events
def on_change_view(self, frame) -> None:
"""
[event function for view]
:frame: -> The frame we want to launch.
"""
self.__main_controller.change_frame(frame)
# END View events

View File

@@ -1,10 +1,13 @@
class MainController:
"""
Controller - MainController
Controller - MainController
desc...
@author Jérémi Nihart / EndMove
@link https://git.endmove.eu/EndMove/WebPicDownloader
@version 1.0.0
@since 2022-08-30
"""
# Variables
__view = None
@@ -13,18 +16,22 @@ class MainController:
def __init__(self) -> None:
pass
def change_frame(self, frame) -> None:
"""
[function for controller]
:frame: -> The frame to be displayed on the screen.
"""
pass
# START View methods
def set_view(self, view) -> None:
"""
[function for view]
:view: -> The view that this controller manage.
"""
self.__view = view
self.__view = view
# END view methods
# START Controller methods
def change_frame(self, frame) -> None:
"""
[function for controller]
:frame: -> The frame we want to display on the window instead of the current frame.
"""
self.__view.show_frame(frame)
# END Controller methods