def trigger_defining_segment(self, socket_a, mouse_pos=None):
        """Prep to define new line segment.

        Parameters
        ==========
        socket_a (reference to socket instance)
            reference of socket from where line is being
            defined.
        mouse_pos (2-tuple of integers or None)
            if not None, represents position of mouse on screen.
        """
        ### store socket reference
        self.socket_a = socket_a

        ### snap the magnet point to the mouse (if the mouse position is not
        ### available, we use socket a, cause in this circumnstance we assume
        ### they should be almost at the same position)

        self.magnet_point.update(

            mouse_pos
            if mouse_pos

            else socket_a.rect.center

        )

        ### placeholder attributes to hold socket to which we'd like to
        ### connect socket a

        self.socket_b = None
        self.socket_b_candidate = None

        ### assing function to retrieve compatible sockets
        ### (i. e., if socket_a is an output socket, must retrieve
        ### input sockets and vice-versa)

        self.get_compatible_sockets = (

            get_connectable_input_sockets
            if isinstance(socket_a, OutputSocket)

            else get_output_sockets

        )

        ### change window manager state to draw temp line
        ### between socket and
        APP_REFS.wm.set_state("segment_definition")

        ### depending on the socket detection graphics, make it so the
        ### mouse isn't visible

        if USER_PREFS['SOCKET_DETECTION_GRAPHICS'] != 'assisting_line':
            SERVICES_NS.set_mouse_visibility(False)

        ### restart the loop
        raise ContinueLoopException
Prep to define new line segment.

        Parameters
        ==========
        socket_a (reference to socket instance)
            reference of socket from where line is being
            defined.
        mouse_pos (2-tuple of integers or None)
            if not None, represents position of mouse on screen.
        
nodezator/graphman/socketparenthood/action.py