From bf8d132620075a90a39813bf1c7ae14a53b454a1 Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Sun, 28 Apr 2019 20:34:17 +0200 Subject: [PATCH] move the mount check to it's own method --- borg_qt/main_window.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/borg_qt/main_window.py b/borg_qt/main_window.py index 5edb1b1..34db17e 100644 --- a/borg_qt/main_window.py +++ b/borg_qt/main_window.py @@ -120,12 +120,8 @@ class MainWindow(QMainWindow): def create_backup(self): """Creates a backup of the selected item in the treeview.""" - if self.mount_paths: - if self.yes_no("To create an archive you need to unmout all " - "archives. Do you want to continue?"): - self._umount_archives() - else: - return + if not self._check_mounts(): + return try: self._check_path() backup_thread = borg.BackupThread([self.src_path], @@ -276,6 +272,15 @@ class MainWindow(QMainWindow): # Opens the path in a file manager open_path(mount_path) + def _check_mounts(self): + if self.mount_paths: + if self.yes_no("To proceed you need to unmout all " + "archives. Do you want to continue?"): + self._umount_archives() + return True + else: + return False + def yes_no(self, question): """Simple yes/no dialog.