# HG changeset patch # User Laurent Bessard # Date 1386270207 -3600 # Node ID 8b0a7eceb76d2f3edee83ea2848f342a4b3e84f2 # Parent 10ac2b18437bf27ab2a3acf3a973c534ba23e746 Fixed bug with edge and storage parameters in contact and coil not loaded in file saved with older version diff -r 10ac2b18437b -r 8b0a7eceb76d editors/Viewer.py --- a/editors/Viewer.py Thu Dec 05 18:08:31 2013 +0100 +++ b/editors/Viewer.py Thu Dec 05 20:03:27 2013 +0100 @@ -105,6 +105,7 @@ specific_values.connectors) return powerRailCreationFunction +NEGATED_VALUE = lambda x: x if x is not None else False MODIFIER_VALUE = lambda x: x if x is not None else 'none' CONTACT_TYPES = {(True, "none"): CONTACT_REVERSE, @@ -112,7 +113,7 @@ (False, "falling"): CONTACT_FALLING} def contactCreationFunction(viewer, id, specific_values): - contact_type = CONTACT_TYPES.get((specific_values.negated, + contact_type = CONTACT_TYPES.get((NEGATED_VALUE(specific_values.negated), MODIFIER_VALUE(specific_values.edge)), CONTACT_NORMAL) return LD_Contact(viewer, contact_type, specific_values.name, id) @@ -124,7 +125,7 @@ (False, "falling", "none"): COIL_FALLING} def coilCreationFunction(viewer, id, specific_values): - coil_type = COIL_TYPES.get((specific_values.negated, + coil_type = COIL_TYPES.get((NEGATED_VALUE(specific_values.negated), MODIFIER_VALUE(specific_values.edge), MODIFIER_VALUE(specific_values.storage)), COIL_NORMAL)