Package screenlets :: Package plugins :: Module LengthConverter

[hide private]
[frames] | no frames]

# Source Code for Module screenlets.plugins.LengthConverter

     1  from Convert import RatioConverter
     2
     3  # This is an example use of the RatioConverter superclass. See also
     4  # the documentation of Converter and RatioConverter in ConvertScreenlet.py, for
     5  # description of the variables, please.
     6 -class LengthConverter(RatioConverter):
     7          """A converter which converts lengths between centimeters and inches."""
     8
     9          # These fields must be defined in every screenlet:
    10          # __name__: the name of the class
    11          __name__ = 'LengthConverter'
    12          # __title__: a short description to be shown in the menu and Options dialog
    13          __title__ = 'cm / inches'
    14          # author and version - not currently shown anywhere
    15          __author__ = 'Vasek Potocek'
    16          __version__ = '0.2'
    17
    18          # the number of fields and their captions
    19          num_fields = 2
    20          field_names = ['cm', 'in']
    21
    22          # The relative weights of the fields. Here, we set 1 for cm and 2.54 for an
    23          # inch, meaning one inch is a unit 2.54 times larger than a centimeter. Note
    24          # that the values will be in an inversed ratio.
    25          weights = [1, 2.54]
    26