You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
812 B

import logging
class SourceGenerator:
def generate_source(self,field):
source = 'byte frame[8][12] ={\n'
logging.debug(f'frame= {field.frame}')
for line in range(0,len(field.frame)):
logging.debug(f'proccessing line {line}')
curline = field.frame[line]
sourceline = '{ '
logging.debug(f'initialized sourceline= {sourceline}')
for col in range(0,len(curline)):
logging.debug(f'processing column {col},adding {curline[col]}')
sourceline += '1, ' if curline[col] == 1 else '0, '
logging.debug(f'sourceline for ({line},{col})={sourceline}')
sourceline += '},\n' #if col < len(curline) else '}\n'
logging.debug(f'appending sourceline {sourceline}')
source = source + sourceline
source = source + '\n};'
return source