Add Screencast

This commit is contained in:
Manu 2018-10-27 19:21:14 +08:00
parent 1d0a6b5f45
commit fecc6f752a
5 changed files with 28 additions and 36 deletions

View File

@ -1,5 +1,7 @@
# Vorta - BorgBackup GUI
[[ https://files.qmax.us/vorta-screencast.gif | width = 100% ]]
[Vorta](http://memory-alpha.wikia.com/wiki/Vorta) is a GUI for [BorgBackup](https://borgbackup.readthedocs.io). It's in alpha status and currently has the following features:
- Select and manage SSH keys

View File

@ -10,9 +10,24 @@
<height>600</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>800</width>
<height>600</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>800</width>
<height>600</height>
</size>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<property name="windowOpacity">
<double>1.000000000000000</double>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QWidget" name="verticalLayoutWidget_2">
<property name="geometry">
@ -496,6 +511,9 @@
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>

View File

@ -33,9 +33,11 @@ class BorgThread(QtCore.QThread):
def run(self):
with Popen(self.cmd, stdout=PIPE, stderr=PIPE, bufsize=1, universal_newlines=True, env=self.env) as p:
for line in p.stderr:
print(line)
parsed = json.loads(line)
self.updated.emit(f'{parsed["levelname"]}: {parsed["message"]}')
if parsed['type'] == 'log_message':
self.updated.emit(f'{parsed["levelname"]}: {parsed["message"]}')
elif parsed['type'] == 'file_status':
self.updated.emit(f'{parsed["path"]} ({parsed["status"]})')
p.wait()
stdout = p.stdout.read()

View File

@ -49,9 +49,8 @@ class MainWindow(MainWindowBase, MainWindowUI):
self.createStartBtn.setEnabled(False)
self.createStartBtn.repaint()
repo_id = self.repoSelector.currentData()
repo = RepoModel.get(id=repo_id)
cmd = ['borg', 'create', '--log-json', '--json', '-C', self.profile.compression,
repo = self.profile.repo
cmd = ['borg', 'create', '--list', '--info', '--log-json', '--json', '-C', self.profile.compression,
f'{repo.url}::{platform.node()}-{dt.now().isoformat()}'
]
for i in range(n_backup_folders):
@ -69,12 +68,12 @@ class MainWindow(MainWindowBase, MainWindowUI):
self.createStartBtn.setEnabled(True)
self.createStartBtn.repaint()
if result['returncode'] == 0:
self.set_status('Finished backup.', 100)
self.set_status(progress_max=100)
new_snapshot = SnapshotModel(
snapshot_id=result['data']['archive']['id'],
name=result['data']['archive']['name'],
time=parser.parse(result['data']['archive']['start']),
repo=self.repoSelector.currentData()
repo=self.profile.repo
)
new_snapshot.save()
if 'cache' in result['data']:

View File

@ -1,29 +0,0 @@
import os
from PyQt5 import uic
from .borg_runner import BorgThread
uifile = os.path.join(os.path.dirname(__file__), 'UI/initrepo.ui')
InitRepoUI, InitRepoBase = uic.loadUiType(uifile)
class InitRepoWindow(InitRepoBase, InitRepoUI):
def __init__(self, cmd, env):
super().__init__()
self.setupUi(self)
self.closeButton.clicked.connect(self.close)
self.logText.appendPlainText('Connecting to repo...')
self._thread = BorgThread(self, cmd, env)
self._thread.updated.connect(self.update_log)
self._thread.result.connect(self.get_result)
def update_log(self, text):
self.logText.appendPlainText(text)
def get_result(self, result):
if result['returncode'] == 0:
self.logText.appendPlainText('Finished successfully.')
self.closeButton.setEnabled(True)
else:
self.logText.appendPlainText('Finished with errors.')
self.closeButton.setEnabled(True)