From 0862c827d865d4a75004f919a8663c54f4f83555 Mon Sep 17 00:00:00 2001 From: bastiencyr <63359575+bastiencyr@users.noreply.github.com> Date: Fri, 4 Jun 2021 09:33:16 +0200 Subject: [PATCH] Alert when deleting last profile. By @bastiencyr. (#1006) Fixes #918 --- src/vorta/views/main_window.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/vorta/views/main_window.py b/src/vorta/views/main_window.py index 8fe377b3..521c7173 100644 --- a/src/vorta/views/main_window.py +++ b/src/vorta/views/main_window.py @@ -1,13 +1,13 @@ from PyQt5 import QtCore, uic -from PyQt5.QtWidgets import QShortcut, QMessageBox, QCheckBox +from PyQt5.QtCore import QPoint from PyQt5.QtGui import QKeySequence +from PyQt5.QtWidgets import QShortcut, QMessageBox, QCheckBox, QToolTip from vorta.borg.borg_thread import BorgThread from vorta.models import BackupProfileModel, SettingsModel from vorta.utils import borg_compat, get_asset, is_system_tray_available, get_network_status_monitor -from vorta.views.utils import get_colored_icon from vorta.views.partials.loading_button import LoadingButton - +from vorta.views.utils import get_colored_icon from .archive_tab import ArchiveTab from .misc_tab import MiscTab from .profile_add_edit_dialog import AddProfileWindow, EditProfileWindow @@ -155,6 +155,11 @@ def profile_delete_action(self): self.profileSelector.removeItem(self.profileSelector.currentIndex()) self.profile_select_action(0) + else: + warn = self.tr("Can't delete the last profile.") + point = QPoint(0, self.profileDeleteButton.size().height() / 2) + QToolTip.showText(self.profileDeleteButton.mapToGlobal(point), warn) + def profile_add_action(self): window = AddProfileWindow() self.window = window # For tests