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 $ 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 ## 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.) 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 = keywords =
backup backup
borgbackup borgbackup
# List of classifiers: https://pypi.org/pypi?%3Aaction=list_classifiers
classifiers = classifiers =
Development Status :: 3 - Alpha Development Status :: 4 - Beta
Environment :: MacOS X Environment :: MacOS X
Environment :: X11 Applications :: Qt Environment :: X11 Applications :: Qt
Operating System :: MacOS Operating System :: MacOS
@ -37,7 +38,6 @@ install_requires =
python-dateutil python-dateutil
keyring keyring
apscheduler apscheduler
sentry-sdk
psutil psutil
pyobjc-core; sys_platform == 'darwin' pyobjc-core; sys_platform == 'darwin'
pyobjc-framework-Cocoa; sys_platform == 'darwin' pyobjc-framework-Cocoa; sys_platform == 'darwin'

View File

@ -2,13 +2,12 @@ import sys
import os import os
import peewee import peewee
from vorta.models import init_db, SettingsModel from vorta.models import init_db
from vorta.application import VortaApp from vorta.application import VortaApp
from vorta.config import SETTINGS_DIR from vorta.config import SETTINGS_DIR
from vorta.updater import get_updater from vorta.updater import get_updater
import vorta.sentry
import vorta.log
from vorta.utils import parse_args from vorta.utils import parse_args
from vorta.log import init_logger
def main(): def main():
@ -22,14 +21,12 @@ def main():
if os.fork(): if os.fork():
sys.exit() sys.exit()
init_logger(foreground=want_foreground)
# Init database # Init database
sqlite_db = peewee.SqliteDatabase(os.path.join(SETTINGS_DIR, 'settings.db')) sqlite_db = peewee.SqliteDatabase(os.path.join(SETTINGS_DIR, 'settings.db'))
init_db(sqlite_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 = VortaApp(sys.argv, single_app=True)
app.updater = get_updater() app.updater = get_updater()

View File

@ -66,6 +66,16 @@
</property> </property>
</widget> </widget>
</item> </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> </layout>
</item> </item>
</layout> </layout>

View File

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

View File

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

View File

@ -191,7 +191,7 @@ def init_db(con):
ArchiveModel, WifiSettingModel, EventLogModel, SchemaVersion]) ArchiveModel, WifiSettingModel, EventLogModel, SchemaVersion])
if BackupProfileModel.select().count() == 0: if BackupProfileModel.select().count() == 0:
default_profile = BackupProfileModel(name='Default Profile') default_profile = BackupProfileModel(name='Default')
default_profile.save() default_profile.save()
# Default settings for all platforms. # Default settings for all platforms.
@ -202,12 +202,6 @@ def init_db(con):
'type': 'checkbox', 'type': 'checkbox',
'label': 'Use light system tray icon (applies after restart, useful for dark themes).' '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', 'key': 'enable_notifications', 'value': True, 'type': 'checkbox',
'label': 'Display notifications when background tasks fail.' '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)