exit(1) on psutil missing
This commit is contained in:
@@ -19,7 +19,6 @@ app_dirs = []
|
||||
|
||||
dependencies = {
|
||||
"pyalsa": False,
|
||||
"psutil": False,
|
||||
"netifaces": False,
|
||||
"amixer": False
|
||||
}
|
||||
|
@@ -20,6 +20,12 @@ except ValueError:
|
||||
|
||||
from gi.repository import GtkLayerShell, GLib
|
||||
|
||||
try:
|
||||
import psutil
|
||||
except ModuleNotFoundError:
|
||||
print("You need to install python-psutil package")
|
||||
sys.exit(1)
|
||||
|
||||
from nwg_panel.tools import *
|
||||
|
||||
from nwg_panel.modules.custom_button import CustomButton
|
||||
@@ -27,7 +33,6 @@ from nwg_panel.modules.executor import Executor
|
||||
from nwg_panel.modules.clock import Clock
|
||||
from nwg_panel.modules.controls import Controls
|
||||
from nwg_panel.modules.playerctl import Playerctl
|
||||
if nwg_panel.common.dependencies["psutil"]:
|
||||
from nwg_panel.modules.cpu_avg import CpuAvg
|
||||
from nwg_panel.modules.scratchpad import Scratchpad
|
||||
|
||||
@@ -154,7 +159,7 @@ def instantiate_content(panel, container, content_list, icons_path=""):
|
||||
else:
|
||||
print("'{}' not defined in this panel instance".format(item))
|
||||
|
||||
if item == "cpu-avg" and nwg_panel.common.dependencies["psutil"]:
|
||||
if item == "cpu-avg":
|
||||
cpu_avg = CpuAvg()
|
||||
container.pack_start(cpu_avg, False, False, panel["items-padding"])
|
||||
|
||||
@@ -194,12 +199,6 @@ def main():
|
||||
except:
|
||||
print("pylsa module not found, will try amixer")
|
||||
|
||||
try:
|
||||
import psutil
|
||||
common.dependencies["psutil"] = True
|
||||
except:
|
||||
pass
|
||||
|
||||
global restart_cmd
|
||||
restart_cmd = "nwg-panel -c {} -s {}".format(args.config, args.style)
|
||||
|
||||
|
Reference in New Issue
Block a user