Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions library/lcd/lcd_comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import copy
import math
import os
import platform
import queue
import sys
import threading
Expand Down Expand Up @@ -139,6 +140,10 @@ def SendLine(self, line: bytes):
def WriteLine(self, line: bytes):
try:
self.serial_write(line)
if platform.system() == "Darwin":
# macOS needs the serial buffer to be flushed regularly to avoid bitmap corruption on the display
# See https://github.com/mathoudebine/turing-smart-screen-python/issues/7
self.lcd_serial.flush()
except serial.SerialTimeoutException:
# We timed-out trying to write to our device, slow things down.
logger.warning("(Write line) Too fast! Slow down!")
Expand Down
22 changes: 14 additions & 8 deletions library/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ def display_themed_radial_bar(theme_data, value, min_size=0, unit='', custom_tex
background_image=get_theme_file_path(theme_data.get("BACKGROUND_IMAGE", None)),
custom_bbox=theme_data.get("CUSTOM_BBOX", (0, 0, 0, 0)),
text_offset=theme_data.get("TEXT_OFFSET", (0, 0)),
bar_background_color = theme_data.get("BAR_BACKGROUND_COLOR", (0, 0, 0)),
draw_bar_background = theme_data.get("DRAW_BAR_BACKGROUND", False),
bar_decoration = theme_data.get("BAR_DECORATION", "")
bar_background_color=theme_data.get("BAR_BACKGROUND_COLOR", (0, 0, 0)),
draw_bar_background=theme_data.get("DRAW_BAR_BACKGROUND", False),
bar_decoration=theme_data.get("BAR_DECORATION", "")
)


Expand Down Expand Up @@ -742,11 +742,17 @@ def stats():
else:
date_now = datetime.datetime.now()

if platform.system() == "Windows":
# Windows does not have LC_TIME environment variable, use deprecated getdefaultlocale() that returns language code following RFC 1766
lc_time = locale.getdefaultlocale()[0]
else:
lc_time = babel.dates.LC_TIME
try:
if platform.system() == "Windows":
# Windows does not have LC_TIME environment variable, use deprecated getdefaultlocale() that returns language code following RFC 1766
lc_time = locale.getdefaultlocale()[0]
else:
lc_time = babel.dates.LC_TIME
except:
lc_time = None

if not lc_time:
lc_time = "en_US"

date_theme_data = config.THEME_DATA['STATS']['DATE']
day_theme_data = date_theme_data['DAY']['TEXT']
Expand Down