fix pdf unicode issues, and move OrderContractForm submit inside fieldset
authorTero Marttila <terom@fixme.fi>
Thu, 23 Dec 2010 21:20:41 +0200
changeset 17 820c46308e45
parent 16 46b7e358a5f4
child 18 5d06a3658699
fix pdf unicode issues, and move OrderContractForm submit inside fieldset
static/forms.css
svv/orders.py
svv/pdf.py
--- a/static/forms.css	Thu Dec 23 19:57:55 2010 +0200
+++ b/static/forms.css	Thu Dec 23 21:20:41 2010 +0200
@@ -107,6 +107,9 @@
     width: 30%;
 
     border: auto;
+
+    /* XXX: might be best to re-configure input/p margins */
+    margin-bottom: 1em;
 }
 
 /* Field's descriptive text */
--- a/svv/orders.py	Thu Dec 23 19:57:55 2010 +0200
+++ b/svv/orders.py	Thu Dec 23 21:20:41 2010 +0200
@@ -755,10 +755,13 @@
                     self.render_form_field('prefill_ourname', u"Esitäytä vuokranantaja", u"Esitäytä allekirjoitusosion vuokranantajan nimi", (
                         self.render_armed_text_input('prefill_ourname', self.prefill_ourname, self.prefill_ourname_default)
                     )),
+
+                    tags.li(
+                        tags.input(type='submit', value=submit),
+                    ),
                 ),
             ),
 
-            tags.input(type='submit', value=submit),
         )
 
 
@@ -1176,12 +1179,12 @@
                 ("", ""),
                 ("", ""),
                 ("", ""),
-                ("Vuokrasopimus", "\n".join((order.customer_name, order.event_name, 'dd.mm.yy hh:mm-hh:mm'))),
+                ("Vuokrasopimus", [order.customer_name, order.event_name, 'dd.mm.yy hh:mm-hh:mm']),
             ),
             footer_columns  = (
-                ("Teekkarispeksi Ry", "www.teekkarispeksi.fi"),
-                ("Tekniikkavastaava", "Juha Kallas\n045 xxx yyzz\njskallas@cc.hut.fi"),
-                ("Varastovastaava", "Joel Pirttimaa\n045 xxx yyzz\njhpirtti@cc.hut.fi"),
+                ("Teekkarispeksi Ry", ("www.teekkarispeksi.fi", )),
+                ("Tekniikkavastaava", ("Juha Kallas", "045 xxx yyzz", "jskallas@cc.hut.fi")),
+                ("Varastovastaava", ("Joel Pirttimaa", "045 xxx yyzz", "jhpirtti@cc.hut.fi")),
                 ("", ""),
             ),
         )
--- a/svv/pdf.py	Thu Dec 23 19:57:55 2010 +0200
+++ b/svv/pdf.py	Thu Dec 23 21:20:41 2010 +0200
@@ -212,7 +212,8 @@
         """
             Format display string using context parameters
         """
-
+        
+        # XXX: the canvas.drawString we use here does support unicode?
         return text % dict(
                 column      = col_title,
                 today       = datetime.date.today().strftime("%d/%m/%Y"),
@@ -313,13 +314,11 @@
         """
             Prepare a string for display by handling format codes
         """
-
-        # XXX: unicode?
-        return str(text % dict(
+        
+        return unicode(text % dict(
             today = datetime.date.today().strftime("%d / %m / %Y"),
         ))
 
-
     def draw_column (self, canvas, x, y, width, title, lines, gray=None) :
         """
             Draw a column in the specified position, with the specified lines of text
@@ -337,7 +336,10 @@
 
         # lines
         text.setFont(*self.COL_TEXT_FONT)
-        text.textLines(self.fmt_string(lines))
+
+        # XXX: textobject's textLine fails at unicode, but textLine should work...
+        for line in lines :
+            text.textLine(self.fmt_string(line))
         
         # draw out
         canvas.drawText(text)