Module Display :: Class Display
[hide private]
[frames] | no frames]

Class Display

source code

Abstraction of the 4 digit 7-segment display attached to the I2C port. If no display is found, all methods return immediately.

Instance Methods [hide private]
 
__init__(self)
Creates a display instance either from class Display4tronix or DisplayDidel.
source code
 
clear(self)
Turns all digits off.
source code
 
showText(self, text, pos=0, dp=[0,0,0,0])
Displays 4 characters of the given text.
source code
 
scrollToLeft(self)
Scrolls the scrollable text one step to the left.
source code
 
scrollToRight(self)
Scrolls the scrollable text one step to the left.
source code
 
setToStart(self)
Shows the scrollable text at the start position.
source code
 
showTicker(self, text, count=1, speed=2, blocking=False)
Shows a ticker text that scroll to left until the last 4 characters are displayed.
source code
 
stopTicker(self)
Stops a running ticker.
source code
 
isTickerAlive(self)
Returns: True, if the ticker is displaying; otherwise False
source code
 
showBlinker(self, text, dp=[0,0,0,0], count=3, speed=1, blocking=False)
Shows a blinking text for the given number of times and blinking speed.
source code
 
stopBlinker(self)
Stops a running blinker.
source code
 
isBlinkerAlive(self)
Returns: True, if the blinker is displaying; otherwise False
source code
 
showVersion(self)
Displays current version.
source code
 
isAvailable(self)
Returns: True, if the display is detetectd on the I2C interface; otherwise False
source code
 
_checkRobot(self) source code
Class Variables [hide private]
  _myInstance = None
Method Details [hide private]

__init__(self)
(Constructor)

source code 

Creates a display instance either from class Display4tronix or DisplayDidel. Because the 4tronix display is multiplexed (one digit shown after the other, a display thread is used to display all 4 digits in a rapid succession.

clear(self)

source code 

Turns all digits off. Stops a running display thread.

showText(self, text, pos=0, dp=[0,0,0,0])

source code 

Displays 4 characters of the given text. The text is considered to be prefixed and postfixed by spaces and the 4 character window is selected by the text pointer pos that determines the character displayed at the leftmost digit, e.g. (_: empty): showText("AbCdEF") -> AbCd showText("AbCdEF", 1) -> bCdE showText("AbCdEF", -1) ->_AbC showText("AbCdEF", 4) -> EF__ Because the 4tronix display is multiplexed (one digit shown after the other), a display thread is started now to display all 4 digits in a rapid succession (if it is not yet started). The parameters are saved and compared to the values at the next invocation. If all are identical, the function returns immediately.

Parameters:
  • text - the text to display (list, tuple, string or integer)
  • pos - the start value of the text pointer (character index positioned a leftmost digit)
  • dp - a list with one to four 1 or 0, if the decimal point is shown or not. The decimal point selection depends on the attached display type. For the 4tronix display: the first element in list corresponds to right dp, second element to center floor dp, the third element to center ceil dp. For the DgTell: the first element in list corresponds to dp at second digit from the right, the second element to dp at third digit from the right, the third element to dp at leftmost digit, the forth element to the dp at rightmost digit. More than 4 elements are ignored
Returns:
True, if successful; False, if the display is not available, text or dp has illegal type or one of the characters can't be displayed

scrollToLeft(self)

source code 

Scrolls the scrollable text one step to the left.

Returns:
the number of characters remaining at the right

scrollToRight(self)

source code 

Scrolls the scrollable text one step to the left.

Returns:
the number of characters remaining at the left

setToStart(self)

source code 

Shows the scrollable text at the start position.

Returns:
0, if successful; -1, if error

showTicker(self, text, count=1, speed=2, blocking=False)

source code 

Shows a ticker text that scroll to left until the last 4 characters are displayed.

Parameters:
  • text - the text to display, if short than 4 characters, scrolling is disabled
  • count - the number of repetitions (default: 1). For count = 0, infinite duration, may be stopped by calling stopTicker().
  • speed - the speed number of scrolling operations per sec (default: 2)
  • blocking - if True, the method blocks until the ticker has finished; otherwise it returns immediately (default: False)

stopTicker(self)

source code 

Stops a running ticker. The method blocks until the ticker thread is finished and isTickerAlive() returns False.

isTickerAlive(self)

source code 
Returns:
True, if the ticker is displaying; otherwise False

showBlinker(self, text, dp=[0,0,0,0], count=3, speed=1, blocking=False)

source code 

Shows a blinking text for the given number of times and blinking speed.

Parameters:
  • text - the text to display, if short than 4 characters, scrolling is disabled
  • count - the number of repetitions (default: 3). For count = 0, infinite duration, may be stopped by calling stopBlinker().
  • speed - the speed number of blinking operations per sec (default: 1)
  • blocking - if True, the method blocks until the blinker has finished; otherwise it returns immediately (default: False)

stopBlinker(self)

source code 

Stops a running blinker. The method blocks until the blinker thread is finished and isBlinkerAlive() returns False.

isBlinkerAlive(self)

source code 
Returns:
True, if the blinker is displaying; otherwise False

showVersion(self)

source code 

Displays current version. Format X (three horz bars) + n.nn

isAvailable(self)

source code 
Returns:
True, if the display is detetectd on the I2C interface; otherwise False