fixed the appearance of the Open folder with the prefix's log/backup button

This commit is contained in:
Sergey Palcheh
2025-10-02 13:54:49 +06:00
parent b88ea9f478
commit 32e56879f7

View File

@@ -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)