-
Notifications
You must be signed in to change notification settings - Fork 169
feat: refresh multiple archives #1723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
24b5197
888eaea
20a79c3
dd0cbf2
d1bd6f7
cecc66f
133216f
0997825
f2bd1a0
7dac1ba
5884a88
33b241f
19f666e
69f8243
8c3179e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -330,12 +330,14 @@ def on_selection_change(self, selected=None, deselected=None): | |
| if not self.repoactions_enabled: | ||
| reason = self.tr("(borg already running)") | ||
|
|
||
| # toggle delete button | ||
| # Disable the delete and refresh buttons if no archive is selected | ||
| if self.repoactions_enabled and len(indexes) > 0: | ||
| self.bDelete.setEnabled(True) | ||
| self.bRefreshArchive.setEnabled(True) | ||
| self.bDelete.setToolTip(self.tooltip_dict.get(self.bDelete, "")) | ||
| else: | ||
| self.bDelete.setEnabled(False) | ||
| self.bRefreshArchive.setEnabled(False) | ||
diivi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| tooltip = self.tooltip_dict[self.bDelete] | ||
| self.bDelete.setToolTip(tooltip + " " + reason or self.tr("(Select minimum one archive)")) | ||
|
|
||
|
|
@@ -353,7 +355,8 @@ def on_selection_change(self, selected=None, deselected=None): | |
|
|
||
| if self.repoactions_enabled and len(indexes) == 1: | ||
| # Enable archive actions | ||
| self.fArchiveActions.setEnabled(True) | ||
| for widget in [self.bMountArchive, self.bExtract, self.bRename]: | ||
diivi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| widget.setEnabled(True) | ||
|
|
||
| for index in range(layout.count()): | ||
| widget = layout.itemAt(index).widget() | ||
|
|
@@ -365,14 +368,11 @@ def on_selection_change(self, selected=None, deselected=None): | |
| reason = reason or self.tr("(Select exactly one archive)") | ||
|
|
||
| # too few or too many selected. | ||
| self.fArchiveActions.setEnabled(False) | ||
|
|
||
| for index in range(layout.count()): | ||
| widget = layout.itemAt(index).widget() | ||
| for widget in [self.bMountArchive, self.bExtract, self.bRename]: | ||
| tooltip = widget.toolTip() | ||
|
|
||
| tooltip = self.tooltip_dict.setdefault(widget, tooltip) | ||
| widget.setToolTip(tooltip + " " + reason) | ||
| widget.setEnabled(False) | ||
|
|
||
| # special treatment for dynamic mount/unmount button. | ||
| self.bmountarchive_refresh() | ||
|
|
@@ -488,15 +488,28 @@ def list_result(self, result): | |
| self.populate_from_profile() | ||
|
|
||
| def refresh_archive_info(self): | ||
| archive_name = self.selected_archive_name() | ||
| if archive_name is not None: | ||
| params = BorgInfoArchiveJob.prepare(self.profile(), archive_name) | ||
| if params['ok']: | ||
| job = BorgInfoArchiveJob(params['cmd'], params, self.profile().repo.id) | ||
| job.updated.connect(self._set_status) | ||
| job.result.connect(self.info_result) | ||
| self._toggle_all_buttons(False) | ||
| self.app.jobs_manager.add_job(job) | ||
| selected_archives = self.archiveTable.selectionModel().selectedRows() | ||
| profile = self.profile() | ||
|
|
||
| name_list = [] | ||
| for index in selected_archives: | ||
| name_list.append(self.archiveTable.item(index.row(), 4).text()) | ||
|
|
||
| archive_list = ( | ||
| profile.repo.archives.select().where(ArchiveModel.name << name_list).order_by(ArchiveModel.time.desc()) | ||
| ) | ||
|
|
||
| archive_names = [archive.name for archive in archive_list] | ||
diivi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| for archive_name in archive_names: | ||
| if archive_name is not None: | ||
| params = BorgInfoArchiveJob.prepare(self.profile(), archive_name) | ||
| if params['ok']: | ||
diivi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| job = BorgInfoArchiveJob(params['cmd'], params, self.profile().repo.id) | ||
| job.updated.connect(self._set_status) | ||
| job.result.connect(self.info_result) | ||
| self._toggle_all_buttons(False) | ||
| self.app.jobs_manager.add_job(job) | ||
|
|
||
| def info_result(self, result): | ||
| self._toggle_all_buttons(True) | ||
|
||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.