show progress and logs only for currently selected profile

This commit is contained in:
Aryaman 2024-03-08 16:39:03 +05:30
parent b2cf5b1fc9
commit e843fff945
2 changed files with 21 additions and 5 deletions

View File

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

View File

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