mirror of https://github.com/borgbase/vorta
Allow is_system_tray_available to be called with running event loop
Extend Flatpak permissions
This commit is contained in:
parent
d6347b6caf
commit
9e0968e66f
|
@ -26,6 +26,7 @@ finish-args:
|
|||
- --talk-name=org.kde.StatusNotifierWatcher
|
||||
- --own-name=org.kde.StatusNotifierItem-2-1
|
||||
- --own-name=org.kde.StatusNotifierItem-4-1
|
||||
- --own-name=org.kde.StatusNotifierItem-4-3
|
||||
# Mounting
|
||||
- --talk-name=org.freedesktop.DBus.*
|
||||
- --talk-name=org.freedesktop.Flatpak.*
|
||||
|
|
|
@ -11,10 +11,9 @@ from datetime import datetime, timedelta
|
|||
|
||||
import peewee as pw
|
||||
from playhouse.migrate import SqliteMigrator, migrate
|
||||
from PyQt5.QtWidgets import QApplication, QSystemTrayIcon
|
||||
|
||||
from vorta.i18n import trans_late
|
||||
from vorta.utils import slugify, uses_dark_mode
|
||||
from vorta.utils import is_system_tray_available, slugify, uses_dark_mode
|
||||
|
||||
SCHEMA_VERSION = 13
|
||||
|
||||
|
@ -220,6 +219,11 @@ def get_misc_settings():
|
|||
'label': trans_late('settings',
|
||||
'Automatically start Vorta at login')
|
||||
},
|
||||
{
|
||||
'key': 'foreground', 'value': False, 'type': 'checkbox',
|
||||
'label': trans_late('settings',
|
||||
'Run Vorta in the foreground when started manually')
|
||||
},
|
||||
]
|
||||
if sys.platform == 'darwin':
|
||||
settings += [
|
||||
|
@ -234,15 +238,6 @@ def get_misc_settings():
|
|||
'Include pre-release versions when checking for updates')
|
||||
},
|
||||
]
|
||||
if sys.platform.startswith('linux'):
|
||||
settings += [
|
||||
{
|
||||
'key': 'foreground', 'value': False, 'type': 'checkbox',
|
||||
'label': trans_late('settings',
|
||||
'Run Vorta in the foreground when started manually')
|
||||
},
|
||||
]
|
||||
|
||||
return settings
|
||||
|
||||
|
||||
|
@ -365,12 +360,3 @@ def init_db(con):
|
|||
ArchiveModel.insert_many(data[i:i + size], fields=fields).execute()
|
||||
|
||||
_apply_schema_update(current_schema, 13)
|
||||
|
||||
|
||||
def is_system_tray_available():
|
||||
''' Can only be called when the event loop isn't running yet '''
|
||||
app = QApplication([])
|
||||
tray = QSystemTrayIcon()
|
||||
is_available = tray.isSystemTrayAvailable()
|
||||
app.quit()
|
||||
return is_available
|
||||
|
|
|
@ -1,30 +1,31 @@
|
|||
import os
|
||||
import argparse
|
||||
import errno
|
||||
import sys
|
||||
import getpass
|
||||
import operator
|
||||
import os
|
||||
import platform
|
||||
import plistlib
|
||||
import argparse
|
||||
import unicodedata
|
||||
import re
|
||||
from datetime import datetime as dt
|
||||
import getpass
|
||||
import subprocess
|
||||
from collections import defaultdict
|
||||
from functools import reduce
|
||||
import operator
|
||||
import psutil
|
||||
import sys
|
||||
import unicodedata
|
||||
import xml
|
||||
from collections import defaultdict
|
||||
from datetime import datetime as dt
|
||||
from functools import reduce
|
||||
|
||||
from paramiko.rsakey import RSAKey
|
||||
import psutil
|
||||
from paramiko import SSHException
|
||||
from paramiko.ecdsakey import ECDSAKey
|
||||
from paramiko.ed25519key import Ed25519Key
|
||||
from paramiko import SSHException
|
||||
from PyQt5.QtWidgets import QFileDialog
|
||||
from PyQt5.QtGui import QIcon
|
||||
from paramiko.rsakey import RSAKey
|
||||
from PyQt5 import QtCore
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQt5.QtWidgets import QApplication, QFileDialog, QSystemTrayIcon
|
||||
|
||||
from vorta.borg._compatibility import BorgCompatibility
|
||||
from vorta.keyring.abc import VortaKeyring
|
||||
from vorta.log import logger
|
||||
from vorta.borg._compatibility import BorgCompatibility
|
||||
|
||||
keyring = VortaKeyring.get_keyring()
|
||||
logger.info('Using %s Keyring implementation.', keyring.__class__.__name__)
|
||||
|
@ -264,3 +265,17 @@ def get_mount_points(repo_url):
|
|||
continue
|
||||
|
||||
return mount_points
|
||||
|
||||
|
||||
def is_system_tray_available():
|
||||
app = QApplication.instance()
|
||||
if app is None:
|
||||
app = QApplication([])
|
||||
tray = QSystemTrayIcon()
|
||||
is_available = tray.isSystemTrayAvailable()
|
||||
app.quit()
|
||||
else:
|
||||
tray = QSystemTrayIcon()
|
||||
is_available = tray.isSystemTrayAvailable()
|
||||
|
||||
return is_available
|
||||
|
|
Loading…
Reference in New Issue