From ee0819adef309e68ac1a9b645214e7fe92f4b9fd Mon Sep 17 00:00:00 2001 From: David Lechner Date: Thu, 9 Jan 2020 11:30:20 -0600 Subject: [PATCH] pybricks/builtins: remove deprecated Display class The Display class is from Pybricks MicroPython 1.0 and has been replaced by the Image class. --- pybricks/_instances.py | 5 +---- pybricks/builtins.py | 44 +----------------------------------------- pybricks/hubs.py | 3 +-- 3 files changed, 3 insertions(+), 49 deletions(-) diff --git a/pybricks/_instances.py b/pybricks/_instances.py index 11aad44..81d0d4c 100644 --- a/pybricks/_instances.py +++ b/pybricks/_instances.py @@ -1,7 +1,6 @@ """Sphinx workaround to document instance attributes such as self.light""" -from .builtins import (Motor, Speaker, Display, Battery, ColorLight, - KeyPad, LightArray) +from .builtins import Motor, Speaker, Battery, ColorLight, KeyPad, LightArray from .parameters import Direction, Stop from types import ModuleType @@ -26,8 +25,6 @@ battery = make_instance(Battery) speaker = make_instance(Speaker) -display = make_instance(Display) - class Motor(Motor): """Generic class to control motors with built-in rotation sensors.""" diff --git a/pybricks/builtins.py b/pybricks/builtins.py index 181f68d..f337076 100644 --- a/pybricks/builtins.py +++ b/pybricks/builtins.py @@ -1,7 +1,7 @@ """Generic cross-platform module for typical devices like lights, displays, speakers, and batteries.""" -from .parameters import Align, Direction, Stop, Axis +from .parameters import Direction, Stop, Axis class DCMotor(): @@ -323,48 +323,6 @@ class Motor(DCMotor): pass -class Display(): - """Show images or text on a display.""" - - def clear(self): - """Clear everything on the display.""" - pass - - def text(self, text, coordinate=None): - """Display text. - - Parameters: - text (str): The text to display. - coordinate (tuple): ``(x, y)`` coordinate tuple. It is the top-left - corner of the first character. If no coordinate - is specified, it is printed on the next line. - - """ - pass - - def image(self, file_name, - alignment=Align.CENTER, coordinate=None, clear=True): - """image(file_name, alignment=Align.CENTER, coordinate=None, clear=True) - - Show an image file. - - You can specify its placement either using ``alignment`` or by - specifying a ``coordinate``, but not both. - - Arguments: - file_name (str): Path to the image file. Paths may be absolute or - relative from the project folder. - alignment (Align): Where to place the image - (*Default*: Align.CENTER). - coordinate (tuple): ``(x, y)`` coordinate tuple. It is the top-left - corner of the image (*Default*: None). - clear (bool): Whether to clear the screen before showing the image - (*Default*: ``True``). - - """ - pass - - class Speaker(): """Play beeps and sounds using a speaker.""" diff --git a/pybricks/hubs.py b/pybricks/hubs.py index 7c608fa..0a8e198 100644 --- a/pybricks/hubs.py +++ b/pybricks/hubs.py @@ -1,6 +1,6 @@ """LEGO® Programmable Hubs.""" from enum import Enum -from .builtins import Speaker, Display, Battery, ColorLight, KeyPad +from .builtins import Speaker, Battery, ColorLight, KeyPad from .resources import Image @@ -9,7 +9,6 @@ class EV3Brick: Port = Enum('Port', ['A', 'B', 'C', 'D', 'S1', 'S2', 'S3', 'S4']) screen = Image('_screen_') speaker = Speaker() - display = Display() battery = Battery() light = ColorLight() buttons = KeyPad()