needle_positions
Module¶
This module provides the interface to the AYAB shield.
-
class
AYABInterface.needle_positions.
NeedlePositions
(rows, machine)[source]¶ Bases:
object
An interface that just focusses on the needle positions.
-
__init__
(rows, machine)[source]¶ Create a needle interface.
Parameters: - rows¶ (list) – a list of lists of
needle positions
- Machine¶ – the machine type to use
Raises: ValueError – if the arguments are not valid, see
check()
- rows¶ (list) – a list of lists of
-
__weakref__
¶ list of weak references to the object (if defined)
-
check
()[source]¶ Check for validity.
Raises: ValueError – - if not all lines are as long as the
number of needles
- if the contents of the rows are not
needle positions
- if not all lines are as long as the
-
completed_row_indices
¶ The indices of the completed rows.
Return type: list When a
row was completed
, the index of the row turns up here. The order is preserved, entries may occur duplicated.
-
machine
¶ The machine these positions are on.
-
on_row_completed
(callable)[source]¶ Add an observer for completed rows.
Parameters: callable¶ – a callable that is called with the row index as first argument When
row_completed()
was called, thiscallable
is called with the row index as first argument. Call this method several times to register more observers.
-
row_completed
(index)[source]¶ Mark the row at index as completed.
See also
This method notifies the obsevrers from
on_row_completed()
.
-