Package screenlets :: Package plugins :: Module LengthConverter
[hide private]
[frames] | no frames]

Source Code for Module screenlets.plugins.LengthConverter

 1  # This program is free software: you can redistribute it and/or modify 
 2  # it under the terms of the GNU General Public License as published by 
 3  # the Free Software Foundation, either version 3 of the License, or 
 4  # (at your option) any later version. 
 5  #  
 6  # This program is distributed in the hope that it will be useful, 
 7  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
 8  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 9  # GNU General Public License for more details. 
10  #  
11  # You should have received a copy of the GNU General Public License 
12  # along with this program.  If not, see <http://www.gnu.org/licenses/>. 
13   
14  from Convert import RatioConverter 
15   
16  # This is an example use of the RatioConverter superclass. See also 
17  # the documentation of Converter and RatioConverter in ConvertScreenlet.py, for  
18  # description of the variables, please. 
19 -class LengthConverter(RatioConverter):
20 """A converter which converts lengths between centimeters and inches.""" 21 22 # These fields must be defined in every screenlet: 23 # __name__: the name of the class 24 __name__ = 'LengthConverter' 25 # __title__: a short description to be shown in the menu and Options dialog 26 __title__ = 'cm / inches' 27 # author and version - not currently shown anywhere 28 __author__ = 'Vasek Potocek' 29 __version__ = '0.2' 30 31 # the number of fields and their captions 32 num_fields = 2 33 field_names = ['cm', 'in'] 34 35 # The relative weights of the fields. Here, we set 1 for cm and 2.54 for an 36 # inch, meaning one inch is a unit 2.54 times larger than a centimeter. Note 37 # that the values will be in an inversed ratio. 38 weights = [1, 2.54]
39