From 32e56879f73941c6fec06f639ae47939f2404867 Mon Sep 17 00:00:00 2001 From: Sergey Palcheh Date: Thu, 2 Oct 2025 13:54:49 +0600 Subject: [PATCH] fixed the appearance of the Open folder with the prefix's log/backup button --- winehelper_gui.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/winehelper_gui.py b/winehelper_gui.py index 9255593..636f49e 100644 --- a/winehelper_gui.py +++ b/winehelper_gui.py @@ -3395,9 +3395,14 @@ class WineHelperGUI(QMainWindow): self.info_panel.setVisible(False) def update_open_log_dir_button_visibility(self): - """Проверяет наличие лог-файла и обновляет видимость кнопки.""" - log_path = os.path.join(os.path.expanduser("~"), "winehelper_backup_log", "winehelper.log") - self.open_log_dir_button.setVisible(os.path.exists(log_path)) + """Проверяет наличие лог-файла или бэкапов и обновляет видимость кнопки.""" + log_dir_path = os.path.join(os.path.expanduser("~"), "winehelper_backup_log") + is_visible = False + if os.path.isdir(log_dir_path): + # Кнопка должна быть видна, если директория не пуста. + if os.listdir(log_dir_path): + is_visible = True + self.open_log_dir_button.setVisible(is_visible) def open_log_directory(self): """Открывает директорию с лог-файлами.""" @@ -3484,6 +3489,7 @@ class WineHelperGUI(QMainWindow): self.command_process.setProcessChannelMode(QProcess.MergedChannels) self.command_process.readyReadStandardOutput.connect(self._handle_command_output) self.command_process.finished.connect(self._handle_command_finished) + self.command_process.finished.connect(self.update_open_log_dir_button_visibility) winehelper_path = self.winehelper_path args = ["backup-prefix", prefix_name] @@ -3817,6 +3823,7 @@ class WineHelperGUI(QMainWindow): # и избегания проблем с замыканием в lambda. process.finished.connect(partial(self._on_app_process_finished, desktop_path)) + process.finished.connect(self.update_open_log_dir_button_visibility) try: process.start(program, arguments)