def __init__(self,
                 message=DEFAULT_ERROR_MESSAGE,
                 details=None,
                 label_markup=True,
                 auto_dismiss=False,
                 **kwargs):
        kwargs.setdefault('size', (600, 500))
        kwargs.setdefault('title', POPUP_TITLE)

        bl = BoxLayout(orientation='vertical')
        la = Label(text=message,
                   size_hint_y=0.3,
                   markup=label_markup,
                   halign='center')
        la.bind(on_ref_press=open_hyperlink)
        la.text_size = (
            550, None
        )  # Enable wrapping when text inside label is over 550px wide
        bl.add_widget(la)

        button = Button(text="Ok",
                        size_hint=(None, None),
                        height=40,
                        width=150,
                        pos_hint={'center_x': 0.5})
        button.bind(on_release=self.dismiss)

        if details:
            sv = ScrollView(size_hint=(1, 0.7),
                            bar_width=12,
                            scroll_type=['bars', 'content'],
                            bar_inactive_color=(0.5, 0.5, 0.5, 0.7))

            ti = TextInput(text=details, size_hint=(1, None))
            ti.copy(data=details)
            ti.bind(minimum_height=ti.setter('height'))
            sv.add_widget(ti)
            bl.add_widget(sv)

        if not auto_dismiss:
            bl.add_widget(button)

        super(ErrorPopup, self).__init__(content=bl,
                                         size_hint=(None, None),
                                         auto_dismiss=auto_dismiss,
                                         **kwargs)
class Detail(Screen):
    title = StringProperty()

    def __init__(self, content, **kwargs):
        """
        说明: 详情界面
        args{
            content:要显示的内容字典(如果key为图片则会显示图片)
            allow_show_list:允许显示的key
            back_event: 界面返回事件
        }
        return:
        """
        self.content = content
        self.copy = None
        self.snackbar = Snackbar(duration=1.5)  #提示窗
        super().__init__(**kwargs)

        # 添加标题,和基础相关信息
        self.ids.boxs.add_widget(
            Content(text="[b]{}[/b]".format(content["内容"]),
                    font_style="H6",
                    halign="center"))
        self.ids.boxs.add_widget(
            Content(text="[拼音]:[/font_family]{}\n[含义]:\n[i]{}[/i]".format(
                content["拼音"],
                content["含义"],
            ), ))
        if "例句" in content and content["例句"]:
            self.ids.boxs.add_widget(
                Content(text="[例句]:[i]{}[/i]".format(content["例句"])))
        if "图片" in content and content["图片"]:
            self.ids.boxs.add_widget(Picture(source=content["图片"]))

        show_list = ["近义词", "反义词"]
        text = ""
        for name in show_list:
            if name in content and content[name]:
                ts = content[name].split(" ")
                cc = ""
                for s in ts:
                    if s:
                        cc += "[u]{}[/u]  ".format(s)
                text += "[{}]:\n[i]{}[/i]\n".format(name, cc)

        if text:
            if text[-1] == "\n":
                text = text[:-1]
            self.ids.boxs.add_widget(Content(text="{}".format(text)))
        show_list = ["出处", "相关典故"]
        text = ""
        for name in show_list:
            if name in content and content[name]:
                text += "[{}]:\n[i]{}[/i]\n".format(
                    name, content[name].replace("\t", ""))

        if text:
            if text[-1] == "\n":
                text = text[:-1]
            self.ids.boxs.add_widget(Content(text="{}".format(text)))

    def CopyToClipboard(self):
        if not self.copy:
            self.copy = TextInput()
        data = self.content["内容"] + "\n"
        show_list = ["拼音", "含义", "例句", "出处", "相关典故", "近义词", "反义词"]
        for show in show_list:
            if show in self.content and self.content[show]:
                data += "{}:{}\n".format(show, self.content[show])
        self.copy.copy(data)
        self.snackbar.text = "复制成功"
        self.snackbar.show()