@@ -325,29 +325,16 @@ def _scroll_marquee(self, text: str, delay: float) -> None:
325325 self .show ()
326326
327327
328- class Seg7x4 (Seg14x4 ):
329- """Numeric 7-segment display. It has the same methods as the alphanumeric display, but only
330- supports displaying a limited set of characters.
331-
332- :param I2C i2c: The I2C bus object
333- :param int address: The I2C address for the display
334- :param bool auto_write: True if the display should immediately change when set. If False,
335- `show` must be called explicitly.
336- """
337-
328+ class _AbstractSeg7x4 (Seg14x4 ):
338329 POSITIONS = (0 , 2 , 6 , 8 ) # The positions of characters.
339330
340331 def __init__ (
341332 self ,
342333 i2c : I2C ,
343334 address : int = 0x70 ,
344- auto_write : bool = True ,
345- char_dict : Optional [Dict [str , int ]] = None ,
335+ auto_write : bool = True
346336 ) -> None :
347337 super ().__init__ (i2c , address , auto_write )
348- # Use colon for controling two-dots indicator at the center (index 0)
349- self ._colon = Colon (self )
350- self ._chardict = char_dict
351338
352339 def scroll (self , count : int = 1 ) -> None :
353340 """Scroll the display by specified number of places.
@@ -430,6 +417,27 @@ def set_digit_raw(self, index: int, bitmask: int) -> None:
430417 if self ._auto_write :
431418 self .show ()
432419
420+ class Seg7x4 (_AbstractSeg7x4 ):
421+ """Numeric 7-segment display. It has the same methods as the alphanumeric display, but only
422+ supports displaying a limited set of characters.
423+
424+ :param I2C i2c: The I2C bus object
425+ :param int address: The I2C address for the display
426+ :param bool auto_write: True if the display should immediately change when set. If False,
427+ `show` must be called explicitly.
428+ """
429+ def __init__ (
430+ self ,
431+ i2c : I2C ,
432+ address : int = 0x70 ,
433+ auto_write : bool = True ,
434+ char_dict : Optional [Dict [str , int ]] = None ,
435+ ) -> None :
436+ super ().__init__ (i2c , address , auto_write )
437+ # Use colon for controling two-dots indicator at the center (index 0)
438+ self ._colon = Colon (self )
439+ self ._chardict = char_dict
440+
433441 @property
434442 def colon (self ) -> bool :
435443 """Simplified colon accessor"""
@@ -440,7 +448,7 @@ def colon(self, turn_on: bool) -> None:
440448 self ._colon [0 ] = turn_on
441449
442450
443- class BigSeg7x4 (Seg7x4 ):
451+ class BigSeg7x4 (_AbstractSeg7x4 ):
444452 """Numeric 7-segment display. It has the same methods as the alphanumeric display, but only
445453 supports displaying a limited set of characters.
446454
@@ -460,7 +468,7 @@ def __init__(
460468 super ().__init__ (i2c , address , auto_write )
461469 # Use colon for controling two-dots indicator at the center (index 0)
462470 # or the two-dots indicators at the left (index 1)
463- self .colon = Colon (self , 2 )
471+ self .colons = Colon (self , 2 )
464472 self ._chardict = char_dict
465473
466474 def _setindicator (self , index : int , value : bool ) -> None :
@@ -514,7 +522,6 @@ def ampm(self) -> bool:
514522 def ampm (self , value : bool ) -> None :
515523 self ._setindicator (3 , value )
516524
517-
518525class Colon :
519526 """Helper class for controlling the colons. Not intended for direct use."""
520527
0 commit comments