@@ -467,7 +467,7 @@ def mousePressEvent(self, event):
467467 # update the recorded node positions.
468468 self ._node_positions .update ({n : n .xy_pos for n in selection })
469469
470- # show selection selection marquee.
470+ # show selection marquee.
471471 if self .LMB_state and not items :
472472 rect = QtCore .QRect (self ._previous_pos , QtCore .QSize ())
473473 rect = rect .normalized ()
@@ -893,7 +893,7 @@ def sceneMouseReleaseEvent(self, event):
893893
894894 def _validate_accept_connection (self , from_port , to_port ):
895895 """
896- Check if a pipe connection is allowed if there are a constrains set
896+ Check if a pipe connection is allowed if there are a constraints set
897897 on the ports.
898898
899899 Args:
@@ -903,27 +903,34 @@ def _validate_accept_connection(self, from_port, to_port):
903903 Returns:
904904 bool: true to allow connection.
905905 """
906+ accept_validation = []
907+
906908 to_ptype = to_port .port_type
907909 from_ptype = from_port .port_type
908910
909- to_data = self .accept_connection_types .get (to_port .node .type_ ) or {}
910- constraints = to_data .get (to_ptype , {}).get (to_port .name , {})
911- accept_data = constraints .get (from_port .node .type_ , {})
912-
913- accepted_pnames = accept_data .get (from_ptype )
914- if accepted_pnames :
915- if from_port .name in accepted_pnames :
916- return True
917- return False
918-
911+ # validate the start.
919912 from_data = self .accept_connection_types .get (from_port .node .type_ ) or {}
920913 constraints = from_data .get (from_ptype , {}).get (from_port .name , {})
921914 accept_data = constraints .get (to_port .node .type_ , {})
915+ accepted_pnames = accept_data .get (to_ptype , {})
916+ if constraints :
917+ if to_port .name in accepted_pnames :
918+ accept_validation .append (True )
919+ else :
920+ accept_validation .append (False )
922921
923- accepted_pnames = accept_data .get (to_ptype )
924- if accepted_pnames :
922+ # validate the end.
923+ to_data = self .accept_connection_types .get (to_port .node .type_ ) or {}
924+ constraints = to_data .get (to_ptype , {}).get (to_port .name , {})
925+ accept_data = constraints .get (from_port .node .type_ , {})
926+ accepted_pnames = accept_data .get (from_ptype , {})
927+ if constraints :
925928 if from_port .name in accepted_pnames :
926- return True
929+ accept_validation .append (True )
930+ else :
931+ accept_validation .append (False )
932+
933+ if False in accept_validation :
927934 return False
928935 return True
929936
0 commit comments