Skip to content

Commit

Permalink
Merge branch 'master' into exclude
Browse files Browse the repository at this point in the history
  • Loading branch information
m3nu authored Dec 5, 2024
2 parents 3c2eb2f + 75c22d4 commit 736995c
Show file tree
Hide file tree
Showing 13 changed files with 81 additions and 67 deletions.
1 change: 1 addition & 0 deletions src/vorta/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class VortaApp(QtSingleApplication):
backup_log_event = QtCore.pyqtSignal(str, dict)
backup_progress_event = QtCore.pyqtSignal(str)
check_failed_event = QtCore.pyqtSignal(dict)
profile_changed_event = QtCore.pyqtSignal()

def __init__(self, args_raw, single_app=False):
super().__init__(str(APP_ID), args_raw)
Expand Down
40 changes: 16 additions & 24 deletions src/vorta/assets/exclusion_presets/browsers.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,21 @@
"fm:*/.mozilla/firefox/*/pluginreg.dat",
"fm:*/.mozilla/firefox/*/urlclassifier3.sqlite",
"fm:*/.mozilla/firefox/*/xpti.dat",
"fm:*/snap/firefox/common/.cache",
"fm:*/snap/firefox/common/.mozilla/firefox/*/.parentlock",
"fm:*/snap/firefox/common/.mozilla/firefox/*/XPC.mfasl",
"fm:*/snap/firefox/common/.mozilla/firefox/*/XUL.mfasl",
"fm:*/snap/firefox/common/.mozilla/firefox/*/blocklist.xml",
"fm:*/snap/firefox/common/.mozilla/firefox/*/compreg.dat",
"fm:*/snap/firefox/common/.mozilla/firefox/*/extensions.cache",
"fm:*/snap/firefox/common/.mozilla/firefox/*/extensions.ini",
"fm:*/snap/firefox/common/.mozilla/firefox/*/extensions.rdf",
"fm:*/snap/firefox/common/.mozilla/firefox/*/extensions.sqlite",
"fm:*/snap/firefox/common/.mozilla/firefox/*/extensions.sqlite-journal",
"fm:*/snap/firefox/common/.mozilla/firefox/*/minidumps",
"fm:*/snap/firefox/common/.mozilla/firefox/*/pluginreg.dat",
"fm:*/snap/firefox/common/.mozilla/firefox/*/urlclassifier3.sqlite",
"fm:*/snap/firefox/common/.mozilla/firefox/*/xpti.dat",
"fm:*/.var/app/org.mozilla.firefox/.mozilla/firefox/*/.parentlock",
"fm:*/.var/app/org.mozilla.firefox/.mozilla/firefox/*/XPC.mfasl",
"fm:*/.var/app/org.mozilla.firefox/.mozilla/firefox/*/XUL.mfasl",
Expand All @@ -134,29 +149,6 @@
"fm:*/.var/app/org.mozilla.firefox/cache"
],
"tags": ["application:firefox", "type:browser", "os:linux"],
"author": "Divi, Renner0E"
},
{
"name": "Mozilla Firefox Snap cache and config files",
"slug": "firefox-snap-cache",
"patterns": [
"fm:*/snap/firefox/common/.cache",
"fm:*/snap/firefox/common/.mozilla/firefox/*/pluginreg.dat",
"fm:*/snap/firefox/common/.mozilla/firefox/*/compreg.dat",
"fm:*/snap/firefox/common/.mozilla/firefox/*/xpti.dat",
"fm:*/snap/firefox/common/.mozilla/firefox/*/XUL.mfasl",
"fm:*/snap/firefox/common/.mozilla/firefox/*/XPC.mfasl",
"fm:*/snap/firefox/common/.mozilla/firefox/*/extensions.cache",
"fm:*/snap/firefox/common/.mozilla/firefox/*/extensions.ini",
"fm:*/snap/firefox/common/.mozilla/firefox/*/extensions.rdf",
"fm:*/snap/firefox/common/.mozilla/firefox/*/extensions.sqlite-journal",
"fm:*/snap/firefox/common/.mozilla/firefox/*/extensions.sqlite",
"fm:*/snap/firefox/common/.mozilla/firefox/*/blocklist.xml",
"fm:*/snap/firefox/common/.mozilla/firefox/*/urlclassifier3.sqlite",
"fm:*/snap/firefox/common/.mozilla/firefox/*/.parentlock",
"fm:*/snap/firefox/common/.mozilla/firefox/*/minidumps"
],
"tags": ["application:firefox", "type:browser", "os:linux"],
"author": "chaikney"
"author": "Divi, Renner0E, chaikney"
}
]
2 changes: 1 addition & 1 deletion src/vorta/borg/_compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class BorgCompatibility:
to customize Borg commands by version in the future.
"""

version = "1.1.0"
version = "1.1.4"
path = ""

def set_version(self, version, path):
Expand Down
4 changes: 3 additions & 1 deletion src/vorta/i18n/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ def init_translations(app):

qm_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'qm'))
ui_langs = locale.uiLanguages()
succeeded = translator.load(locale, 'vorta', prefix='.', directory=qm_path) # e.g. vorta/i18n/qm/vorta.de_DE.qm
succeeded = translator.load(
QLocale(ui_langs[0]), 'vorta', prefix='.', directory=qm_path
) # e.g. vorta/i18n/qm/vorta.de_DE.qm
if succeeded:
app.installTranslator(translator)
logger.debug('Loading translation %s for %r.' % ('succeeded' if succeeded else 'failed', ui_langs))
Expand Down
9 changes: 7 additions & 2 deletions src/vorta/views/archive_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,13 @@ def __init__(self, parent=None, app=None):
self.selected_archives = None # TODO: remove unused variable
self.set_icons()

# Connect to palette change
self.app.paletteChanged.connect(lambda p: self.set_icons())
# Connect to events
self.app.paletteChanged.connect(self.set_icons)
self.app.paletteChanged.connect(self.populate_from_profile)
self.app.backup_finished_event.connect(self.populate_from_profile)
self.app.profile_changed_event.connect(self.populate_from_profile)
self.app.profile_changed_event.connect(self.toggle_compact_button_visibility)
self.app.backup_cancelled_event.connect(self.cancel_action)

def set_icons(self):
"""Used when changing between light- and dark mode"""
Expand Down
15 changes: 12 additions & 3 deletions src/vorta/views/log_page.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from PyQt6 import uic
from PyQt6.QtWidgets import (
QAbstractItemView,
QApplication,
QHeaderView,
QTableWidgetItem,
)

from vorta import config
from vorta.store.models import EventLogModel
from vorta.store.models import BackupProfileMixin, EventLogModel
from vorta.utils import get_asset

uifile = get_asset('UI/log_page.ui')
Expand All @@ -21,11 +22,13 @@ class LogTableColumn:
ReturnCode = 4


class LogPage(LogTableBase, LogTableUI):
class LogPage(LogTableBase, LogTableUI, BackupProfileMixin):
def __init__(self, parent=None):
super().__init__(parent)
self.setupUi(self)
self.init_ui()
QApplication.instance().backup_finished_event.connect(self.populate_logs)
QApplication.instance().profile_changed_event.connect(self.populate_logs)

def init_ui(self):
self.logPage.setAlternatingRowColors(True)
Expand All @@ -44,7 +47,13 @@ def init_ui(self):
self.populate_logs()

def populate_logs(self):
event_logs = [s for s in EventLogModel.select().order_by(EventLogModel.start_time.desc())]
profile = self.profile()
event_logs = [
s
for s in EventLogModel.select()
.where(EventLogModel.profile == profile.id)
.order_by(EventLogModel.start_time.desc())
]

sorting = self.logPage.isSortingEnabled()
self.logPage.setSortingEnabled(False)
Expand Down
18 changes: 4 additions & 14 deletions src/vorta/views/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,13 @@ def profile_selection_changed_action(self, index):
backup_profile_id = profile.data(Qt.ItemDataRole.UserRole) if profile else None
if not backup_profile_id:
return

self.current_profile = BackupProfileModel.get(id=backup_profile_id)
self.archiveTab.populate_from_profile()
self.repoTab.populate_from_profile()
self.sourceTab.populate_from_profile()
self.scheduleTab.schedulePage.populate_from_profile()
SettingsModel.update({SettingsModel.str_value: self.current_profile.id}).where(
SettingsModel.key == 'previous_profile_id'
).execute()
self.archiveTab.toggle_compact_button_visibility()

self.app.profile_changed_event.emit()

def profile_clicked_action(self):
if self.miscWidget.isVisible():
Expand Down Expand Up @@ -262,11 +260,8 @@ def profile_imported_event(profile):
self.tr('Profile import successful!'),
self.tr('Profile {} imported.').format(profile.name),
)
self.repoTab.populate_from_profile()
self.scheduleTab.logPage.populate_logs()
self.scheduleTab.networksPage.populate_wifi()
self.miscTab.populate()
self.populate_profile_selector()
self.app.profile_changed_event.emit()

filename = QFileDialog.getOpenFileName(
self,
Expand Down Expand Up @@ -324,10 +319,6 @@ def backup_started_event(self):
self.set_log('')

def backup_finished_event(self):
self.archiveTab.populate_from_profile()
self.repoTab.init_repo_stats()
self.scheduleTab.logPage.populate_logs()

if not self.app.jobs_manager.is_worker_running() and (
self.archiveTab.remaining_refresh_archives == 0 or self.archiveTab.remaining_refresh_archives == 1
): # Either the refresh is done or this is the last archive to refresh.
Expand All @@ -337,7 +328,6 @@ def backup_finished_event(self):
def backup_cancelled_event(self):
self._toggle_buttons(create_enabled=True)
self.set_log(self.tr('Task cancelled'))
self.archiveTab.cancel_action()

def closeEvent(self, event):
# Save window state in SettingsModel
Expand Down
3 changes: 2 additions & 1 deletion src/vorta/views/misc_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ def __init__(self, parent=None):

self.populate()

# Connect to palette change
# Connect to events
QApplication.instance().paletteChanged.connect(lambda p: self.set_icons())
QApplication.instance().profile_changed_event.connect(self.populate)

def populate(self):
"""
Expand Down
10 changes: 5 additions & 5 deletions src/vorta/views/networks_page.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from PyQt6 import uic
from PyQt6.QtCore import Qt
from PyQt6.QtWidgets import QCheckBox, QLabel, QListWidget, QListWidgetItem
from PyQt6.QtWidgets import QApplication, QCheckBox, QLabel, QListWidget, QListWidgetItem

