From e843fff9450be2a7dc440b7e752faba2b468884e Mon Sep 17 00:00:00 2001 From: Aryaman Date: Fri, 8 Mar 2024 16:39:03 +0530 Subject: [PATCH] show progress and logs only for currently selected profile --- src/vorta/views/main_window.py | 14 +++++++++----- src/vorta/views/utils.py | 12 ++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/vorta/views/main_window.py b/src/vorta/views/main_window.py index 78cf40f4..a3c24b8d 100644 --- a/src/vorta/views/main_window.py +++ b/src/vorta/views/main_window.py @@ -22,7 +22,7 @@ from vorta.utils import ( is_system_tray_available, ) from vorta.views.partials.loading_button import LoadingButton -from vorta.views.utils import get_colored_icon +from vorta.views.utils import extract_profile_name, get_colored_icon from .about_tab import AboutTab from .archive_tab import ArchiveTab @@ -136,12 +136,16 @@ class MainWindow(MainWindowBase, MainWindowUI): self.miscButton.setIcon(get_colored_icon('settings_wheel')) def set_progress(self, text=''): - self.progressText.setText(text) - self.progressText.repaint() + profile = extract_profile_name(text) + if profile == self.current_profile.name: + self.progressText.setText(text) + self.progressText.repaint() def set_log(self, text=''): - self.logText.setText(text) - self.logText.repaint() + profile = extract_profile_name(text) + if profile == self.current_profile.name: + self.logText.setText(text) + self.logText.repaint() def _toggle_buttons(self, create_enabled=True): if create_enabled: diff --git a/src/vorta/views/utils.py b/src/vorta/views/utils.py index 5a9697a7..d3d7365c 100644 --- a/src/vorta/views/utils.py +++ b/src/vorta/views/utils.py @@ -1,5 +1,6 @@ import json import os +import re import sys from PyQt6.QtGui import QIcon, QImage, QPixmap @@ -49,3 +50,14 @@ def get_exclusion_presets(): 'tags': preset['tags'], } return allPresets + + +def extract_profile_name(text): + pattern = r'\[([^]]+)\]' + + match = re.search(pattern, text) + + if match: + return match.group(1) + else: + return None