From ac172669b24d7d76edcb762812cbc18cf21e00b4 Mon Sep 17 00:00:00 2001 From: Joe Mancewicz Date: Fri, 10 Jul 2015 13:46:46 -0700 Subject: [PATCH] A few more UI tweaks --- digits/dataset/images/forms.py | 8 +------- digits/dataset/images/job.py | 13 +++++++++++++ .../datasets/images/classification/show.html | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/digits/dataset/images/forms.py b/digits/dataset/images/forms.py index b4d5d43fb..0ecb9c1bd 100644 --- a/digits/dataset/images/forms.py +++ b/digits/dataset/images/forms.py @@ -37,11 +37,5 @@ class ImageDatasetForm(DatasetForm): ) resize_mode = wtforms.SelectField(u'Resize Transformation', default='squash', - choices=[ - ('crop', 'Crop'), - ('squash', 'Squash'), - ('fill', 'Fill'), - ('half_crop', 'Half crop, half fill'), - ] + choices=ImageDatasetJob.choices() ) - diff --git a/digits/dataset/images/job.py b/digits/dataset/images/job.py index 7f899db5e..b4ab146f5 100644 --- a/digits/dataset/images/job.py +++ b/digits/dataset/images/job.py @@ -22,3 +22,16 @@ def __init__(self, image_dims, resize_mode, **kwargs): self.image_dims = image_dims self.resize_mode = resize_mode + @staticmethod + def choices(): + return [ + ('crop', 'Crop'), + ('squash', 'Squash'), + ('fill', 'Fill'), + ('half_crop', 'Half crop, half fill'), + ] + + def resize_mode_name(self): + c = dict(self.choices()) + return c[self.resize_mode] + diff --git a/digits/templates/datasets/images/classification/show.html b/digits/templates/datasets/images/classification/show.html index 5068a6356..e1b0fc562 100644 --- a/digits/templates/datasets/images/classification/show.html +++ b/digits/templates/datasets/images/classification/show.html @@ -19,7 +19,7 @@

Job Information

Image Dimensions
{{job.image_dims[1]}}x{{job.image_dims[0]}}
Resize Transformation
-
{{ job.resize_mode }}
+
{{ job.resize_mode_name() }}
{% endmacro %}