Skip to content

Commit 8cf7150

Browse files
committed
Changed uptime WITHDAYS to FORMATTED
1 parent 8af2e13 commit 8cf7150

File tree

3 files changed

+52
-15
lines changed

3 files changed

+52
-15
lines changed

library/stats.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ class SystemUptime:
759759
def stats():
760760
if HW_SENSORS == "STATIC":
761761
# For static sensors, use predefined uptime
762-
uptimesec = "4294036"
762+
uptimesec = 4294036
763763
else:
764764
uptimesec = int(uptime())
765765

@@ -768,18 +768,16 @@ def stats():
768768
systemuptime_theme_data = config.THEME_DATA['STATS']['UPTIME']
769769

770770
systemuptime_sec_theme_data = systemuptime_theme_data['SECONDS']['TEXT']
771-
if systemuptime_sec_theme_data and systemuptime_sec_theme_data['SHOW']:
772-
display_themed_value(
773-
theme_data=systemuptime_sec_theme_data,
774-
value=uptimesec
775-
)
776-
777-
systemuptime_withdays_theme_data = systemuptime_theme_data['WITHDAYS']['TEXT']
778-
if systemuptime_withdays_theme_data and systemuptime_withdays_theme_data['SHOW']:
779-
display_themed_value(
780-
theme_data=systemuptime_withdays_theme_data,
781-
value=uptimeformatted
782-
)
771+
display_themed_value(
772+
theme_data=systemuptime_sec_theme_data,
773+
value=uptimesec
774+
)
775+
776+
systemuptime_formatted_theme_data = systemuptime_theme_data['FORMATTED']['TEXT']
777+
display_themed_value(
778+
theme_data=systemuptime_formatted_theme_data,
779+
value=uptimeformatted
780+
)
783781

784782

785783
class Custom:

res/themes/default.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,11 @@ STATS:
210210
TEXT:
211211
SHOW: False
212212
UPTIME:
213-
INTERVAL: 100
213+
INTERVAL: 0
214214
SECONDS:
215215
TEXT:
216216
SHOW: False
217-
WITHDAYS:
217+
FORMATTED:
218218
TEXT:
219219
SHOW: False
220220
CUSTOM:

res/themes/theme_example.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,3 +1427,42 @@ STATS:
14271427
BACKGROUND_IMAGE: background.png
14281428
ALIGN: left # left / center / right
14291429
ANCHOR: lt # Check https://pillow.readthedocs.io/en/stable/handbook/text-anchors.html
1430+
UPTIME:
1431+
# For seconds display, it is recommended not to change the interval: keep to 1
1432+
INTERVAL: 1
1433+
SECONDS: # Uptime as seconds
1434+
TEXT:
1435+
SHOW: FALSE
1436+
X: 192
1437+
Y: 261
1438+
# Text sensors may vary in size and create "ghosting" effects where old value stay displayed under the new one.
1439+
# To avoid this use one of these 2 methods (or both):
1440+
# - either use a monospaced font (fonts with "mono" in name, see res/fonts/ for available fonts)
1441+
# - or force a static width/height for the text field. Be sure to have enough space for the longest value that can be displayed (e.g. "100%" for a percentage)
1442+
# WIDTH: 200 # Uncomment to force a static width
1443+
# HEIGHT: 50 # Uncomment to force static height
1444+
FONT: jetbrains-mono/JetBrainsMono-Bold.ttf
1445+
FONT_SIZE: 23
1446+
FONT_COLOR: 255, 255, 255
1447+
# BACKGROUND_COLOR: 132, 154, 165
1448+
BACKGROUND_IMAGE: background.png
1449+
ALIGN: left # left / center / right
1450+
ANCHOR: lt # Check https://pillow.readthedocs.io/en/stable/handbook/text-anchors.html
1451+
FORMATTED: # Uptime as formatted string with days e.g. "49 days, 16:47:16"
1452+
TEXT:
1453+
SHOW: FALSE
1454+
X: 192
1455+
Y: 261
1456+
# Text sensors may vary in size and create "ghosting" effects where old value stay displayed under the new one.
1457+
# To avoid this use one of these 2 methods (or both):
1458+
# - either use a monospaced font (fonts with "mono" in name, see res/fonts/ for available fonts)
1459+
# - or force a static width/height for the text field. Be sure to have enough space for the longest value that can be displayed (e.g. "100%" for a percentage)
1460+
# WIDTH: 200 # Uncomment to force a static width
1461+
# HEIGHT: 50 # Uncomment to force static height
1462+
FONT: jetbrains-mono/JetBrainsMono-Bold.ttf
1463+
FONT_SIZE: 23
1464+
FONT_COLOR: 255, 255, 255
1465+
# BACKGROUND_COLOR: 132, 154, 165
1466+
BACKGROUND_IMAGE: background.png
1467+
ALIGN: left # left / center / right
1468+
ANCHOR: lt # Check https://pillow.readthedocs.io/en/stable/handbook/text-anchors.html

0 commit comments

Comments
 (0)