Esempio n. 1
0
def tablprocess():
	"""
	здесь собсно обрабатывается запрос на генерацию табулатуры из кода
	"""
	Logger.clear()
	session_id = request.get_cookie('beaker.session.id')
	if session_id is None:
		Logger.log('no session from your side')
		return template('index', output=session_id, log_records=Logger.get(), 
			name='', typer='', code='')
	
	name  = request.forms.get('name')  or ''
	typer = request.forms.get('typer') or ''
	code  = request.forms.get('code')  or ''
	share = request.forms.get('share') or ''
	
	request.session['name']  = name
	request.session['typer'] = typer
	request.session['code']  = code
	request.session['share'] = share
	lines = map(lambda x: x.strip(), code.split("\n"))
	TablMaker.process(lines, name, 'output/' + session_id + '.png')
	if share == 'on':
		library.add_tabl(typer, name, code, session_id)
	
	return template('index', output=session_id, log_records=Logger.get(), 
		name=name, typer=typer, code=code, share=share)
Esempio n. 2
0
def index():
	"""
	здесь выдается основная страница с формой заполнения кода для табулатуры
	"""
	Logger.clear()
	session_id = request.get_cookie('beaker.session.id')
	name  = request.session['name']  if 'name'  in request.session else ''
	typer = request.session['typer'] if 'typer' in request.session else ''
	code  = request.session['code']  if 'code'  in request.session else ''
	share = request.session['share'] if 'share' in request.session else ''
	return template('index', output=session_id, log_records=Logger.get(), 
		name=name, typer=typer, code=code, share=share)
Esempio n. 3
0
from wand.image import Image


check = 'tr t34 c4 d4 e4'
result = LineMaker.process(check)
result.save(filename='test.png')

check = 'tr [!down (!up b8 a8 ) ]'
result = LineMaker.process(check)
result.save(filename='test.png')


check = 'tr varc c4 d4 e4 novar'
result = LineMaker.process(check)
result.save(filename='test_mark.png')

check = ['tr t34 c4 d4 e4', 'tr f4 g4 a4']
result = TablMaker.process(check, 'test', 'test2.png')

check = 'tr c0#'
result = LineMaker.process(check)
result.save(filename='test_empty.png')

check = 'tr 333 c1 d1 e1'
result = LineMaker.process(check)
result.save(filename='test_trip.png')

from service.logger import Logger
Logger.log('foobar')
print(Logger.get())