mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-09 05:14:16 +02:00
restarting the app when changing the style to avoid GUI bugs
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
import glob
|
||||
import locale
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from PyQt5.QtCore import QCoreApplication
|
||||
|
||||
from bauh import __app_name__
|
||||
from bauh.util import resource
|
||||
@@ -42,3 +46,18 @@ def get_locale_keys(key: str = None, locale_dir: str = resource.get_path('locale
|
||||
|
||||
def notify_user(msg: str, icon_path: str = resource.get_path('img/logo.svg')):
|
||||
os.system("notify-send -a {} {} '{}'".format(__app_name__, "-i {}".format(icon_path) if icon_path else '', msg))
|
||||
|
||||
|
||||
def restart_app(show_panel: bool):
|
||||
"""
|
||||
:param show_panel: if the panel should be displayed after the app restart
|
||||
:return:
|
||||
"""
|
||||
restart_cmd = [sys.executable, *sys.argv]
|
||||
|
||||
if show_panel:
|
||||
restart_cmd.append('--show-panel')
|
||||
|
||||
subprocess.Popen(restart_cmd)
|
||||
QCoreApplication.exit()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user