Smaller issues for v0.6.5 (#123)

* Clarify tray icon behavior in INSTALL.md. Fixes #111
* Rename default profile to just "Default". Fixes #116
* Remove Sentry bug reporting. Add link to Github instead. Fixes #117
* Log to terminal only when running in foreground.
This commit is contained in:
Manuel Riel 2019-01-15 23:20:24 +08:00 committed by GitHub
parent d2f618babf
commit 42191725b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 42 additions and 65 deletions

View File

@ -7,6 +7,9 @@ The generic way is to install it as Python package using [PIP](https://pip.readt
$ pip3 install vorta
```
### Desktop Tray Icon
Unless Vorta is started with the `--foreground` option, it will minimize to the system tray without opening a settings window. Be sure your desktop environment supports tray icons by e.g. installing this [Gnome extension](https://extensions.gnome.org/extension/615/appindicator-support/).
## Distribution Packages
If available, prefer distribution-specific packages, as they offer better integration. (If you added Vorta to a Linux distribution, open an issue or PR and it will be added here.)

View File

@ -7,8 +7,9 @@ url = https://github.com/borgbase/vorta
keywords =
backup
borgbackup
# List of classifiers: https://pypi.org/pypi?%3Aaction=list_classifiers
classifiers =
Development Status :: 3 - Alpha
Development Status :: 4 - Beta
Environment :: MacOS X
Environment :: X11 Applications :: Qt
Operating System :: MacOS
@ -37,7 +38,6 @@ install_requires =
python-dateutil
keyring
apscheduler
sentry-sdk
psutil
pyobjc-core; sys_platform == 'darwin'
pyobjc-framework-Cocoa; sys_platform == 'darwin'

View File

@ -2,13 +2,12 @@ import sys
import os
import peewee
from vorta.models import init_db, SettingsModel
from vorta.models import init_db
from vorta.application import VortaApp
from vorta.config import SETTINGS_DIR
from vorta.updater import get_updater
import vorta.sentry
import vorta.log
from vorta.utils import parse_args
from vorta.log import init_logger
def main():
@ -22,14 +21,12 @@ def main():
if os.fork():
sys.exit()
init_logger(foreground=want_foreground)
# Init database
sqlite_db = peewee.SqliteDatabase(os.path.join(SETTINGS_DIR, 'settings.db'))
init_db(sqlite_db)
# Send crashes to Sentry.
if SettingsModel.get(key='send_sentry_reports').value:
vorta.sentry.init()
app = VortaApp(sys.argv, single_app=True)
app.updater = get_updater()

View File

@ -66,6 +66,16 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;(&lt;a href=&quot;https://github.com/borgbase/vorta/issues/new/choose&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Report&lt;/span&gt;&lt;/a&gt; a Bug)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View File

@ -10,8 +10,8 @@ from PyQt5 import QtCore
from PyQt5.QtWidgets import QApplication
from subprocess import Popen, PIPE
from ..models import EventLogModel, BackupProfileMixin
from ..utils import keyring
from vorta.models import EventLogModel, BackupProfileMixin
from vorta.utils import keyring
mutex = QtCore.QMutex()
logger = logging.getLogger(__name__)
@ -174,8 +174,9 @@ class BorgThread(QtCore.QThread, BackupProfileMixin):
self.log_event(f'{parsed["path"]} ({parsed["status"]})')
except json.decoder.JSONDecodeError:
msg = line.strip()
self.log_event(msg)
logger.warning(msg)
if msg: # Log only if there is something to log.
self.log_event(msg)
logger.warning(msg)
if p.poll() is not None:
time.sleep(0.1)

View File

@ -10,23 +10,25 @@ import os
import logging
from .config import LOG_DIR
logger = logging.getLogger('vorta')
logger.setLevel(logging.DEBUG)
logger = logging.getLogger()
# create handlers
fh = logging.FileHandler(os.path.join(LOG_DIR, 'vorta.log'))
# fh.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.WARNING)
def init_logger(foreground=False):
logger.setLevel(logging.DEBUG)
logging.getLogger('peewee').setLevel(logging.INFO)
logging.getLogger('apscheduler').setLevel(logging.INFO)
# create logging format
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
# create logging format
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
# apply formatter
fh.setFormatter(formatter)
ch.setFormatter(formatter)
# create handlers
fh = logging.FileHandler(os.path.join(LOG_DIR, 'vorta.log'))
fh.setLevel(logging.DEBUG)
fh.setFormatter(formatter)
logger.addHandler(fh)
# add handlers
logger.addHandler(fh)
logger.addHandler(ch)
if foreground: # log to console, when running in foreground
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
ch.setFormatter(formatter)
logger.addHandler(ch)

View File

@ -191,7 +191,7 @@ def init_db(con):
ArchiveModel, WifiSettingModel, EventLogModel, SchemaVersion])
if BackupProfileModel.select().count() == 0:
default_profile = BackupProfileModel(name='Default Profile')
default_profile = BackupProfileModel(name='Default')
default_profile.save()
# Default settings for all platforms.
@ -202,12 +202,6 @@ def init_db(con):
'type': 'checkbox',
'label': 'Use light system tray icon (applies after restart, useful for dark themes).'
},
{
'key': 'send_sentry_reports',
'value': True,
'type': 'checkbox',
'label': 'Send errors to Sentry. This helps us quickly find bugs.'
},
{
'key': 'enable_notifications', 'value': True, 'type': 'checkbox',
'label': 'Display notifications when background tasks fail.'

View File

@ -1,30 +0,0 @@
import sentry_sdk
from vorta._version import __version__
def scrub_sensitive_data(event, hint):
"""Adapted from https://stackoverflow.com/questions/9807634/
find-all-occurrences-of-a-key-in-nested-python-dictionaries-and-lists/29652561"""
def gen_dict_extract(key, var):
if hasattr(var, 'items'):
for k, v in var.items():
if k == key:
var[k] = 'FILTERED'
yield v
if isinstance(v, dict):
for result in gen_dict_extract(key, v):
yield result
elif isinstance(v, list):
for d in v:
for result in gen_dict_extract(key, d):
yield result
list(gen_dict_extract('BORG_PASSPHRASE', event))
list(gen_dict_extract('password', event))
return event
def init():
sentry_sdk.init("https://a4a23df3e44743d5b5c5f06417a9a809@sentry.io/1311799",
release=__version__,
before_send=scrub_sensitive_data)