mario edition

This commit is contained in:
hackinbo 2015-05-21 21:26:53 +02:00
parent 8b43e85614
commit b1072f4195
13 changed files with 132 additions and 5 deletions

2
.gitignore vendored
View file

@ -1,5 +1,3 @@
data/triggers/*.d
ssl/*.pem
angular_app/node_modules/

View file

@ -41,7 +41,7 @@
<tr>
<th class="text-right">#</th>
<th>{{'Person' | translate}} <a ng-click="updateOrded('name')" href=""><i class="fa fa-caret-up"></i></a>{{'Name' | translate}}<a ng-click="updateOrded('-name')" href=""><i class="fa fa-caret-down"></i></a> <a ng-click="updateOrded('surname')" href=""><i class="fa fa-caret-up"></i></a>{{'Surname' | translate}}<a ng-click="updateOrded('-surname')" href=""><i class="fa fa-caret-down"></i></a></th>
<th class="text-center"><a ng-click="updateOrded('-attended')" href=""><i class="fa fa-caret-up"></i></a>{{'Attended' | translate}}<a ng-click="updateOrded('attended')" href=""><i class="fa fa-caret-down"></i></a></th>
<th class="text-center min120"><a ng-click="updateOrded('-attended')" href=""><i class="fa fa-caret-up"></i></a>{{'Attended' | translate}}<a ng-click="updateOrded('attended')" href=""><i class="fa fa-caret-down"></i></a></th>
<th class="text-center" ng-repeat="col in customFields">
<a ng-click="updateOrded(col.key)" href=""><i class="fa fa-caret-up"></i></a>{{col.label | translate}}<a ng-click="updateOrded('-' + col.key)" href=""><i class="fa fa-caret-down"></i></a>
</th>
@ -60,7 +60,7 @@
</td>
<td class="text-center" ng-repeat="col in customFields">
<span ng-if="col.type == 'boolean'">
<button class="btn btn-link" ng-click="setPersonAttribute(person, col.key, !person[col.key])"><span class="fa fa-lg {{(person[col.key]) && 'fa-check-circle text-success' || 'da-times-circle text-danger'}}"></span></button>
<button class="btn btn-link" ng-click="setPersonAttribute(person, col.key, !person[col.key])"><span class="fa fa-lg {{(person[col.key]) && 'fa-check-circle text-success' || 'fa-times-circle text-danger'}}"></span></button>
</span>
<span ng-if="col.type != 'boolean'">
{{person[col.key]}}

View file

@ -10,7 +10,7 @@ eventManApp.config(['$translateProvider', function ($translateProvider) {
});
$translateProvider.useSanitizeValueStrategy('escaped');
//$translateProvider.preferredLanguage('it_IT');
$translateProvider.preferredLanguage('it_IT');
//$translateProvider.fallbackLanguage('en_US');
}]);

BIN
data/dump.zip Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,4 @@
Collection of useful triggers.
Link them in the appropriate directory, if neeed.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,95 @@
#!/usr/bin/env python
"""print_label.py - print a label with the name, the company and the person_id (in a barcode) of an attendee
Copyright 2015 Emiliano Mattioli <oloturia AT gmail.com>
Davide Alberani <da@erlug.linux.it>
RaspiBO <info@raspibo.org>
Licensed under the Apache License 2.0
"""
import os
import sys
import cups
import time
import tempfile
from PIL import Image, ImageFont, ImageDraw
KEEP_IMG = True
LABEL_WIDTH = 6744
LABEL_HEIGHT = 1872
FONT_TEXT = 'Ubuntu-C.ttf'
#FONT_TEXT = 'CONCIBB_.TTF'
FONT_TEXT_ENCODING = 'latin-1'
FONT_BARCODE = 'free3of9.ttf'
PRINTER_NAME = None
PRINTER_NAME = 'DYMO_LabelWriter_450'
def debug(msg):
print '%s: %s' % (time.time(), msg)
def _get_resource(filename):
return os.path.join(os.path.dirname(sys.argv[0]), filename)
def build_label(w, h, barcode_text, line1, line2, font_text=FONT_TEXT, font_barcode=FONT_BARCODE):
debug('build_label start')
barcode_text = "*" + barcode_text + "*"
line1 = unicode(line1, 'utf-8').encode(FONT_TEXT_ENCODING, 'ignore')
line2 = unicode(line2, 'utf-8').encode(FONT_TEXT_ENCODING, 'ignore')
fontbar = ImageFont.truetype(_get_resource(font_barcode), 1000)
fontname = ImageFont.truetype(_get_resource(font_text), 550)
fontjob = ImageFont.truetype(_get_resource(font_text), 360)
debug('build_label font done')
image = Image.new('RGB', (w, h), (255, 255, 255))
draw = ImageDraw.Draw(image)
wbar, hbar = draw.textsize(barcode_text, font=fontbar)
wnorm1, hnorm1 = draw.textsize(line1, font=fontname)
wnorm2, hnorm2 = draw.textsize(line2, font=fontjob)
debug('build_label height calc done')
draw.text(((w-wnorm1)/2, -670+(h-hnorm1)/2), line1, (0, 0, 0), font=fontname)
draw.text(((w-wnorm2)/2, -220+(h-hnorm2)/2), line2, (0, 0, 0), font=fontjob)
draw.text(((w-wbar)/2, 425+(h-hbar)/2), barcode_text, (0, 0, 0), font=fontbar)
debug('build_label draw text done')
if not KEEP_IMG:
tmpfile = tempfile.NamedTemporaryFile(prefix='eventman_print_label_', suffix='.png')
else:
tmpfile = tempfile.mktemp(prefix='eventman_print_label_', suffix='.png')
tmpfile = open(tmpfile, 'wb')
image.save(tmpfile, dpi=[600, 300], format='png')
debug('build_label end')
return tmpfile
def print_label(label_file, name):
debug('print_label start')
conn = cups.Connection()
printer = PRINTER_NAME or conn.getDefault()
debug('print_label connection done')
conn.printFile(printer, label_file.name, name, {})
debug('print_label end')
def run():
debug('run start')
# Always consume stdin.
sys.stdin.read()
name = ' '.join([os.environ.get('NAME') or '', os.environ.get('SURNAME') or ''])
company = os.environ.get('COMPANY') or ''
# Print the decimal value SEQ as an hex of at least 6 digits.
seq = os.environ.get('SEQ_HEX', '0')
label_file = build_label(LABEL_WIDTH, LABEL_HEIGHT, seq, name, company)
print_label(label_file, name)
debug('run end')
if __name__ == '__main__':
try:
run()
except Exception, e:
sys.stderr.write('print_label. Exception raised: %s\n' % e)

14
ssl/eventman_cert.pem Normal file
View file

@ -0,0 +1,14 @@
-----BEGIN CERTIFICATE-----
MIICHDCCAYWgAwIBAgIJAPj7tC6u7ZrZMA0GCSqGSIb3DQEBCwUAMCcxEDAOBgNV
BAoMB1Jhc3BpQk8xEzARBgNVBAMMCkV2ZW50e01hbn0wHhcNMTUwNDI2MDgyMDM5
WhcNMjUwNDIzMDgyMDM5WjAnMRAwDgYDVQQKDAdSYXNwaUJPMRMwEQYDVQQDDApF
dmVudHtNYW59MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQClnfeRr+BYSvpj
xxRfzlpzKdTEzA4Voiq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bsY0Zv3OG/WTF8raZrxHznGXOA/kmdb9kMsrc1nSdBw9rISHeVIHbZHV30Oigfw5
W5ELZwJBALsT47+/vLYzkzVc9nuEMVrQfzZfhT3Tdfbg4iZAOTrDWVJpWwjh4fGJ
zDXWmpedsteJefgjNpzs+3Zyqw+N/OkCQQCr5ft1dUpZNCNg06nb8LNSbkW3Hjoj
7dbE5bN8CI8actCKRWE9T8ILh+zvCIfD1K3+WELdhNv9DguoYmjmqOZVAkBAGrt/
DUQTmRhIcwhUmjDL7Qg3l9u8LuU56tk8rq5yU9mSc9U3JCWk4Wa+xOjPQLTwREBR
JHJK98DCPzY7eIHC
-----END PRIVATE KEY-----

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB