def invoke_hovered_widget(self):
        """Invoke widget over which the mouse hovers, if any.

        Administrative tasks are also performed depending on
        the type of the hovered widget and other specific
        details.
        """
        ### try retrieving the invoke method of the hovered
        ### widget
        try:
            method = self.hovered_widget.invoke

        ### this attribute error will be triggered by either
        ### of the following scenarios:
        ### 1) there's no 'invoke' method
        ### 2) the hovered_widget attribute is None, it also
        ###    doesn't have a 'invoke' method
        ### in any of these cases, perform extra checks to
        ### determine what to do

        except AttributeError:

            ## if the hovered widget exists, check if the
            ## hovered widget is a top menu, in which case
            ## make it the active menu and perform other
            ## extra tasks

            if self.hovered_widget:

                if self.is_top_menu(self.hovered_widget):

                    self.active_menu = self.hovered_widget

                    # although the hovered widget would
                    # have its body automatically
                    # repositioned anyway, when visiting
                    # the 'manage_hovered_widget', such
                    # visit would happen only in the next
                    # loop, after executing the 'draw'
                    # method, which would draw the body
                    # even if it wasn't in the right
                    # position;
                    #
                    # to prevent this, we reposition the
                    # body in advance here
                    self.hovered_widget.reposition_body()

                    # if drawing the active branch, we
                    # stop doing so and collapse it
                    #
                    # we also update a related control
                    # variable

                    if self.is_drawing_active_branch():

                        self.active_menu = None

                        self.draw.remove(self.draw_active_branch)

                        (self.hovered_widget.collapse_self_and_children())

                        self.was_top_menu_expanded = False

                    # otherwise we start doing so by
                    # inserting the active branch drawing
                    # method in the drawing list (insert it
                    # just before the last item)
                    #
                    # we also update a related control
                    # variable

                    else:

                        (
                            self.draw.insert(
                                -1,
                                self.draw_active_branch,
                            )
                        )

                        self.was_top_menu_expanded = True

            ## otherwise, if click was out of any meaningful
            ## area, focus the loop holder

            elif self.is_clicking_out():
                self.focus_loop_holder()

        ### if however, the method exists, try executing
        ### it, performing extra administrative tasks

        else:

            ### first of all, log the call we are about
            ### to attemp

            logger.info(
                "About to invoke menu command: "
                + self.hovered_widget.get_formatted_tree()
            )

            ### try executing the method
            try:
                method()

            ### if a manager switch exception is raised,
            ### it means we are about to give control of
            ### the application loop to another object,
            ### so we collapse the active menu tree and
            ### reraise the exception so it is caught
            ### and handled elsewhere

            except SwitchLoopException:

                self.collapse_active_menu()
                raise  # reraises the SwitchLoopException

            ### otherwise we just give focus back to
            ### the loop holder saved in this menu
            ### (this also causes the active menu tree
            ### to be collapsed)
            else:
                self.focus_loop_holder()
Invoke widget over which the mouse hovers, if any.

        Administrative tasks are also performed depending on
        the type of the hovered widget and other specific
        details.
        
nodezator/menu/hover.py