Add About window to application menu
- Import and integrate AboutWindow class - Create new "Help" menu with "About Program" option - Add `open_about()` method to display About window - Enhance application's help and information accessibility
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -4,6 +4,6 @@ Configs/Eltex MES2424 AC - Сеть FTTB 2G, доп.txt
|
|||||||
Configs/конфиг доп 3750-52 с айпи 172.17.141.133 .txt
|
Configs/конфиг доп 3750-52 с айпи 172.17.141.133 .txt
|
||||||
DALL·E 2024-12-29 01.01.02 - Square vector logo_ A clean and minimalistic app icon for serial port management software. The design prominently features a simplified rectangular CO.ico
|
DALL·E 2024-12-29 01.01.02 - Square vector logo_ A clean and minimalistic app icon for serial port management software. The design prominently features a simplified rectangular CO.ico
|
||||||
test.py
|
test.py
|
||||||
__pycache__/TFTPServer.cpython-312.pyc
|
__pycache__/
|
||||||
Firmware/1.jpg
|
Firmware/1.jpg
|
||||||
Firmware/2
|
Firmware/2
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ from tkinter import ttk
|
|||||||
import serial
|
import serial
|
||||||
import serial.tools.list_ports
|
import serial.tools.list_ports
|
||||||
from serial.serialutil import SerialException
|
from serial.serialutil import SerialException
|
||||||
|
from about_window import AboutWindow
|
||||||
# from TFTPServer import TFTPServerThread
|
# from TFTPServer import TFTPServerThread
|
||||||
|
|
||||||
# Создаем необходимые папки
|
# Создаем необходимые папки
|
||||||
@@ -590,6 +591,11 @@ class SerialAppGUI(tk.Tk):
|
|||||||
file_menu.add_separator()
|
file_menu.add_separator()
|
||||||
file_menu.add_command(label="Выход", command=self.quit)
|
file_menu.add_command(label="Выход", command=self.quit)
|
||||||
|
|
||||||
|
# Меню "Справка"
|
||||||
|
help_menu = tk.Menu(menubar, tearoff=0)
|
||||||
|
menubar.add_cascade(label="Справка", menu=help_menu)
|
||||||
|
help_menu.add_command(label="О программе", command=self.open_about)
|
||||||
|
|
||||||
def open_settings(self):
|
def open_settings(self):
|
||||||
settings_window = SettingsWindow(self, self.settings, self.on_settings_changed)
|
settings_window = SettingsWindow(self, self.settings, self.on_settings_changed)
|
||||||
settings_window.transient(self)
|
settings_window.transient(self)
|
||||||
@@ -812,6 +818,11 @@ class SerialAppGUI(tk.Tk):
|
|||||||
logging.error(f"Ошибка сохранения файла: {e}", exc_info=True)
|
logging.error(f"Ошибка сохранения файла: {e}", exc_info=True)
|
||||||
messagebox.showerror("Ошибка", f"Не удалось сохранить файл:\n{e}")
|
messagebox.showerror("Ошибка", f"Не удалось сохранить файл:\n{e}")
|
||||||
|
|
||||||
|
def open_about(self):
|
||||||
|
about_window = AboutWindow(self)
|
||||||
|
about_window.transient(self)
|
||||||
|
about_window.grab_set()
|
||||||
|
|
||||||
# ==========================
|
# ==========================
|
||||||
# Парсер аргументов (не используется)
|
# Парсер аргументов (не используется)
|
||||||
# ==========================
|
# ==========================
|
||||||
|
|||||||
100
about_window.py
Normal file
100
about_window.py
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import tkinter as tk
|
||||||
|
from tkinter import ttk, BOTH, X, BOTTOM
|
||||||
|
import webbrowser
|
||||||
|
|
||||||
|
class AboutWindow(tk.Toplevel):
|
||||||
|
def __init__(self, parent):
|
||||||
|
super().__init__(parent)
|
||||||
|
self.title("О программе")
|
||||||
|
self.geometry("400x300")
|
||||||
|
self.resizable(False, False)
|
||||||
|
|
||||||
|
# Создаем фрейм
|
||||||
|
about_frame = ttk.Frame(self, padding="20")
|
||||||
|
about_frame.pack(fill=BOTH, expand=True)
|
||||||
|
|
||||||
|
# Заголовок
|
||||||
|
ttk.Label(
|
||||||
|
about_frame,
|
||||||
|
text="ComConfigCopy",
|
||||||
|
font=("Segoe UI", 16, "bold")
|
||||||
|
).pack(pady=(0, 10))
|
||||||
|
|
||||||
|
# Описание
|
||||||
|
ttk.Label(
|
||||||
|
about_frame,
|
||||||
|
text="Программа для копирования конфигураций на коммутаторы",
|
||||||
|
wraplength=350
|
||||||
|
).pack(pady=(0, 20))
|
||||||
|
|
||||||
|
# Версия
|
||||||
|
ttk.Label(
|
||||||
|
about_frame,
|
||||||
|
text="Версия 1.0",
|
||||||
|
font=("Segoe UI", 10)
|
||||||
|
).pack(pady=(0, 20))
|
||||||
|
|
||||||
|
# Контактная информация
|
||||||
|
contact_frame = ttk.Frame(about_frame)
|
||||||
|
contact_frame.pack(fill=X, pady=(0, 20))
|
||||||
|
|
||||||
|
# Исходный код
|
||||||
|
ttk.Label(
|
||||||
|
contact_frame,
|
||||||
|
text="Исходный код:",
|
||||||
|
font=("Segoe UI", 10, "bold")
|
||||||
|
).pack(anchor="w")
|
||||||
|
|
||||||
|
source_link = ttk.Label(
|
||||||
|
contact_frame,
|
||||||
|
text="https://gitea.filow.ru/LowaSC/ComConfigCopy",
|
||||||
|
cursor="hand2",
|
||||||
|
foreground="blue"
|
||||||
|
)
|
||||||
|
source_link.pack(anchor="w")
|
||||||
|
source_link.bind("<Button-1>", lambda e: self.open_url("https://gitea.filow.ru/LowaSC/ComConfigCopy"))
|
||||||
|
|
||||||
|
# Контакты
|
||||||
|
ttk.Label(
|
||||||
|
contact_frame,
|
||||||
|
text="\nКонтакты:",
|
||||||
|
font=("Segoe UI", 10, "bold")
|
||||||
|
).pack(anchor="w")
|
||||||
|
|
||||||
|
ttk.Label(
|
||||||
|
contact_frame,
|
||||||
|
text="Email: LowaWorkMail@gmail.com"
|
||||||
|
).pack(anchor="w")
|
||||||
|
|
||||||
|
telegram_link = ttk.Label(
|
||||||
|
contact_frame,
|
||||||
|
text="Telegram: @LowaSC",
|
||||||
|
cursor="hand2",
|
||||||
|
foreground="blue"
|
||||||
|
)
|
||||||
|
telegram_link.pack(anchor="w")
|
||||||
|
telegram_link.bind("<Button-1>", lambda e: self.open_url("https://t.me/LowaSC"))
|
||||||
|
|
||||||
|
# Кнопка закрытия
|
||||||
|
ttk.Button(
|
||||||
|
about_frame,
|
||||||
|
text="Закрыть",
|
||||||
|
command=self.destroy
|
||||||
|
).pack(side=BOTTOM, pady=(20, 0))
|
||||||
|
|
||||||
|
# Центрируем окно
|
||||||
|
self.center_window()
|
||||||
|
|
||||||
|
def center_window(self):
|
||||||
|
self.update_idletasks()
|
||||||
|
width = self.winfo_width()
|
||||||
|
height = self.winfo_height()
|
||||||
|
x = (self.winfo_screenwidth() // 2) - (width // 2)
|
||||||
|
y = (self.winfo_screenheight() // 2) - (height // 2)
|
||||||
|
self.geometry(f"{width}x{height}+{x}+{y}")
|
||||||
|
|
||||||
|
def open_url(self, url):
|
||||||
|
webbrowser.open(url)
|
||||||
Reference in New Issue
Block a user