Ann top menu event + manage on quit event request
This commit is contained in:
@@ -2,7 +2,7 @@ class MainController:
|
||||
"""
|
||||
Controller - MainController
|
||||
|
||||
desc...
|
||||
TODO desc...
|
||||
|
||||
@author Jérémi Nihart / EndMove
|
||||
@link https://git.endmove.eu/EndMove/WebPicDownloader
|
||||
@@ -10,11 +10,17 @@ class MainController:
|
||||
@since 2022-08-30
|
||||
"""
|
||||
# Variables
|
||||
__config: dict = None
|
||||
__view = None
|
||||
|
||||
# Constructor
|
||||
def __init__(self) -> None:
|
||||
pass
|
||||
def __init__(self, config: dict) -> None:
|
||||
"""
|
||||
Constructor
|
||||
|
||||
:config: -> The application configuration (a dictionary).
|
||||
"""
|
||||
self.__config = config
|
||||
|
||||
# START View methods
|
||||
def set_view(self, view) -> None:
|
||||
@@ -26,6 +32,22 @@ class MainController:
|
||||
"""
|
||||
self.__view = view
|
||||
|
||||
def on_open_folder(self) -> None:
|
||||
"""
|
||||
[event function for view]
|
||||
=> Event launch when you ask to open the current folder.
|
||||
"""
|
||||
# TODO on_open_folder
|
||||
pass
|
||||
|
||||
def on_quite(self) -> None:
|
||||
"""
|
||||
[event function for view]
|
||||
=> Event launch when you ask to quit the program.
|
||||
"""
|
||||
print("You asked to quit...") # TODO remove
|
||||
self.__view.close_window() # End the program
|
||||
|
||||
def on_check_for_update(self) -> None:
|
||||
"""
|
||||
[event function for view]
|
||||
@@ -33,6 +55,13 @@ class MainController:
|
||||
"""
|
||||
# TODO write the function
|
||||
print("on_check_for_update")
|
||||
|
||||
def on_about(self) -> None:
|
||||
"""
|
||||
[event function for view]
|
||||
=> Event launched when a request for more information arise.
|
||||
"""
|
||||
# TODO on_about
|
||||
pass
|
||||
# END View methods
|
||||
|
||||
@@ -45,4 +74,16 @@ class MainController:
|
||||
:frame: -> The frame we want to display on the window instead of the current frame.
|
||||
"""
|
||||
self.__view.show_frame(frame)
|
||||
|
||||
def get_config(self, name: str) -> str|int:
|
||||
"""
|
||||
[function for controller]
|
||||
=> Allows controllers to access the application's configuration.
|
||||
|
||||
:name: -> The name of the configuration parameter for which we want to access the configured value.
|
||||
"""
|
||||
if self.__config.get(name):
|
||||
return self.__config.get(name)
|
||||
else:
|
||||
raise ValueError("Unable to find a configuration with this name")
|
||||
# END Controller methods
|
||||
|
||||
Reference in New Issue
Block a user