2022-12-05 17:58:23 +00:00
|
|
|
"""Module for test printing events when buttons from the PiSCSI Control Board are pressed"""
|
2024-03-22 07:19:13 +00:00
|
|
|
|
2022-02-25 20:03:36 +00:00
|
|
|
import observer
|
|
|
|
from ctrlboard_hw.hardware_button import HardwareButton
|
|
|
|
from ctrlboard_hw.encoder import Encoder
|
|
|
|
|
|
|
|
|
|
|
|
# pylint: disable=too-few-public-methods
|
|
|
|
class CtrlBoardPrintEventHandler(observer.Observer):
|
2022-12-05 17:58:23 +00:00
|
|
|
"""Class implements a basic event handler that prints button presses from the PiSCSI
|
2022-02-25 20:03:36 +00:00
|
|
|
Control Board hardware."""
|
2022-11-30 05:19:17 +00:00
|
|
|
|
2022-02-25 20:03:36 +00:00
|
|
|
def update(self, updated_object):
|
|
|
|
if isinstance(updated_object, HardwareButton):
|
|
|
|
print(updated_object.name + " has been pressed!")
|
|
|
|
if isinstance(updated_object, Encoder):
|
|
|
|
print(updated_object.pos)
|