diff --git a/.gitignore b/.gitignore index 7d33cdb..ab36f0a 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ __pycache__/ # Distribution / packaging .Python build/ +output/ develop-eggs/ dist/ downloads/ diff --git a/Tkinter-grid-Sticky-Options.png b/Tkinter-grid-Sticky-Options.png deleted file mode 100644 index 6729df8..0000000 Binary files a/Tkinter-grid-Sticky-Options.png and /dev/null differ diff --git a/controller/MainController.py b/controller/MainController.py index 9ae2433..c8846cd 100644 --- a/controller/MainController.py +++ b/controller/MainController.py @@ -65,7 +65,7 @@ class MainController: => Event launched when a check for available updates is requested. """ # TODO write the function - print("on_check_for_update") + self.show_information_dialog(self.get_config('app_name'), "Oupss, this functionality isn't available yet!\nTry it again later.") def on_about(self) -> None: """ @@ -102,11 +102,22 @@ class MainController: [function for controller] => Ask a question to the user and block until he answers with yes or no. - * :title: -> - * :message: -> - * :icon: -> + * :title: -> Title of the dialogue. + * :message: -> Message of the dialogue. + * :icon: -> Icon of the dialogue """ return self.__view.show_question_dialog(title, message, icon) + + def show_information_dialog(self, title: str='title', message: str='informations!', icon: str='info') -> bool: + """ + [function for controller] + => Display a pop-up information dialog to the user. + + * :title: -> Title of the dialogue. + * :message: -> Message of the dialogue. + * :icon: -> Icon of the dialogue + """ + return self.__view.show_information_dialog(title, message, icon) # END Controller methods # START Controller events diff --git a/main.py b/main.py index 6617ef0..d5dc265 100644 --- a/main.py +++ b/main.py @@ -33,15 +33,7 @@ def get_config() -> dict: 'sys_directory': get_sys_directory(), 'about_title': 'About WebPicDownloader', - 'about_content': -"""This scraping software has been developed by EndMove -and is fully open-source. The source code is available -here: https://git.endmove.eu/EndMove/WebPicDownloader -EndMove is available at the following address for any -request contact@endmove.eu. In case of problemsplease -open an issue on the repository. - -The logo of the software was made by Gashila""" + '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__': diff --git a/util/AsyncTask.py b/util/AsyncTask.py index e5bb3c6..05f9021 100644 --- a/util/AsyncTask.py +++ b/util/AsyncTask.py @@ -45,9 +45,7 @@ class AsyncTask(threading.Thread): [Internal function of (threading.Thread)] [!] : This function must not be used! Start the task with {AsyncTask.start()} ! """ - print("runn") self.__run_callback(*self.__run_args) - print("stopp") def stop(self) -> None: """ diff --git a/view/InfoView.py b/view/InfoView.py index 30c2086..47c694d 100644 --- a/view/InfoView.py +++ b/view/InfoView.py @@ -8,14 +8,14 @@ from view.MainWindow import MainWindow class InfoView(ttk.Frame): """ - View - MainWindow + View - InfoWindow - dec... + This view displays information about the program, as well as its version and release date. @author Jérémi Nihart / EndMove @link https://git.endmove.eu/EndMove/WebPicDownloader @version 1.0.0 - @since 2022-08-30 + @since 2022-09-06 """ # Variables __controller: InfoController = None diff --git a/view/MainWindow.py b/view/MainWindow.py index 7d76c8e..3acbaaf 100644 --- a/view/MainWindow.py +++ b/view/MainWindow.py @@ -1,5 +1,3 @@ -import os -import sys import tkinter as tk from tkinter import messagebox from controller.Frames import Frames @@ -50,11 +48,13 @@ class MainWindow(tk.Tk): [internal function] => Initialize window parameters """ - # self.title('My tkinter app') - self.geometry('430x310') - self.resizable(False, False) - self.iconbitmap(f"{self.__controller.get_config('sys_directory')}\\assets\logo.ico") - # self.config(bg='#f7ef38') + self.iconbitmap(f"{self.__controller.get_config('sys_directory')}\\assets\logo.ico") # App logo + window_width = 430 # App width + window_height = 305 # App height + x_cordinate = int((self.winfo_screenwidth()/2) - (window_width/2)) + y_cordinate = int((self.winfo_screenheight()/2) - (window_height/2)) + self.geometry(f"{window_width}x{window_height}+{x_cordinate}+{y_cordinate}") # App size and middle centering + self.resizable(False, False) # Disable app resizing def __init_top_menu(self) -> None: """ @@ -63,12 +63,14 @@ class MainWindow(tk.Tk): """ main_menu = tk.Menu(self) + # Top menu File item col1_menu = tk.Menu(main_menu, tearoff=0) col1_menu.add_command(label="Open app folder", command=self.__controller.on_open_folder) col1_menu.add_separator() col1_menu.add_command(label="Quit", command=self.__controller.on_quite) main_menu.add_cascade(label="File", menu=col1_menu) + # Top menu Help item col2_menu = tk.Menu(main_menu, tearoff=0) col2_menu.add_command(label="Check for update", command=self.__controller.on_check_for_update) col2_menu.add_command(label="About", command=self.__controller.on_about) @@ -139,7 +141,7 @@ class MainWindow(tk.Tk): """ return True if (messagebox.askquestion(title, message, icon=icon) == "yes") else False - def show_information_dialog(self, title: str, message: str, icon: str='information') -> None: + def show_information_dialog(self, title: str, message: str, icon: str='info') -> None: """ [function for controller] => Display an information dialog to the user. @@ -148,5 +150,5 @@ class MainWindow(tk.Tk): * :message: -> Message of the dialogue displayed to the user. * :icon: -> Icon of the dialogue displayed to the user. """ - messagebox.showinfo(self, title, message, icon=icon) + messagebox.showinfo(title, message, icon=icon) # END Controller methods