restarting the app when changing the style to avoid GUI bugs

This commit is contained in:
Vinicius Moreira
2019-09-12 12:12:25 -03:00
parent 2485d064e0
commit 40a8d19584
10 changed files with 79 additions and 33 deletions

View File

@@ -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()