Hide SSH dropdown for local repos. By @real-yfprojects (#1407)

* src/vorta/assets/UI/repotab.ui : Name `frameRepoSettings` and `layoutSSHKey`.

* src/vorta/views/repo_tab.py (RepoTab.init_repo_stats): Disable `frameRepoSettings` if no repo is selected.
	Disable widgets in `layoutSSHKey` in case of a local repository except from `bAddSSHKey` so the
	the user can add a key for a adding a repo.

Co-authored-by: real-yfprojects <real-yfprojects@users.noreply.github.com>
This commit is contained in:
yfprojects 2022-08-26 10:23:16 +00:00 committed by GitHub
parent 8b36a630c5
commit 4e06b6df5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View File

@ -165,7 +165,7 @@
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QFrame" name="frame">
<widget class="QFrame" name="frameRepoSettings">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>3</horstretch>
@ -220,7 +220,7 @@
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="layoutSSHKey">
<item>
<widget class="QComboBox" name="sshComboBox">
<property name="sizePolicy">

View File

@ -108,6 +108,16 @@ class RepoTab(RepoBase, RepoUI, BackupProfileMixin):
# set labels
repo: RepoModel = self.profile().repo
if repo is not None:
self.frameRepoSettings.setEnabled(True)
# local repo doesn't use ssh
ssh_enabled = repo.is_remote_repo()
# self.bAddSSHKey.setEnabled(ssh_enabled)
# otherwise one cannot add a ssh key for adding a repo
self.sshComboBox.setEnabled(ssh_enabled)
self.sshKeyToClipboardButton.setEnabled(ssh_enabled)
# update stats
if repo.unique_csize is not None:
self.sizeCompressed.setText(pretty_bytes(repo.unique_csize))
self.sizeCompressed.setToolTip('')
@ -131,6 +141,10 @@ class RepoTab(RepoBase, RepoUI, BackupProfileMixin):
self.repoEncryption.setText(str(repo.encryption))
else:
# Compression and SSH key are only valid entries for a repo
self.frameRepoSettings.setEnabled(False)
# unset stats
self.sizeCompressed.setText(na)
self.sizeCompressed.setToolTip(no_repo_selected)