add new modul MessageDialog and replace old message dialog
This commit is contained in:
@ -239,72 +239,6 @@ class LxTools:
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def msg_window(
|
||||
image_path: Path,
|
||||
image_path2: Path,
|
||||
w_title: str,
|
||||
w_txt: str,
|
||||
txt2: Optional[str] = None,
|
||||
com: Optional[str] = None,
|
||||
) -> None:
|
||||
"""
|
||||
Creates message windows
|
||||
|
||||
:param image_path2:
|
||||
:param image_path:
|
||||
AppConfig.IMAGE_PATHS["icon_info"] = Image for TK window which is displayed to the left of the text
|
||||
AppConfig.IMAGE_PATHS["icon_vpn"] = Image for Task Icon
|
||||
:argument w_title = Windows Title
|
||||
:argument w_txt = Text for Tk Window
|
||||
:argument txt2 = Text for Button two
|
||||
:argument com = function for Button command
|
||||
"""
|
||||
msg: tk.Toplevel = tk.Toplevel()
|
||||
msg.resizable(width=False, height=False)
|
||||
msg.title(w_title)
|
||||
msg.configure(pady=15, padx=15)
|
||||
|
||||
# load first image for a window
|
||||
try:
|
||||
msg.img = tk.PhotoImage(file=image_path)
|
||||
msg.i_window = tk.Label(msg, image=msg.img)
|
||||
except Exception as e:
|
||||
logging.error(f"Error on load Window Image: {e}", exc_info=True)
|
||||
msg.i_window = tk.Label(msg, text="Image not found")
|
||||
|
||||
label: tk.Label = tk.Label(msg, text=w_txt)
|
||||
label.grid(column=1, row=0)
|
||||
|
||||
if txt2 is not None and com is not None:
|
||||
label.config(font=("Ubuntu", 11), padx=15, justify="left")
|
||||
msg.i_window.grid(column=0, row=0, sticky="nw")
|
||||
button2: ttk.Button = ttk.Button(
|
||||
msg, text=f"{txt2}", command=com, padding=4
|
||||
)
|
||||
button2.grid(column=0, row=1, sticky="e", columnspan=2)
|
||||
button: ttk.Button = ttk.Button(
|
||||
msg, text="OK", command=msg.destroy, padding=4
|
||||
)
|
||||
button.grid(column=0, row=1, sticky="w", columnspan=2)
|
||||
else:
|
||||
label.config(font=("Ubuntu", 11), padx=15)
|
||||
msg.i_window.grid(column=0, row=0)
|
||||
button: ttk.Button = ttk.Button(
|
||||
msg, text="OK", command=msg.destroy, padding=4
|
||||
)
|
||||
button.grid(column=0, columnspan=2, row=1)
|
||||
|
||||
try:
|
||||
icon = tk.PhotoImage(file=image_path2)
|
||||
msg.iconphoto(True, icon)
|
||||
except Exception as e:
|
||||
logging.error(f"Error loading the window icon: {e}", exc_info=True)
|
||||
|
||||
msg.columnconfigure(0, weight=1)
|
||||
msg.rowconfigure(0, weight=1)
|
||||
msg.winfo_toplevel()
|
||||
|
||||
@staticmethod
|
||||
def sigi(file_path: Optional[Path] = None, file: Optional[Path] = None) -> None:
|
||||
"""
|
||||
|
Reference in New Issue
Block a user