[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Maposmatic-dev] [PATCH 5/8] Support None/None initial paper size for th
From: |
Thomas Petazzoni |
Subject: |
[Maposmatic-dev] [PATCH 5/8] Support None/None initial paper size for the 'Best fit' case |
Date: |
Sat, 7 Aug 2010 11:18:50 +0200 |
Signed-off-by: Thomas Petazzoni <address@hidden>
---
www/maposmatic/forms.py | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/www/maposmatic/forms.py b/www/maposmatic/forms.py
index c620ebe..e249699 100644
--- a/www/maposmatic/forms.py
+++ b/www/maposmatic/forms.py
@@ -93,10 +93,16 @@ class MapRenderingJobForm(forms.ModelForm):
for s in stylesheets]
self.fields['stylesheet'].initial = stylesheets[0].name
- self.fields['papersize'].choices = [
- (p[0], mark_safe("%s <em class=\"papersize\">"
+ def _build_papersize_description(p):
+ if p[1] is None or p[2] is None:
+ return mark_safe("%s <em class=\"papersize\"></em>" % p[0])
+ else:
+ return mark_safe("%s <em class=\"papersize\">"
"(%.1f × %.1f cm²)</em>"
- % (p[0], p[1] / 10., p[2] / 10.)))
+ % (p[0], p[1] / 10., p[2] / 10.))
+
+ self.fields['papersize'].choices = [
+ (p[0], _build_papersize_description(p))
for p in renderers.Renderer.PAPER_SIZES]
def clean(self):
--
1.7.0.4
- [Maposmatic-dev] [PATCH 1/8] Implement the paper orientation selection, Thomas Petazzoni, 2010/08/08
- [Maposmatic-dev] Re: [PATCH 1/8] Implement the paper orientation selection, Maxime Petazzoni, 2010/08/08
- [Maposmatic-dev] [PATCH 8/8] Put immediatly focus on the admin search box on page load, Thomas Petazzoni, 2010/08/08
- [Maposmatic-dev] [PATCH 7/8] Re-indent Javascript code to 2 spaces, Thomas Petazzoni, 2010/08/08
- [Maposmatic-dev] [PATCH 5/8] Support None/None initial paper size for the 'Best fit' case,
Thomas Petazzoni <=
- [Maposmatic-dev] [PATCH 6/8] Completely rework the Nominatim search, Thomas Petazzoni, 2010/08/08
- [Maposmatic-dev] [PATCH 3/8] Update paper size in the 'Best fit' case, Thomas Petazzoni, 2010/08/08
- [Maposmatic-dev] [PATCH 4/8] Only handle click on the label instead on the full <li> element, Thomas Petazzoni, 2010/08/08
- [Maposmatic-dev] [PATCH 2/8] Simplify preparePaperPanel() function, Thomas Petazzoni, 2010/08/08