from vorta.store.models import BackupProfileMixin, WifiSettingModel
from vorta.utils import get_asset, get_sorted_wifis
Expand All @@ -18,12 +18,12 @@ def __init__(self, parent=None):
self.meteredNetworksCheckBox: QCheckBox = self.findChild(QCheckBox, 'meteredNetworksCheckBox')
self.wifiListWidget: QListWidget = self.findChild(QListWidget, 'wifiListWidget')

self.populate_wifi()
self.setup_connections()

def setup_connections(self):
# Connect signals
self.meteredNetworksCheckBox.stateChanged.connect(self.on_metered_networks_state_changed)
self.wifiListWidget.itemChanged.connect(self.save_wifi_item)
QApplication.instance().profile_changed_event.connect(self.populate_wifi)

self.populate_wifi()

def on_metered_networks_state_changed(self, state):
profile = self.profile()
Expand Down
7 changes: 4 additions & 3 deletions src/vorta/views/repo_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,12 @@ def __init__(self, parent=None):
self.bAddSSHKey.clicked.connect(self.create_ssh_key)

self.set_icons()
self.populate_from_profile() # needs init of ssh and compression items

# Connect to palette change
# Connect to events
QApplication.instance().paletteChanged.connect(lambda p: self.set_icons())

self.populate_from_profile() # needs init of ssh and compression items
QApplication.instance().profile_changed_event.connect(self.populate_from_profile)
QApplication.instance().backup_finished_event.connect(self.init_repo_stats)

