pybricks/builtins: remove deprecated Display class

The Display class is from Pybricks MicroPython 1.0 and has been
replaced by the Image class.
This commit is contained in:
David Lechner
2020-01-13 12:59:07 -06:00
parent b4cd9113b5
commit ee0819adef
3 changed files with 3 additions and 49 deletions
+1 -4
View File
@@ -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."""
+1 -43
View File
@@ -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."""
+1 -2
View File
@@ -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()