RASCSI/python/ctrlboard/src/ctrlboard_event_handler/ctrlboard_print_event_handler.py
nucleogenic 315ef9f248
Auto-format Python sources with black, fix all issues reported by flake8 (#1010)
* Update config for black and flake8
* Auto-format Python sources with black
* Fix issues reported by flake8
* Exclude protobuf files from black
* Address formatting feedback
2022-11-30 05:19:17 +00:00

17 lines
664 B
Python

"""Module for test printing events when buttons from the RaSCSI Control Board are pressed"""
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):
"""Class implements a basic event handler that prints button presses from the RaSCSI
Control Board hardware."""
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)