writer.py: fast_mode optional relative import.

pull/32/head
Peter Hinch 2020-11-06 09:17:15 +00:00
rodzic 1159205dcc
commit 4e998ad2bd
1 zmienionych plików z 14 dodań i 9 usunięć

Wyświetl plik

@ -19,16 +19,21 @@
# Slow method 2700μs typical, up to 11ms on larger fonts # Slow method 2700μs typical, up to 11ms on larger fonts
import framebuf import framebuf
fast_mode = False from uctypes import bytearray_at, addressof
fast_mode = True
try:
try: try:
from framebuf_utils import render from framebuf_utils import render
fast_mode = True except ImportError: # May be running in GUI. Try relative import.
try:
from .framebuf_utils import render
except ImportError: except ImportError:
pass fast_mode = False
except ValueError: except ValueError:
print('Ignoring framebuf_utils.mpy: it was compiled for an incorrect architecture.') fast_mode = False
print('Ignoring framebuf_utils.mpy: compiled for incorrect architecture.')
from uctypes import bytearray_at, addressof
class DisplayState(): class DisplayState():
def __init__(self): def __init__(self):