Skip to content

Commit

Permalink
Added a function to MockFileDialog along with the change in original …
Browse files Browse the repository at this point in the history
…files to make sure multiple directories are added when directories are chosen
  • Loading branch information
raj bunsha committed Feb 15, 2024
1 parent 43867e3 commit 5e996be
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/vorta/views/archive_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,8 @@ def receive():
self.app.jobs_manager.add_job(job)

dialog = choose_file_dialog(self, self.tr("Choose Mount Point"), want_folder=True)
dialog.filesSelected.connect(receive)
dialog.open()
if dialog.exec():
receive()

def mount_result(self, result):
if result['returncode'] == 0:
Expand Down Expand Up @@ -789,8 +789,8 @@ def receive():
self._set_status(params['message'])

dialog = choose_file_dialog(self, self.tr("Choose Extraction Point"), want_folder=True)
dialog.filesSelected.connect(receive)
dialog.open()
if dialog.exec():
receive()

window = ExtractDialog(archive, model)
self._toggle_all_buttons(True)
Expand Down
4 changes: 2 additions & 2 deletions src/vorta/views/repo_add_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def receive():
self.is_remote_repo = False

dialog = choose_file_dialog(self, self.tr("Choose Location of Borg Repository"))
dialog.filesSelected.connect(receive)
dialog.open()
if dialog.exec():
receive()

def use_remote_repo_action(self):
self.repoURL.setText('')
Expand Down
4 changes: 2 additions & 2 deletions src/vorta/views/source_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ def receive():

msg = self.tr("Choose directory to back up") if want_folder else self.tr("Choose file(s) to back up")
dialog = choose_file_dialog(self, msg, want_folder=want_folder)
dialog.filesSelected.connect(receive)
dialog.open()
if dialog.exec():
receive()

def source_copy(self, index=None):
"""
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ def __init__(self, *args, **kwargs):

def open(self, func):
func()

def exec(self):
return 1

def selectedFiles(self):
if self.subdirectory:
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ def __init__(self, *args, **kwargs):

def open(self, func):
func()

def exec(self):
return 1

def selectedFiles(self):
return ['/tmp']
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/test_archives.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class MockFileDialog:
def open(self, func):
func()

def exec(self):
return 1

def selectedFiles(self):
return ['/tmp']

Expand Down

0 comments on commit 5e996be

Please sign in to comment.