MCPcopy Create free account
hub / github.com/LabPy/lantz / request_new_units

Function request_new_units

lantz/ui/widgets.py:739–754  ·  view source on GitHub ↗

Ask for new units using a dialog box and return them. :param current_units: current units or magnitude. :type current_units: Quantity

(current_units)

Source from the content-addressed store, hash-verified

737
738
739def request_new_units(current_units):
740 """Ask for new units using a dialog box and return them.
741
742 :param current_units: current units or magnitude.
743 :type current_units: Quantity
744
745 """
746 new_units = UnitInputDialog.get_units(current_units)
747 if new_units is None:
748 return None
749
750 try:
751 return Q_(1, new_units)
752 except LookupError:
753 # cannot parse units
754 return None
755
756
757@register_wrapper

Callers 1

keyPressEventMethod · 0.85

Calls 1

get_unitsMethod · 0.45

Tested by

no test coverage detected