MCPcopy Index your code
hub / github.com/rawpython/remi / set_value

Method set_value

editor/editor_widgets.py:996–1012  ·  view source on GitHub ↗

The value have to be in the form '10px' or '10%', so numeric value plus measure unit

(self, value)

Source from the content-addressed store, hash-verified

994 self.on_attribute_changed(self, new_size)
995
996 def set_value(self, value):
997 """The value have to be in the form '10px' or '10%', so numeric value plus measure unit
998 """
999 v = 0
1000 measure_unit = 'px'
1001 if not value is None:
1002 try:
1003 v = int(float(value.replace('px', '')))
1004 except ValueError:
1005 try:
1006 v = int(float(value.replace('%', '')))
1007 measure_unit = '%'
1008 except ValueError:
1009 pass
1010 self.numInput.set_value(v)
1011 self.dropMeasureUnit.set_value(measure_unit)
1012 self.set_valid(not value is None)
1013
1014
1015class EditorAttributeInputColor(EditorAttributeInputBase):

Callers

nothing calls this directly

Calls 2

set_validMethod · 0.80
set_valueMethod · 0.45

Tested by

no test coverage detected