Skip to content

Commit

Permalink
added more units
Browse files Browse the repository at this point in the history
  • Loading branch information
nibarAhmed committed Feb 3, 2023
1 parent 1297abb commit 29d0dd5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion addon/globalPlugins/NVDAUnitConverter/Unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ class Unit(str, Enum):
#this enum is used to store units. Each unit will also have diferent values that indicates from what they can be converted to.
farenheightToCelsius="farenheight to celsius",
celsiusToFarenheight="celsius to farenheight"
OunceToGram="ounce to gram"
gramToOunce="gram to ounce"
footToMeter="foot to meter"
meterToFoot="meter to foot"
def getAllValues():
values=[]
for i in Unit:
Expand All @@ -16,4 +20,12 @@ def convert(unit, value):
if Unit.celsiusToFarenheight.value ==unit:
return (value*9/5)+32
elif Unit.farenheightToCelsius.value==unit:
return round ((value-32)*5/9, 3)
return round ((value-32)*5/9, 3)
elif Unit.OunceToGram.value==unit:
return round(value*28.35, 3)
elif Unit.gramToOunce.value==unit:
return round(value/28.35, 3)
elif Unit.footToMeter.value==unit:
return round(value/3.281, 3)
elif Unit.meterToFoot.value==unit:
return round(value*3.281, 3)

0 comments on commit 29d0dd5

Please sign in to comment.