def set_icons(self):
self.bAddSSHKey.setIcon(get_colored_icon("plus"))
Expand Down
3 changes: 3 additions & 0 deletions src/vorta/views/schedule_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ def __init__(self, parent=None):
self.app.scheduler.schedule_changed.connect(lambda pid: self.draw_next_scheduled_backup())
self.populate_from_profile()

# Listen for events
self.app.profile_changed_event.connect(self.populate_from_profile)

def on_scheduler_change(self, _):
profile = self.profile()
for label, obj in self.schedulerRadioMapping.items():
Expand Down
29 changes: 19 additions & 10 deletions src/vorta/views/shell_commands_page.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from PyQt6 import uic
from PyQt6.QtWidgets import QLineEdit, QWidget
from PyQt6.QtWidgets import QApplication, QLineEdit, QWidget

from vorta.store.models import BackupProfileMixin
from vorta.utils import get_asset
Expand All @@ -14,16 +14,8 @@ def __init__(self, parent=None):
self.preBackupCmdLineEdit: QLineEdit = self.findChild(QLineEdit, 'preBackupCmdLineEdit')
self.postBackupCmdLineEdit: QLineEdit = self.findChild(QLineEdit, 'postBackupCmdLineEdit')
self.createCmdLineEdit: QLineEdit = self.findChild(QLineEdit, 'createCmdLineEdit')
profile = self.profile()
if profile.repo:
self.createCmdLineEdit.setText(profile.repo.create_backup_cmd)
self.createCmdLineEdit.setEnabled(True)
else:
self.createCmdLineEdit.setEnabled(False)
self.populate_from_profile()

