editors/Viewer.py
changeset 1381 8b0a7eceb76d
parent 1377 cc8f9177d41c
child 1406 82db84fe88ea
--- 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)