Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from PyQt5 import uic
from PyQt5.QtWidgets import QCheckBox
from vorta.i18n import translate
from vorta.utils import get_asset
from vorta.autostart import open_app_at_startup
from vorta.models import SettingsModel, BackupProfileMixin, get_misc_settings
from vorta._version import __version__
from vorta.views.utils import get_theme_class
from vorta.config import LOG_DIR
uifile = get_asset('UI/misctab.ui')
MiscTabUI, MiscTabBase = uic.loadUiType(uifile, from_imports=True, import_from=get_theme_class())
class MiscTab(MiscTabBase, MiscTabUI, BackupProfileMixin):
def __init__(self, parent=None):
super().__init__(parent)
self.setupUi(parent)
self.versionLabel.setText(__version__)
self.logLink.setText(f"<a>Log</a>")
for setting in SettingsModel.select().where(SettingsModel.type == 'checkbox'):
x = filter(lambda s: s['key'] == setting.key, get_misc_settings())
if not list(x): # Skip settings that aren't specified in vorta.models.
continue
b = QCheckBox(translate('settings', setting.label))
from PyQt5.QtWidgets import QMessageBox, QShortcut
from vorta.borg.borg_thread import BorgThread
from vorta.i18n import trans_late
from vorta.models import BackupProfileModel
from vorta.utils import borg_compat, get_asset, is_system_tray_available
from vorta.views.utils import get_theme_class
from .archive_tab import ArchiveTab
from .misc_tab import MiscTab
from .profile_add_edit_dialog import AddProfileWindow, EditProfileWindow
from .repo_tab import RepoTab
from .schedule_tab import ScheduleTab
from .source_tab import SourceTab
uifile = get_asset('UI/mainwindow.ui')
MainWindowUI, MainWindowBase = uic.loadUiType(uifile, from_imports=True, import_from=get_theme_class())
class MainWindow(MainWindowBase, MainWindowUI):
def __init__(self, parent=None):
super().__init__()
self.setupUi(self)
self.setWindowTitle('Vorta for Borg Backup')
self.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)
self.app = parent
self.current_profile = BackupProfileModel.select().order_by('id').first()
self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.WindowMinimizeButtonHint)
self.tests_running = False
# Load tab models
import sys
import os
import datetime
from collections import namedtuple
from PyQt5 import uic
from PyQt5.QtCore import QAbstractItemModel, QModelIndex, Qt
from PyQt5.QtWidgets import QApplication, QHeaderView
from vorta.utils import get_asset, pretty_bytes, get_dict_from_list, nested_dict
uifile = get_asset('UI/extractdialog.ui')
ExtractDialogUI, ExtractDialogBase = uic.loadUiType(uifile)
ISO_FORMAT = '%Y-%m-%dT%H:%M:%S.%f'
files_with_attributes = None
nested_file_list = None
selected_files_folders = None
class ExtractDialog(ExtractDialogBase, ExtractDialogUI):
def __init__(self, fs_data, archive):
super().__init__()
self.setupUi(self)
global files_with_attributes, nested_file_list, selected_files_folders
# Clear global file lists
files_with_attributes = []
from vorta.borg.extract import BorgExtractThread
from vorta.borg.list_archive import BorgListArchiveThread
from vorta.borg.list_repo import BorgListRepoThread
from vorta.borg.mount import BorgMountThread
from vorta.borg.prune import BorgPruneThread
from vorta.borg.umount import BorgUmountThread
from vorta.i18n import trans_late
from vorta.models import ArchiveModel, BackupProfileMixin
from vorta.utils import (choose_file_dialog, format_archive_name, get_asset,
get_mount_points, pretty_bytes)
from vorta.views.diff_dialog import DiffDialog
from vorta.views.diff_result import DiffResult
from vorta.views.extract_dialog import ExtractDialog
from vorta.views.utils import get_theme_class
uifile = get_asset('UI/archivetab.ui')
ArchiveTabUI, ArchiveTabBase = uic.loadUiType(uifile, from_imports=True, import_from=get_theme_class())
class ArchiveTab(ArchiveTabBase, ArchiveTabUI, BackupProfileMixin):
prune_intervals = ['hour', 'day', 'week', 'month', 'year']
def __init__(self, parent=None):
super().__init__(parent)
self.setupUi(parent)
self.mount_points = {}
self.menu = None
self.toolBox.setCurrentIndex(0)
header = self.archiveTable.horizontalHeader()
header.setVisible(True)
header.setSectionResizeMode(0, QHeaderView.ResizeToContents)
import os
from PyQt5 import uic, QtCore
from PyQt5.QtWidgets import QApplication, QMessageBox
from vorta.models import RepoModel, ArchiveModel, BackupProfileMixin
from vorta.utils import pretty_bytes, get_private_keys, get_asset, borg_compat
from .ssh_dialog import SSHAddWindow
from .repo_add_dialog import AddRepoWindow, ExistingRepoWindow
from .utils import get_theme_class
uifile = get_asset('UI/repotab.ui')
RepoUI, RepoBase = uic.loadUiType(uifile, from_imports=True, import_from=get_theme_class())
class RepoTab(RepoBase, RepoUI, BackupProfileMixin):
repo_changed = QtCore.pyqtSignal()
repo_added = QtCore.pyqtSignal()
def __init__(self, parent=None):
super().__init__(parent)
self.setupUi(parent)
# Populate dropdowns
self.repoSelector.model().item(0).setEnabled(False)
self.repoSelector.addItem(self.tr('+ Initialize New Repository'), 'new')
self.repoSelector.addItem(self.tr('+ Add Existing Repository'), 'existing')
self.repoSelector.insertSeparator(3)
import os
from PyQt5 import uic
from PyQt5.QtCore import QAbstractItemModel, QModelIndex, Qt, QVariant
from PyQt5.QtGui import QColor
from PyQt5.QtWidgets import QHeaderView
from vorta.utils import (get_asset, get_dict_from_list, nested_dict,
pretty_bytes)
uifile = get_asset('UI/diffresult.ui')
DiffResultUI, DiffResultBase = uic.loadUiType(uifile)
files_with_attributes = None
nested_file_list = None
selected_files_folders = None
class DiffResult(DiffResultBase, DiffResultUI):
def __init__(self, fs_data, archive_newer, archive_older):
super().__init__()
self.setupUi(self)
global files_with_attributes, nested_file_list, selected_files_folders
# Clear global file lists
files_with_attributes = []
nested_file_list = nested_dict()
import re
from PyQt5 import uic
from vorta.utils import get_private_keys, get_asset, choose_file_dialog, borg_compat
from vorta.borg.init import BorgInitThread
from vorta.borg.info import BorgInfoThread
from vorta.views.utils import get_theme_class
uifile = get_asset('UI/repoadd.ui')
AddRepoUI, AddRepoBase = uic.loadUiType(uifile, from_imports=True, import_from=get_theme_class())
class AddRepoWindow(AddRepoBase, AddRepoUI):
def __init__(self, parent=None):
super().__init__(parent)
self.setupUi(self)
self.result = None
self.is_remote_repo = True
self.closeButton.clicked.connect(self.close)
self.saveButton.clicked.connect(self.run)
self.chooseLocalFolderButton.clicked.connect(self.choose_local_backup_folder)
self.useRemoteRepoButton.clicked.connect(self.use_remote_repo_action)
self.tabWidget.setCurrentIndex(0)
from PyQt5 import uic, QtCore
from PyQt5.QtWidgets import QListWidgetItem, QApplication, QTableView, QHeaderView, QTableWidgetItem
from vorta.utils import get_asset, get_sorted_wifis
from vorta.models import EventLogModel, WifiSettingModel, BackupProfileMixin
from vorta.views.utils import get_theme_class
uifile = get_asset('UI/scheduletab.ui')
ScheduleUI, ScheduleBase = uic.loadUiType(uifile, from_imports=True, import_from=get_theme_class())
class ScheduleTab(ScheduleBase, ScheduleUI, BackupProfileMixin):
def __init__(self, parent=None):
super().__init__(parent)
self.setupUi(parent)
self.app = QApplication.instance()
self.toolBox.setCurrentIndex(0)
self.schedulerRadioMapping = {
'off': self.scheduleOffRadio,
'interval': self.scheduleIntervalRadio,
'fixed': self.scheduleFixedRadio
}