mirror of
https://github.com/borgbase/vorta
synced 2025-01-03 05:36:19 +00:00
commit
7ae3f3222b
11 changed files with 39 additions and 34 deletions
|
@ -74,6 +74,7 @@ before_script:
|
|||
|
||||
script:
|
||||
- pytest --forked
|
||||
- if [ $TRAVIS_OS_NAME = "linux" ]; then tox -e flake8; fi
|
||||
|
||||
#after_script:
|
||||
#- |
|
||||
|
|
|
@ -63,7 +63,7 @@ filterwarnings =
|
|||
source = src
|
||||
|
||||
[flake8]
|
||||
ignore = W503
|
||||
ignore =
|
||||
max-line-length = 120
|
||||
exclude = build,dist,.git,.idea,.cache,.tox,.eggs
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
class BorgThread(QtCore.QThread, BackupProfileMixin):
|
||||
"""
|
||||
Base class to run `borg` command line jobs. If a command needs more pre- or post-processing
|
||||
it should sublass `BorgThread`.
|
||||
it should subclass `BorgThread`.
|
||||
"""
|
||||
|
||||
updated = QtCore.pyqtSignal(str)
|
||||
|
@ -42,12 +42,14 @@ def __init__(self, cmd, params, parent=None):
|
|||
|
||||
env = os.environ.copy()
|
||||
env['BORG_HOSTNAME_IS_UNIQUE'] = '1'
|
||||
if params.get('password') and params['password'] is not None:
|
||||
env['BORG_PASSPHRASE'] = params['password']
|
||||
password = params.get('password')
|
||||
if password is not None:
|
||||
env['BORG_PASSPHRASE'] = password
|
||||
|
||||
env['BORG_RSH'] = 'ssh -oStrictHostKeyChecking=no'
|
||||
if params.get('ssh_key') and params['ssh_key'] is not None:
|
||||
env['BORG_RSH'] += f' -i ~/.ssh/{params["ssh_key"]}'
|
||||
ssh_key = params.get('ssh_key')
|
||||
if ssh_key is not None:
|
||||
env['BORG_RSH'] += f' -i ~/.ssh/{ssh_key}'
|
||||
|
||||
self.env = env
|
||||
self.cmd = cmd
|
||||
|
|
|
@ -63,9 +63,13 @@ def prepare(cls, profile):
|
|||
current_wifi = get_current_wifi()
|
||||
if current_wifi is not None:
|
||||
wifi_is_disallowed = WifiSettingModel.select().where(
|
||||
(WifiSettingModel.ssid == current_wifi)
|
||||
& (WifiSettingModel.allowed is False)
|
||||
& (WifiSettingModel.profile == profile.id)
|
||||
(
|
||||
WifiSettingModel.ssid == current_wifi
|
||||
) & (
|
||||
WifiSettingModel.allowed is False
|
||||
) & (
|
||||
WifiSettingModel.profile == profile.id
|
||||
)
|
||||
)
|
||||
if wifi_is_disallowed.count() > 0 and profile.repo.is_remote_repo():
|
||||
ret['message'] = 'Current Wifi is not allowed.'
|
||||
|
|
|
@ -113,9 +113,13 @@ def post_backup_tasks(self, profile_id):
|
|||
|
||||
validation_cutoff = date.today() - timedelta(days=7 * profile.validation_weeks)
|
||||
recent_validations = EventLogModel.select().where(
|
||||
(EventLogModel.subcommand == 'check')
|
||||
& (EventLogModel.start_time > validation_cutoff)
|
||||
& (EventLogModel.repo_url == profile.repo.url)
|
||||
(
|
||||
EventLogModel.subcommand == 'check'
|
||||
) & (
|
||||
EventLogModel.start_time > validation_cutoff
|
||||
) & (
|
||||
EventLogModel.repo_url == profile.repo.url
|
||||
)
|
||||
).count()
|
||||
if profile.validation_on and recent_validations == 0:
|
||||
msg = BorgCheckThread.prepare(profile)
|
||||
|
|
|
@ -4,11 +4,8 @@
|
|||
|
||||
def get_updater():
|
||||
if sys.platform == 'darwin' and getattr(sys, 'frozen', False):
|
||||
"""
|
||||
Use sparkle framework on macOS.
|
||||
|
||||
Examples: https://programtalk.com/python-examples/objc.loadBundle/
|
||||
"""
|
||||
# Use sparkle framework on macOS.
|
||||
# Examples: https://programtalk.com/python-examples/objc.loadBundle/
|
||||
from objc import loadBundle
|
||||
bundle_path = os.path.join(os.path.dirname(sys.executable), os.pardir, 'Frameworks', 'Sparkle.framework')
|
||||
loadBundle('Sparkle', globals(), bundle_path)
|
||||
|
|
|
@ -39,7 +39,7 @@ def delete_password(self, service, repo_url):
|
|||
pass
|
||||
|
||||
|
||||
"""Select keyring/Workaround for pyinstaller+keyring issue."""
|
||||
# Select keyring/Workaround for pyinstaller+keyring issue.
|
||||
if sys.platform == 'darwin':
|
||||
from keyring.backends import OS_X
|
||||
keyring.set_keyring(OS_X.Keyring())
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import sys
|
||||
from datetime import timedelta
|
||||
from PyQt5 import uic, QtCore
|
||||
from PyQt5.QtCore import QSize
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQt5.QtWidgets import QTableWidgetItem, QTableView, QHeaderView, QComboBox, QToolButton, QButtonGroup, QToolBar
|
||||
from PyQt5.QtWidgets import QTableWidgetItem, QTableView, QHeaderView
|
||||
|
||||
from vorta.borg.prune import BorgPruneThread
|
||||
from vorta.borg.list import BorgListThread
|
||||
|
|
|
@ -949,10 +949,13 @@
|
|||
rcc_version = 2
|
||||
qt_resource_struct = qt_resource_struct_v2
|
||||
|
||||
|
||||
def qInitResources():
|
||||
QtCore.qRegisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
|
||||
|
||||
def qCleanupResources():
|
||||
QtCore.qUnregisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
|
||||
|
||||
qInitResources()
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
import os
|
||||
from PyQt5 import uic
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QApplication, QTreeWidgetItem, QHeaderView
|
||||
|
||||
from paramiko.rsakey import RSAKey
|
||||
from paramiko.ecdsakey import ECDSAKey
|
||||
from paramiko.ed25519key import Ed25519Key
|
||||
from PyQt5.QtWidgets import QTreeWidgetItem, QHeaderView
|
||||
|
||||
from ..utils import get_asset
|
||||
|
||||
|
@ -13,6 +8,7 @@
|
|||
ExtractDialogUI, ExtractDialogBase = uic.loadUiType(uifile)
|
||||
n = 0
|
||||
|
||||
|
||||
class ExtractDialog(ExtractDialogBase, ExtractDialogUI):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
@ -30,7 +26,7 @@ def __init__(self):
|
|||
'another key2': ['value2', 'value', 'value4']}
|
||||
for j in range(50):
|
||||
d[f'folder-{i}'][f'large folder {j}'] = {'another key1': 'another value1',
|
||||
'another key2': ['value2', 'value', 'value4']}
|
||||
'another key2': ['value2', 'value', 'value4']}
|
||||
|
||||
# add top-level folders to test scroll performance
|
||||
for f in range(1000000):
|
||||
|
@ -55,6 +51,7 @@ def build_tree(self):
|
|||
fill_item(self.fileTree.invisibleRootItem(), self.d)
|
||||
print('Added test items', n)
|
||||
|
||||
|
||||
def fill_item(item, value):
|
||||
global n
|
||||
# item.setExpanded(True)
|
||||
|
@ -67,7 +64,7 @@ def fill_item(item, value):
|
|||
child.setFlags(child.flags() | Qt.ItemIsUserCheckable)
|
||||
child.setCheckState(0, Qt.Unchecked)
|
||||
item.addChild(child)
|
||||
n+=1
|
||||
n += 1
|
||||
fill_item(child, val)
|
||||
elif type(value) is list:
|
||||
for val in value:
|
||||
|
@ -75,7 +72,7 @@ def fill_item(item, value):
|
|||
child.setFlags(child.flags() | Qt.ItemIsUserCheckable)
|
||||
child.setCheckState(0, Qt.Unchecked)
|
||||
item.addChild(child)
|
||||
n+=1
|
||||
n += 1
|
||||
if type(val) is dict:
|
||||
child.setText(0, '[dict]')
|
||||
fill_item(child, val)
|
||||
|
@ -90,5 +87,4 @@ def fill_item(item, value):
|
|||
child.setFlags(child.flags() | Qt.ItemIsUserCheckable)
|
||||
child.setCheckState(0, Qt.Unchecked)
|
||||
item.addChild(child)
|
||||
n+=1
|
||||
|
||||
n += 1
|
||||
|
|
|
@ -110,8 +110,8 @@ def profile_delete_action(self):
|
|||
self.profile_select_action(1)
|
||||
|
||||
def backup_started_event(self):
|
||||
self.set_status(progress_max=0)
|
||||
self._toggle_buttons(create_enabled=False)
|
||||
self.set_status(progress_max=0)
|
||||
self._toggle_buttons(create_enabled=False)
|
||||
|
||||
def backup_finished_event(self):
|
||||
self.set_status(progress_max=100)
|
||||
|
|
Loading…
Reference in a new issue