<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_menu(self, menu):
 """ Sets the Widget menu. :param menu: Menu. :type menu: QMenu :return: Method success. :rtype: bool """


        self.__menu = menu

        if not self.parent():
            return False

        parent = [parent for parent in umbra.ui.common.parents_walker(self)].pop()
        for action in self.__menu.actions():
            not action.shortcut().isEmpty() and parent.addAction(action)
        return True