Add showing only a single charset page
This commit is contained in:
parent
5ad8f82427
commit
cfa221a38d
2 changed files with 22 additions and 12 deletions
|
@ -17,33 +17,43 @@ class BubaAnimation:
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<{type(self).__name__}>"
|
return f"<{type(self).__name__}>"
|
||||||
|
|
||||||
|
|
||||||
class BubaTime(BubaAnimation):
|
class BubaTime(BubaAnimation):
|
||||||
def __init__(self, buba: BubaCmd):
|
def __init__(self, buba: BubaCmd):
|
||||||
super().__init__(buba)
|
super().__init__(buba)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.buba.simple_text(page=0, row=0, col=0, text="Buba")
|
self.buba.simple_text(page=0, row=0, col=0, text="Buba")
|
||||||
self.buba.simple_text(page=0, row=1, col=0, text="CCC Hansestadt Hamburg")
|
self.buba.simple_text(page=0, row=1, col=0, text="Choas Computer Club")
|
||||||
self.buba.simple_text(page=0, row=2, col=0, text="")
|
self.buba.simple_text(page=0, row=2, col=0, text="Hansestadt Hamburg")
|
||||||
self.buba.simple_text(page=0, row=3, col=0, text="Hello, world!")
|
self.buba.simple_text(page=0, row=3, col=0, text="Hello, world!")
|
||||||
self.buba.set_page(0)
|
self.buba.set_page(0)
|
||||||
|
|
||||||
for i in range(15):
|
for i in range(5):
|
||||||
self.buba.simple_text(page=0, row=0, col=93, text=datetime.now().strftime("%H:%M:%S"))
|
self.buba.simple_text(page=0, row=0, col=93, text=datetime.now().strftime("%H:%M:%S"))
|
||||||
sleep(1)
|
sleep(1)
|
||||||
|
|
||||||
|
|
||||||
class BubaCharset(BubaAnimation):
|
class BubaCharset(BubaAnimation):
|
||||||
def __init__(self, buba: BubaCmd):
|
def __init__(self, buba: BubaCmd, single=None):
|
||||||
super().__init__(buba)
|
super().__init__(buba)
|
||||||
|
self.charset = bytes(range(256)).decode("CP437")
|
||||||
|
self.single = single
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.buba.simple_text(page=0, row=0, col=0, text=" !\"#$%&'()*+,-./0123456789:;<=>?")
|
if self.single is not None:
|
||||||
self.buba.simple_text(page=0, row=1, col=0, text="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_")
|
while True:
|
||||||
self.buba.simple_text(page=0, row=2, col=0, text="`abcdefghijklmnopqrstuvwxyz{|}~") # ignore until we fix the mapping \u2302
|
self.render(self.single)
|
||||||
self.buba.simple_text(page=0, row=3, col=0, text="That's all, folks!")
|
sleep(1)
|
||||||
sleep(10)
|
else:
|
||||||
|
for page in range(16):
|
||||||
|
self.render(page)
|
||||||
|
sleep(5)
|
||||||
|
|
||||||
|
def render(self, page):
|
||||||
|
for row in range(4):
|
||||||
|
start = ((page + row) * 16) % 256
|
||||||
|
self.buba.simple_text(page=0, row=row, col=0, text=f"${start:02x}: {self.charset[start:start + 16]}")
|
||||||
|
|
||||||
class BubaAnimator:
|
class BubaAnimator:
|
||||||
def __init__(self, buba: BubaCmd):
|
def __init__(self, buba: BubaCmd):
|
||||||
|
@ -62,5 +72,5 @@ class BubaAnimator:
|
||||||
self.log.debug(f"Starting animation: {a}")
|
self.log.debug(f"Starting animation: {a}")
|
||||||
a.run()
|
a.run()
|
||||||
|
|
||||||
def add(self, animation):
|
def add(self, animation, *args, **kwargs):
|
||||||
self.animations.append(animation(self.buba))
|
self.animations.append(animation(self.buba, *args, **kwargs))
|
||||||
|
|
|
@ -25,7 +25,7 @@ TEMPLATE_PATH.insert(0, config.templatepath)
|
||||||
websocket_clients = WebSocketClients()
|
websocket_clients = WebSocketClients()
|
||||||
buba = BubaCmd(config.serial, websocket_clients.send)
|
buba = BubaCmd(config.serial, websocket_clients.send)
|
||||||
animator = BubaAnimator(buba)
|
animator = BubaAnimator(buba)
|
||||||
animator.add(BubaCharset)
|
animator.add(BubaCharset) #, single=12)
|
||||||
animator.add(BubaTime)
|
animator.add(BubaTime)
|
||||||
# bottle_helpers = BottleHelpers(auth, group=config.requires_group, allowed=config.allowed)
|
# bottle_helpers = BottleHelpers(auth, group=config.requires_group, allowed=config.allowed)
|
||||||
# update_poller = UpdatePoller(websocket_clients, ccujack, 1 if config.debug else 0.1)
|
# update_poller = UpdatePoller(websocket_clients, ccujack, 1 if config.debug else 0.1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue