mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-14 02:26:58 -07:00
Add Windows system tray icon
This commit is contained in:
parent
aeccc2db71
commit
b1ec49341e
7 changed files with 291 additions and 8 deletions
|
@ -95,6 +95,7 @@ LATEST_RELEASE = None
|
|||
|
||||
UMASK = None
|
||||
|
||||
HTTP_PORT = None
|
||||
HTTP_ROOT = None
|
||||
|
||||
DEV = False
|
||||
|
@ -105,6 +106,8 @@ PLEX_SERVER_UP = None
|
|||
|
||||
TRACKER = None
|
||||
|
||||
WIN_SYS_TRAY_ICON = None
|
||||
|
||||
|
||||
def initialize(config_file):
|
||||
with INIT_LOCK:
|
||||
|
@ -378,6 +381,31 @@ def launch_browser(host, port, root):
|
|||
logger.error(u"Could not launch browser: %s" % e)
|
||||
|
||||
|
||||
def win_system_tray():
|
||||
try:
|
||||
from SysTrayIcon import SysTrayIcon
|
||||
except ImportError:
|
||||
logger.warn(u"Unable to start system tray icon: missing pywin32 module.")
|
||||
return
|
||||
|
||||
def tray_open(sysTrayIcon):
|
||||
launch_browser(CONFIG.HTTP_HOST, HTTP_PORT, HTTP_ROOT)
|
||||
|
||||
def tray_restart(sysTrayIcon):
|
||||
shutdown(restart=True)
|
||||
|
||||
icon = os.path.join(PROG_DIR, 'data/interfaces/', CONFIG.INTERFACE, 'images/logo.ico')
|
||||
hover_text = common.PRODUCT
|
||||
menu_options = (('Open Tautulli', None, tray_open),
|
||||
('Restart', None, tray_restart))
|
||||
|
||||
global WIN_SYS_TRAY_ICON
|
||||
try:
|
||||
WIN_SYS_TRAY_ICON = SysTrayIcon(icon, hover_text, menu_options, on_quit=shutdown)
|
||||
except Exception as e:
|
||||
logger.error(u"Unable to start system tray icon: %s." % e)
|
||||
|
||||
|
||||
def initialize_scheduler():
|
||||
"""
|
||||
Start the scheduled background tasks. Re-schedule if interval settings changed.
|
||||
|
|
|
@ -630,7 +630,8 @@ _CONFIG_DEFINITIONS = {
|
|||
'XBMC_ON_CONCURRENT': (int, 'XBMC', 0),
|
||||
'XBMC_ON_NEWDEVICE': (int, 'XBMC', 0),
|
||||
'JWT_SECRET': (str, 'Advanced', ''),
|
||||
'SYSTEM_ANALYTICS': (int, 'Advanced', 1)
|
||||
'SYSTEM_ANALYTICS': (int, 'Advanced', 1),
|
||||
'WIN_SYS_TRAY': (int, 'General', 1)
|
||||
}
|
||||
|
||||
_BLACKLIST_KEYS = ['_APITOKEN', '_TOKEN', '_KEY', '_SECRET', '_PASSWORD', '_APIKEY', '_ID', '_HOOK']
|
||||
|
|
|
@ -2855,7 +2855,8 @@ class WebInterface(object):
|
|||
"newsletter_auth": plexpy.CONFIG.NEWSLETTER_AUTH,
|
||||
"newsletter_password": plexpy.CONFIG.NEWSLETTER_PASSWORD,
|
||||
"newsletter_inline_styles": checked(plexpy.CONFIG.NEWSLETTER_INLINE_STYLES),
|
||||
"newsletter_custom_dir": plexpy.CONFIG.NEWSLETTER_CUSTOM_DIR
|
||||
"newsletter_custom_dir": plexpy.CONFIG.NEWSLETTER_CUSTOM_DIR,
|
||||
"win_sys_tray": checked(plexpy.CONFIG.WIN_SYS_TRAY)
|
||||
}
|
||||
|
||||
return serve_template(templatename="settings.html", title="Settings", config=config, kwargs=kwargs)
|
||||
|
@ -2877,7 +2878,7 @@ class WebInterface(object):
|
|||
"allow_guest_access", "cache_images", "http_proxy", "http_basic_auth", "notify_concurrent_by_ip",
|
||||
"history_table_activity", "plexpy_auto_update",
|
||||
"themoviedb_lookup", "tvmaze_lookup", "http_plex_admin",
|
||||
"newsletter_self_hosted", "newsletter_inline_styles"
|
||||
"newsletter_self_hosted", "newsletter_inline_styles", "win_sys_tray"
|
||||
]
|
||||
for checked_config in checked_configs:
|
||||
if checked_config not in kwargs:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue