Skip to content

Commit 8447bad

Browse files
authored
Merge pull request #31 from gerph/safer-stats-on-macos
Safer stats on macos / Fix for theme values
2 parents dee8833 + 0886a3c commit 8447bad

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

library/stats.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
import GPUtil
44
import psutil
5-
6-
if os.name == 'posix':
5+
try:
76
import pyamdgpuinfo
7+
except ImportError:
8+
pyamdgpuinfo = None
89

910
import library.config as config
1011
from library.display import display
@@ -133,11 +134,14 @@ def load():
133134

134135
@staticmethod
135136
def is_temperature_available():
136-
if os.name == 'posix':
137+
try:
137138
if 'coretemp' in psutil.sensors_temperatures() or 'k10temp' in psutil.sensors_temperatures():
138139
return True
139-
140-
return False
140+
else:
141+
return False
142+
except AttributeError:
143+
# sensors_temperatures may not be available at all
144+
return False
141145

142146
@staticmethod
143147
def temperature():
@@ -299,7 +303,9 @@ def stats():
299303

300304
@staticmethod
301305
def is_available():
302-
return os.name == 'posix' and pyamdgpuinfo.detect_gpus() > 0
306+
if not pyamdgpuinfo:
307+
return False
308+
return pyamdgpuinfo.detect_gpus() > 0
303309

304310

305311
class Memory:

res/themes/3.5inchTheme2_theme/theme.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ display:
44
DISPLAY_ORIENTATION: portrait
55

66
# Backplate RGB LED color (for HW revision 'flagship' devices only)
7-
DISPLAY_RGB_LED: 0, 0, 255
7+
DISPLAY_RGB_LED: [0, 0, 255]
88

99
static_images:
1010
# Specify what static images we want to show on the display
@@ -298,4 +298,4 @@ STATS:
298298
FONT_SIZE: 23
299299
FONT_COLOR: 255, 255, 255
300300
BACKGROUND_COLOR: 132, 154, 165
301-
# BACKGROUND_IMAGE: background.png
301+
# BACKGROUND_IMAGE: background.png

0 commit comments

Comments
 (0)