Stefan Schuermans
add support for monochrome distributors
Stefan Schuermans commited 726e102 at 2018-11-01 14:46:02
# python EtherPix library
#
# Copyright 2017 Stefan Schuermans <stefan schuermans info>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import socket
import struct
from PIL import Image
from pyetherpix.mapping import Mapping
class Distributor(object):
def __init__(self, distri_no, outputs, pixels):
"""create a new EtherPix distributor
distri_no: distributor number
outputs: number of outputs
pixels: number of pixels per output"""
self._distri_no = distri_no
self._outputs = outputs
self._pixels = pixels
# no address(es) yet
self._addrs = []
# default color mapping
self._mappings = []
for c in range(Mapping.CHANNELS):
self._mappings.append(Mapping())
# pixel coordinates: all unknown
self._pixel_coords = [[None] * self._pixels] * self._outputs
# initialize channels and header for UDP packets
self.set_channels(Mapping.CHANNELS)
# initial image data is cleared
self.data_clear()
def check_output_no(self, output_no):
"""check output number, return True if okay, False if not okay"""
return output_no >= 0 and output_no < self._outputs
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX