From 66d9d22e279005e8569ffd2d90c4cea01705c4d5 Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Mon, 21 Oct 2013 15:48:15 +0200 Subject: [PATCH 1/2] Updated requirements. --- requirements.txt | 8 ++++---- requirements_production.txt | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/requirements.txt b/requirements.txt index 3c7838017..c1d42884e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,13 +2,13 @@ -r requirements_production.txt # Requirements for development and tests -Fabric==1.6.1 -coverage==3.6 -django-discover-runner==0.4 +Fabric==1.8.0 +coverage==3.7 +django-discover-runner==1.0 flake8==2.0 # Requirements for OpenSlides handbook/documentation -Sphinx==1.2b1 +Sphinx==1.2b3 sphinx-bootstrap-theme==0.2.4 # For Python 2.6 support diff --git a/requirements_production.txt b/requirements_production.txt index 5d7b35605..a25eecf5c 100644 --- a/requirements_production.txt +++ b/requirements_production.txt @@ -1,10 +1,10 @@ -Django==1.5.2 -django-mptt==0.5.5 +Django==1.5.4 +django-mptt==0.6.0 reportlab==2.7 -pillow==2.0.0 -qrcode==2.7 -tornado==3.0.1 +pillow==2.2.1 +qrcode==4.0.1 +tornado==3.1.1 bleach==1.2.2 -beautifulsoup4==4.2.0 +beautifulsoup4==4.3.2 django-haystack==2.1.0 whoosh==2.5.4 From f1a8993452fbf8cd5a40bb2908c253805d7fe55b Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Mon, 21 Oct 2013 16:49:11 +0200 Subject: [PATCH 2/2] Used reportlabs qrcode widget (instead of extra qrcode package). --- extras/win32-portable/create_portable.txt | 2 +- extras/win32-portable/licenses/qrcode | 48 ----------------------- extras/win32-portable/prepare_portable.py | 3 -- openslides/participant/views.py | 31 ++++++--------- requirements_production.txt | 1 - 5 files changed, 13 insertions(+), 72 deletions(-) delete mode 100644 extras/win32-portable/licenses/qrcode diff --git a/extras/win32-portable/create_portable.txt b/extras/win32-portable/create_portable.txt index 3172eddf5..4077247b8 100644 --- a/extras/win32-portable/create_portable.txt +++ b/extras/win32-portable/create_portable.txt @@ -4,7 +4,7 @@ How to create a new portable Windows distribution of OpenSlides: 1.) Follow the OpenSlides installation instructions for windows, but add the option "-Z" when executing easy_install, e.g.: - easy_install -Z django django-mptt beautifulsoup4 bleach pillow qrcode reportlab tornado django-haystack whoosh + easy_install -Z django django-mptt beautifulsoup4 bleach pillow reportlab tornado django-haystack whoosh 2.) To update the version resource of the prebuild openslides.exe pywin32 should be installed (it is not strictly required but at diff --git a/extras/win32-portable/licenses/qrcode b/extras/win32-portable/licenses/qrcode deleted file mode 100644 index bb4b0c708..000000000 --- a/extras/win32-portable/licenses/qrcode +++ /dev/null @@ -1,48 +0,0 @@ -Copyright (c) 2011, Lincoln Loop -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the package name nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -------------------------------------------------------------------------------- - - -Original text and license from the pyqrnative package where this was forked -from (http://code.google.com/p/pyqrnative): - -#Ported from the Javascript library by Sam Curren -# -#QRCode for Javascript -#http://d-project.googlecode.com/svn/trunk/misc/qrcode/js/qrcode.js -# -#Copyright (c) 2009 Kazuhiko Arase -# -#URL: http://www.d-project.com/ -# -#Licensed under the MIT license: -# http://www.opensource.org/licenses/mit-license.php -# -# The word "QR Code" is registered trademark of -# DENSO WAVE INCORPORATED -# http://www.denso-wave.com/qrcode/faqpatent-e.html diff --git a/extras/win32-portable/prepare_portable.py b/extras/win32-portable/prepare_portable.py index 9c053855d..254e5a8b6 100755 --- a/extras/win32-portable/prepare_portable.py +++ b/extras/win32-portable/prepare_portable.py @@ -90,9 +90,6 @@ SITE_PACKAGES = { "tornado": { "copy": ["tornado"], }, - "qrcode": { - "copy": ["qrcode"], - }, "beautifulsoup4": { "copy": ["bs4"], }, diff --git a/openslides/participant/views.py b/openslides/participant/views.py index 452387e90..7d2288939 100644 --- a/openslides/participant/views.py +++ b/openslides/participant/views.py @@ -10,15 +10,6 @@ :license: GNU GPL, see LICENSE for more details. """ -try: - import qrcode -except ImportError: - draw_qrcode = False -else: - draw_qrcode = True - -from cStringIO import StringIO - from django.contrib import messages from django.contrib.auth.decorators import login_required from django.contrib.auth.forms import PasswordChangeForm @@ -27,9 +18,11 @@ from django.core.urlresolvers import reverse from django.shortcuts import redirect from django.utils.translation import ugettext as _ from django.utils.translation import activate, ugettext_lazy +from reportlab.graphics.barcode.qr import QrCodeWidget +from reportlab.graphics.shapes import Drawing from reportlab.lib import colors from reportlab.lib.units import cm -from reportlab.platypus import (Image, LongTable, Paragraph, SimpleDocTemplate, +from reportlab.platypus import (LongTable, Paragraph, SimpleDocTemplate, Spacer, Table, TableStyle) from openslides.config.api import config @@ -266,13 +259,14 @@ class ParticipantsPasswordsPDF(PDFView): else: sort = 'last_name' # create qrcode image object from system url - if draw_qrcode: - qrcode_img = qrcode.make(participant_pdf_system_url) - img_stream = StringIO() - qrcode_img.save(img_stream, 'PNG') - img_stream.seek(0) - size = 2 * cm - I = Image(img_stream, width=size, height=size) + qrcode = QrCodeWidget(participant_pdf_system_url) + size = 1.5 * cm + qrcode.barHeight = size + qrcode.barWidth = size + qrcode.barBorder = 0 + draw = Drawing(45, 45) + draw.add(qrcode) + for user in User.objects.all().order_by(sort): cell = [] cell.append(Spacer(0, 0.8 * cm)) @@ -289,8 +283,7 @@ class ParticipantsPasswordsPDF(PDFView): % (user.default_password), stylesheet['Monotype'])) cell.append( Paragraph(participant_pdf_system_url, stylesheet['Monotype'])) - if draw_qrcode: - cell.append(I) + cell.append(draw) cell2 = [] cell2.append(Spacer(0, 0.8 * cm)) if participant_pdf_welcometext is not None: diff --git a/requirements_production.txt b/requirements_production.txt index a25eecf5c..752c832ff 100644 --- a/requirements_production.txt +++ b/requirements_production.txt @@ -2,7 +2,6 @@ Django==1.5.4 django-mptt==0.6.0 reportlab==2.7 pillow==2.2.1 -qrcode==4.0.1 tornado==3.1.1 bleach==1.2.2 beautifulsoup4==4.3.2