self.setup_connections()

def setup_connections(self):
self.preBackupCmdLineEdit.textEdited.connect(
lambda new_val, attr='pre_backup_cmd': self.save_profile_attr(attr, new_val)
)
Expand All @@ -33,6 +25,23 @@ def setup_connections(self):
self.createCmdLineEdit.textEdited.connect(
lambda new_val, attr='create_backup_cmd': self.save_repo_attr(attr, new_val)
)
QApplication.instance().profile_changed_event.connect(self.populate_from_profile)

def populate_from_profile(self):
profile = self.profile()
if profile.repo:
self.createCmdLineEdit.setText(profile.repo.create_backup_cmd)
self.createCmdLineEdit.setEnabled(True)

self.preBackupCmdLineEdit.setText(profile.pre_backup_cmd)
self.preBackupCmdLineEdit.setEnabled(True)

self.postBackupCmdLineEdit.setText(profile.post_backup_cmd)
self.postBackupCmdLineEdit.setEnabled(True)
else:
self.createCmdLineEdit.setEnabled(False)
self.preBackupCmdLineEdit.setEnabled(False)
self.postBackupCmdLineEdit.setEnabled(False)

def save_profile_attr(self, attr, new_value):
profile = self.profile()
Expand Down
7 changes: 4 additions & 3 deletions src/vorta/views/source_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,14 @@ def __init__(self, parent=None):
self.bExclude.clicked.connect(self.show_exclude_dialog)
header.sortIndicatorChanged.connect(self.update_sort_order)

# Connect to palette change
QApplication.instance().paletteChanged.connect(lambda p: self.set_icons())

# Populate
self.populate_from_profile()
self.set_icons()

# Listen for events
QApplication.instance().paletteChanged.connect(lambda p: self.set_icons())
QApplication.instance().profile_changed_event.connect(self.populate_from_profile)

def set_icons(self):
"Used when changing between light- and dark mode"
self.addButton.setIcon(get_colored_icon('plus'))
Expand Down

0 comments on commit 736995c

Please sign in to comment.