diff --git a/setup.cfg b/setup.cfg index 58743217..1a079d3a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -33,7 +33,7 @@ setup_requires = install_requires = appdirs paramiko - pyqt5 + pyqt5 < 5.15 peewee python-dateutil apscheduler diff --git a/src/vorta/application.py b/src/vorta/application.py index 76fada6b..fedd92f3 100644 --- a/src/vorta/application.py +++ b/src/vorta/application.py @@ -2,16 +2,18 @@ import os import sys import sip from PyQt5 import QtCore +from PyQt5.QtWidgets import QMessageBox + +from vorta.borg.create import BorgCreateThread from vorta.borg.version import BorgVersionThread from vorta.config import STATE_DIR -from .borg.create import BorgCreateThread -from .i18n import init_translations, translate -from .models import BackupProfileModel, SettingsModel -from .qt_single_application import QtSingleApplication -from .scheduler import VortaScheduler -from .tray_menu import TrayMenu -from .utils import borg_compat, parse_args -from .views.main_window import MainWindow +from vorta.i18n import init_translations, translate +from vorta.models import BackupProfileModel, SettingsModel +from vorta.qt_single_application import QtSingleApplication +from vorta.scheduler import VortaScheduler +from vorta.tray_menu import TrayMenu +from vorta.utils import borg_compat, parse_args +from vorta.views.main_window import MainWindow APP_ID = os.path.join(STATE_DIR, "socket") @@ -110,13 +112,29 @@ class VortaApp(QtSingleApplication): def set_borg_details_action(self): params = BorgVersionThread.prepare() if not params['ok']: + self._alert_missing_borg() return thread = BorgVersionThread(params['cmd'], params, parent=self) thread.result.connect(self.set_borg_details_result) thread.start() def set_borg_details_result(self, result): - borg_compat.set_version(result['data']['version'], result['data']['path']) - if self._main_window_exists(): - self.main_window.miscTab.set_borg_details(borg_compat.version, borg_compat.path) - self.main_window.repoTab.toggle_available_compression() + """ + Receive result from BorgVersionThread. If MainWindow is open, set the version in misc tab. + If no valid version was found, display an error. + """ + if 'version' in result['data']: + borg_compat.set_version(result['data']['version'], result['data']['path']) + if self._main_window_exists(): + self.main_window.miscTab.set_borg_details(borg_compat.version, borg_compat.path) + self.main_window.repoTab.toggle_available_compression() + else: + self._alert_missing_borg() + + def _alert_missing_borg(self): + msg = QMessageBox() + msg.setIcon(QMessageBox.Critical) + msg.setText(self.tr("No Borg Binary Found")) + msg.setInformativeText(self.tr("Vorta was unable to locate a usable Borg Backup binary.")) + msg.setStandardButtons(QMessageBox.Ok) + msg.exec_() diff --git a/src/vorta/assets/UI/sourcetab.ui b/src/vorta/assets/UI/sourcetab.ui index 2969e763..a5bc6b91 100644 --- a/src/vorta/assets/UI/sourcetab.ui +++ b/src/vorta/assets/UI/sourcetab.ui @@ -100,7 +100,7 @@ - **/.DS_Store + E.g. **/.DS_Store @@ -113,7 +113,7 @@ - .nobackup + E.g. CACHE or .nobackup diff --git a/src/vorta/models.py b/src/vorta/models.py index 1aa4e550..c38c6cab 100644 --- a/src/vorta/models.py +++ b/src/vorta/models.py @@ -13,7 +13,7 @@ import peewee as pw from playhouse.migrate import SqliteMigrator, migrate from vorta.i18n import trans_late -from vorta.utils import is_system_tray_available, slugify +from vorta.utils import slugify SCHEMA_VERSION = 14 @@ -346,8 +346,6 @@ def init_db(con=None): # Create missing settings and update labels. Leave setting values untouched. for setting in get_misc_settings(): s, created = SettingsModel.get_or_create(key=setting['key'], defaults=setting) - if created and setting['key'] == "enable_notifications_success": - s.value = not bool(is_system_tray_available()) s.label = setting['label'] s.save() diff --git a/tests/test_source.py b/tests/test_source.py index b0a31b68..6360f4d3 100644 --- a/tests/test_source.py +++ b/tests/test_source.py @@ -12,4 +12,4 @@ def test_add_folder(qapp, qtbot, tmpdir, monkeypatch, choose_file_dialog): tab = main.sourceTab qtbot.mouseClick(tab.sourceAddFolder, QtCore.Qt.LeftButton) - qtbot.waitUntil(lambda: tab.sourceFilesWidget.count() == 2) + qtbot.waitUntil(lambda: tab.sourceFilesWidget.count() == 2, timeout=5000)