Remove documentation and CLI mode features
- Remove "Documentation" menu option - Delete unused CLI mode code - Clean up commented-out argument parsing function
This commit is contained in:
@@ -44,7 +44,7 @@ import socket
|
|||||||
from update_checker import UpdateChecker
|
from update_checker import UpdateChecker
|
||||||
|
|
||||||
# Версия программы
|
# Версия программы
|
||||||
VERSION = "1.1.0"
|
VERSION = "1.0.0"
|
||||||
|
|
||||||
# Создаем необходимые папки
|
# Создаем необходимые папки
|
||||||
os.makedirs("Logs", exist_ok=True)
|
os.makedirs("Logs", exist_ok=True)
|
||||||
@@ -689,7 +689,6 @@ class SerialAppGUI(tk.Tk):
|
|||||||
# Меню "Справка"
|
# Меню "Справка"
|
||||||
help_menu = tk.Menu(menubar, tearoff=0)
|
help_menu = tk.Menu(menubar, tearoff=0)
|
||||||
menubar.add_cascade(label="Справка", menu=help_menu)
|
menubar.add_cascade(label="Справка", menu=help_menu)
|
||||||
help_menu.add_command(label="Документация", command=self.open_documentation)
|
|
||||||
help_menu.add_command(label="Проверить обновления", command=self.check_for_updates)
|
help_menu.add_command(label="Проверить обновления", command=self.check_for_updates)
|
||||||
help_menu.add_separator()
|
help_menu.add_separator()
|
||||||
help_menu.add_command(label="О программе", command=self.open_about)
|
help_menu.add_command(label="О программе", command=self.open_about)
|
||||||
@@ -736,25 +735,6 @@ class SerialAppGUI(tk.Tk):
|
|||||||
settings_window.transient(self)
|
settings_window.transient(self)
|
||||||
settings_window.grab_set()
|
settings_window.grab_set()
|
||||||
|
|
||||||
def open_documentation(self):
|
|
||||||
"""Открытие документации"""
|
|
||||||
doc_path = os.path.join("docs", "user_manual.md")
|
|
||||||
if os.path.exists(doc_path):
|
|
||||||
try:
|
|
||||||
os.startfile(doc_path)
|
|
||||||
except AttributeError:
|
|
||||||
# Для Linux и MacOS
|
|
||||||
try:
|
|
||||||
import subprocess
|
|
||||||
subprocess.run(["xdg-open", doc_path])
|
|
||||||
except:
|
|
||||||
webbrowser.open(f"file://{os.path.abspath(doc_path)}")
|
|
||||||
else:
|
|
||||||
messagebox.showerror(
|
|
||||||
"Ошибка",
|
|
||||||
"Файл документации не найден"
|
|
||||||
)
|
|
||||||
|
|
||||||
def check_first_run(self):
|
def check_first_run(self):
|
||||||
"""Проверка первого запуска программы"""
|
"""Проверка первого запуска программы"""
|
||||||
show_settings = False
|
show_settings = False
|
||||||
@@ -1271,82 +1251,6 @@ class SerialAppGUI(tk.Tk):
|
|||||||
if not self.tftp_ip_var.get() in adapters:
|
if not self.tftp_ip_var.get() in adapters:
|
||||||
self.tftp_ip_var.set(adapters[0])
|
self.tftp_ip_var.set(adapters[0])
|
||||||
|
|
||||||
# ==========================
|
|
||||||
# Парсер аргументов (не используется)
|
|
||||||
# ==========================
|
|
||||||
# def parse_arguments():
|
|
||||||
# parser = argparse.ArgumentParser(
|
|
||||||
# description="Программа для работы с устройствами через последовательный порт с графическим интерфейсом."
|
|
||||||
# )
|
|
||||||
# parser.add_argument("--cli", action="store_true", help="Запустить в режиме командной строки (без графики)")
|
|
||||||
# return parser.parse_args()
|
|
||||||
|
|
||||||
# ==========================
|
|
||||||
# Режим командной строки (не используется)
|
|
||||||
# ==========================
|
|
||||||
|
|
||||||
# def run_cli_mode(settings):
|
|
||||||
# print("Запущен режим командной строки.")
|
|
||||||
# while True:
|
|
||||||
# print("\n--- Главное меню ---")
|
|
||||||
# print("1. Подключиться и войти в интерактивный режим")
|
|
||||||
# print("2. Выполнить команды из файла конфигурации")
|
|
||||||
# print("0. Выход")
|
|
||||||
# choice = input("Выберите действие: ").strip()
|
|
||||||
# if choice == "1":
|
|
||||||
# if not settings.get("port"):
|
|
||||||
# print("[ERROR] COM-порт не выбран!")
|
|
||||||
# continue
|
|
||||||
# conn = create_connection(settings)
|
|
||||||
# if not conn:
|
|
||||||
# print("[ERROR] Не удалось установить соединение.")
|
|
||||||
# continue
|
|
||||||
# print("[INFO] Введите команды (для выхода введите _exit):")
|
|
||||||
# while True:
|
|
||||||
# cmd = input("Команда: ")
|
|
||||||
# if cmd.strip().lower() == "_exit":
|
|
||||||
# break
|
|
||||||
# try:
|
|
||||||
# conn.write((cmd + "\n").encode())
|
|
||||||
# response = read_response(
|
|
||||||
# conn, settings.get("timeout", 10),
|
|
||||||
# login=settings.get("login"),
|
|
||||||
# password=settings.get("password"),
|
|
||||||
# is_gui=False
|
|
||||||
# )
|
|
||||||
# print(response)
|
|
||||||
# except Exception as e:
|
|
||||||
# print(f"[ERROR] {e}")
|
|
||||||
# break
|
|
||||||
# conn.close()
|
|
||||||
# elif choice == "2":
|
|
||||||
# if not settings.get("config_file"):
|
|
||||||
# print("[ERROR] Файл конфигурации не выбран!")
|
|
||||||
# continue
|
|
||||||
# if not settings.get("port"):
|
|
||||||
# print("[ERROR] COM-порт не выбран!")
|
|
||||||
# continue
|
|
||||||
# conn = create_connection(settings)
|
|
||||||
# if conn:
|
|
||||||
# execute_commands_from_file(
|
|
||||||
# conn,
|
|
||||||
# settings["config_file"],
|
|
||||||
# settings.get("timeout", 10),
|
|
||||||
# settings.get("copy_mode", "line"),
|
|
||||||
# settings.get("block_size", 15),
|
|
||||||
# lambda msg: print(msg),
|
|
||||||
# login=settings.get("login"),
|
|
||||||
# password=settings.get("password"),
|
|
||||||
# is_gui=False,
|
|
||||||
# )
|
|
||||||
# conn.close()
|
|
||||||
# else:
|
|
||||||
# print("[ERROR] Не удалось установить соединение.")
|
|
||||||
# elif choice == "0":
|
|
||||||
# break
|
|
||||||
# else:
|
|
||||||
# print("[ERROR] Некорректный выбор.")
|
|
||||||
|
|
||||||
# ==========================
|
# ==========================
|
||||||
# Основной запуск приложения
|
# Основной запуск приложения
|
||||||
# ==========================
|
# ==========================
|
||||||
|
|||||||
Reference in New Issue
Block a user