コード例 #1
0
    def _return_popup(
        self,
        title: AnyStr,
        content: Widget,
        size: Tuple = (500, 100),
        size_hint=(None, None)
    ) -> Popup:
        """
            This method is for creating a unified Popup which will have a similar design
            throughout the application

        :param title: Title of the popup
        :type title: str
        :param content: content to be put in the popup
        :type content: Widget
        :param size: size of the Popup
        :type size: tuple
        :param size_hint: size hint of the Popup wrt to the parent
        :type size_hint: tuple; default=(500, 100)
        :return: the generated Popup
        :rtype: Popup
        """
        popup = Popup(title=f"{self.constants.name} - {title}",
                      content=content,
                      size=size,
                      size_hint=size_hint,
                      title_align='center')

        # popup_background = ModalView()
        # popup_background.add_widget(Image(source=self.constants.rocket_image))
        # popup.background = self.constants.rocket_image
        popup.background_color = [0, 255, 220, 0.9]
        popup.title_size = 18  # size in sp 255 0 120
        popup.title_color = [1, 255, 0, 1]  # rgba (pink)
        popup.separator_color = [1, 0, 255, 255]  # rgba (cyan)
        popup.separator_height = 5

        return popup