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