Browse Source

Merge pull request #79 from alberanid/master

nice-looking date and times
Davide Alberani 9 years ago
parent
commit
8b43e85614

+ 1 - 0
README.md

@@ -42,6 +42,7 @@ Be sure to have a running MongoDB server, locally.
     sudo python get-pip.py
     sudo pip install tornado
     sudo pip install pymongo
+    sudo pip install pycups # only needed if you want to print labels
     cd
     git clone https://github.com/raspibo/eventman
     cd eventman

+ 2 - 2
angular_app/events-list.html

@@ -37,8 +37,8 @@
                 <tr ng-repeat="event in events | splittedFilter:query | orderBy:eventsOrderProp">
                     <td>
                         <span><strong><a ui-sref="event.info({id: event._id})">{{event.title}}</a></strong></span>
-                        <p>{{'Begins:' | translate}} {{event['begin-date']}}<br/>
-                        {{'Ends:' | translate}} {{event['end-date']}}</p>
+                        <p>{{'Begins:' | translate}} {{event['begin-date'] | date:'fullDate' }} {{event['begin-time'] | date:'hh:mm' }}<br/>
+                        {{'Ends:' | translate}} {{event['end-date'] | date:'fullDate' }} {{event['end-time'] | date:'hh:mm'}}</p>
                     </td>
                     <td>
                         <button ng-click="remove(event._id)" type="button" class="btn btn-link fa fa-trash fa-lg"></button>

+ 4 - 4
angular_app/js/controllers.js

@@ -68,9 +68,9 @@ eventManControllers.controller('EventsListCtrl', ['$scope', 'Event', '$modal', '
         $scope.personsOrderProp = 'name';
         $scope.eventsOrderProp = "'-begin-date'";
 
-        $scope.confirm_delete = 'You really want to delete this event?';
+        $scope.confirm_delete = 'Do you really want to delete this event?';
         $rootScope.$on('$translateChangeSuccess', function () {
-            $translate('You really want to delete this event?').then(function (translation) {
+            $translate('Do you really want to delete this event?').then(function (translation) {
                 $scope.confirm_delete = translation;
             });
         });
@@ -280,9 +280,9 @@ eventManControllers.controller('PersonsListCtrl', ['$scope', 'Person', 'Setting'
         $scope.customFields = Setting.query({setting: 'person_custom_field',
             in_persons_list: true});
 
-        $scope.confirm_delete = 'You really want to delete this person?';
+        $scope.confirm_delete = 'Do you really want to delete this person?';
         $rootScope.$on('$translateChangeSuccess', function () {
-            $translate('You really want to delete this person?').then(function (translation) {
+            $translate('Do you really want to delete this person?').then(function (translation) {
                 $scope.confirm_delete = translation;
             });
         });

+ 2 - 1
angular_app/js/directives.js

@@ -16,6 +16,7 @@ eventManApp.directive('eventmanPressEnter', function () {
     };
 });
 
+
 eventManApp.directive('eventmanFocus', function () {
     function link(scope, element, attrs) {
         element[0].focus();
@@ -53,7 +54,7 @@ eventManApp.directive('eventmanMessage', ['$timeout',
                 scope.dControl.isError = cfg.isError;
                 $timeout(function () {
                     scope.dControl.isVisible = false;
-                }, cfg.timeout || 2000);
+                }, cfg.timeout || 4000);
             };
         };
 

+ 8 - 7
data/triggers-available/print_label.py

@@ -14,12 +14,12 @@ import cups
 import tempfile
 from PIL import Image, ImageFont, ImageDraw
 
-KEEP_IMG = False
+KEEP_IMG = True
 LABEL_WIDTH = 13488
 LABEL_HEIGHT = 3744
 
 FONT_TEXT = 'Ubuntu-C.ttf'
-#FONT_TEXT = 'CONCIBB_.TTF'
+FONT_TEXT = 'CONCIBB_.TTF'
 FONT_TEXT_ENCODING = 'latin-1'
 FONT_BARCODE = 'free3of9.ttf'
 
@@ -36,14 +36,15 @@ def build_label(w, h, barcode_text, line1, line2, font_text=FONT_TEXT, font_barc
     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), 2000)
-    fontnorm = ImageFont.truetype(_get_resource(font_text), 840)
+    fontname = ImageFont.truetype(_get_resource(font_text), 1100)
+    fontjob = ImageFont.truetype(_get_resource(font_text), 780)
     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=fontnorm)
-    wnorm2, hnorm2 = draw.textsize(line2, font=fontnorm)
-    draw.text(((w-wnorm1)/2, -1200+(h-hnorm1)/2), line1, (0, 0, 0), font=fontnorm)
-    draw.text(((w-wnorm2)/2, -450+(h-hnorm2)/2), line2, (0, 0, 0), font=fontnorm)
+    wnorm1, hnorm1 = draw.textsize(line1, font=fontname)
+    wnorm2, hnorm2 = draw.textsize(line2, font=fontjob)
+    draw.text(((w-wnorm1)/2, -1300+(h-hnorm1)/2), line1, (0, 0, 0), font=fontname)
+    draw.text(((w-wnorm2)/2, -480+(h-hnorm2)/2), line2, (0, 0, 0), font=fontjob)
     draw.text(((w-wbar)/2, 850+(h-hbar)/2), barcode_text, (0, 0, 0), font=fontbar)
     if not KEEP_IMG:
         tmpfile = tempfile.NamedTemporaryFile(prefix='eventman_print_label_', suffix='.png')

+ 2 - 2
static/i18n/it_IT.json

@@ -52,7 +52,7 @@
     "Registered": "Registrato",
     "Add person": "Aggiungi persona",
     "Persons:": "Persone:",
-    "You really want to delete this event?": "Vuoi veramente cancellare questo evento?",
+    "Do you really want to delete this event?": "Vuoi veramente cancellare questo evento?",
     "{{person_name}} {{person_surname}} successfully added to event {{event_title}}": "{{person_name}} {{person_surname}} aggiunto con successo all'evento {{event_title}}",
-    "You really want to delete this person?": "Vuoi veramente cancellare questa persona?"
+    "Do you really want to delete this person?": "Vuoi veramente cancellare questa persona?"
 }