| OLD | NEW | 
|    1 #!/usr/bin/python |    1 #!/usr/bin/python | 
|    2  |    2  | 
|    3 """ |    3 """ | 
|    4 Copyright 2014 Google Inc. |    4 Copyright 2014 Google Inc. | 
|    5  |    5  | 
|    6 Use of this source code is governed by a BSD-style license that can be |    6 Use of this source code is governed by a BSD-style license that can be | 
|    7 found in the LICENSE file. |    7 found in the LICENSE file. | 
|    8  |    8  | 
|    9 ImagePairSet class; see its docstring below. |    9 ImagePairSet class; see its docstring below. | 
|   10 """ |   10 """ | 
|   11  |   11  | 
|   12 # System-level imports |   12 # System-level imports | 
|   13 import posixpath |   13 import posixpath | 
|   14  |   14  | 
|   15 # Local imports |   15 # Local imports | 
|   16 import column |   16 import column | 
 |   17 import imagepair | 
|   17  |   18  | 
|   18 # Keys used within dictionary representation of ImagePairSet. |   19 # Keys used within dictionary representation of ImagePairSet. | 
|   19 # NOTE: Keep these in sync with static/constants.js |   20 # NOTE: Keep these in sync with static/constants.js | 
|   20 KEY__IMAGEPAIRS = 'imagePairs' |   21 KEY__ROOT__EXTRACOLUMNHEADERS = 'extraColumnHeaders' | 
|   21 KEY__IMAGESETS = 'imageSets' |   22 KEY__ROOT__HEADER = 'header' | 
 |   23 KEY__ROOT__IMAGEPAIRS = 'imagePairs' | 
 |   24 KEY__ROOT__IMAGESETS = 'imageSets' | 
|   22 KEY__IMAGESETS__FIELD__BASE_URL = 'baseUrl' |   25 KEY__IMAGESETS__FIELD__BASE_URL = 'baseUrl' | 
|   23 KEY__IMAGESETS__FIELD__DESCRIPTION = 'description' |   26 KEY__IMAGESETS__FIELD__DESCRIPTION = 'description' | 
|   24 KEY__IMAGESETS__SET__DIFFS = 'diffs' |   27 KEY__IMAGESETS__SET__DIFFS = 'diffs' | 
|   25 KEY__IMAGESETS__SET__IMAGE_A = 'imageA' |   28 KEY__IMAGESETS__SET__IMAGE_A = 'imageA' | 
|   26 KEY__IMAGESETS__SET__IMAGE_B = 'imageB' |   29 KEY__IMAGESETS__SET__IMAGE_B = 'imageB' | 
|   27 KEY__IMAGESETS__SET__WHITEDIFFS = 'whiteDiffs' |   30 KEY__IMAGESETS__SET__WHITEDIFFS = 'whiteDiffs' | 
|   28  |   31  | 
|   29 DEFAULT_DESCRIPTIONS = ('setA', 'setB') |   32 DEFAULT_DESCRIPTIONS = ('setA', 'setB') | 
|   30  |   33  | 
|   31  |   34  | 
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  133     return asdict |  136     return asdict | 
|  134  |  137  | 
|  135   def as_dict(self): |  138   def as_dict(self): | 
|  136     """Returns a dictionary describing this package of ImagePairs. |  139     """Returns a dictionary describing this package of ImagePairs. | 
|  137  |  140  | 
|  138     Uses the KEY__* constants as keys. |  141     Uses the KEY__* constants as keys. | 
|  139     """ |  142     """ | 
|  140     key_description = KEY__IMAGESETS__FIELD__DESCRIPTION |  143     key_description = KEY__IMAGESETS__FIELD__DESCRIPTION | 
|  141     key_base_url = KEY__IMAGESETS__FIELD__BASE_URL |  144     key_base_url = KEY__IMAGESETS__FIELD__BASE_URL | 
|  142     return { |  145     return { | 
|  143         column.KEY__EXTRACOLUMNHEADERS: self._column_headers_as_dict(), |  146         KEY__ROOT__EXTRACOLUMNHEADERS: self._column_headers_as_dict(), | 
|  144         KEY__IMAGEPAIRS: self._image_pair_dicts, |  147         KEY__ROOT__IMAGEPAIRS: self._image_pair_dicts, | 
|  145         KEY__IMAGESETS: { |  148         KEY__ROOT__IMAGESETS: { | 
|  146             KEY__IMAGESETS__SET__IMAGE_A: { |  149             KEY__IMAGESETS__SET__IMAGE_A: { | 
|  147                 key_description: self._descriptions[0], |  150                 key_description: self._descriptions[0], | 
|  148                 key_base_url: self._image_base_url, |  151                 key_base_url: self._image_base_url, | 
|  149             }, |  152             }, | 
|  150             KEY__IMAGESETS__SET__IMAGE_B: { |  153             KEY__IMAGESETS__SET__IMAGE_B: { | 
|  151                 key_description: self._descriptions[1], |  154                 key_description: self._descriptions[1], | 
|  152                 key_base_url: self._image_base_url, |  155                 key_base_url: self._image_base_url, | 
|  153             }, |  156             }, | 
|  154             KEY__IMAGESETS__SET__DIFFS: { |  157             KEY__IMAGESETS__SET__DIFFS: { | 
|  155                 key_description: 'color difference per channel', |  158                 key_description: 'color difference per channel', | 
|  156                 key_base_url: posixpath.join( |  159                 key_base_url: posixpath.join( | 
|  157                     self._diff_base_url, 'diffs'), |  160                     self._diff_base_url, 'diffs'), | 
|  158             }, |  161             }, | 
|  159             KEY__IMAGESETS__SET__WHITEDIFFS: { |  162             KEY__IMAGESETS__SET__WHITEDIFFS: { | 
|  160                 key_description: 'differing pixels in white', |  163                 key_description: 'differing pixels in white', | 
|  161                 key_base_url: posixpath.join( |  164                 key_base_url: posixpath.join( | 
|  162                     self._diff_base_url, 'whitediffs'), |  165                     self._diff_base_url, 'whitediffs'), | 
|  163             }, |  166             }, | 
|  164         }, |  167         }, | 
|  165     } |  168     } | 
| OLD | NEW |