"""splash~~~~~~A splash screen for terminal applications."""fromblessedimportTerminalfromthurible.panelimportContent,Title
[docs]classSplash(Content,Title):"""Create a new :class:`thurible.Splash` object. This class creates a splash screen that can be displayed in the terminal. As a subclass of :class:`thurible.panel.Content` and :class:`thurible.panel.Title`, it can also take those parameters and has those public methods and properties. :param content: (Optional.) The text to display within the interior of the panel. :return: A :class:`thurible.Splash` object. :rtype: thurible.Splash :usage: To create a minimal :class:`thurible.Splash` object: .. testcode:: import thurible splash = thurible.Splash() To create a splash screen with the word "spam" in the middle of the screen: .. testsetup:: splash import thurible .. testcode:: splash splash = thurible.Splash('spam') Information on the sizing of :class:`thurible.Splash` objects can be found in the :ref:`sizing` section below. """# Magic methods.def__init__(self,content:str='',*args,**kwargs)->None:self.content=contentsuper().__init__(*args,**kwargs)def__str__(self)->str:"""Return a string that will draw the entire panel."""# Set up.lines=self.linesheight=self.inner_heightwidth=self.inner_widthy=self.inner_yx=self.inner_xresult=super().__str__()length_v=len(lines)y+=self._align_v(self.content_align_v,length_v,height)fori,lineinenumerate(lines):length_h=len(line)x_mod=self._align_h(self.content_align_h,length_h,width)result+=self.term.move(y+i,x+x_mod)+linereturnresult# Properties.@propertydeflines(self)->list[str]:"""The lines of text available to be displayed in the panel after they have been wrapped to fit the width of the interior of the panel. :return: A :class:`list` object containing each line of text as a :class:`str`. :rtype: list """returnself.content.split('\n')