Broken project to implement a cross-protocol browser in textual
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from textual.widgets import Static

class Plaintext(Static):
    """Plaintext widget."""

    def __init__(self, fp, id):
        super().__init__(id=id)
        self.addlines(fp)

    def addlines(self, fp):
        for lin in fp:
            line = lin
            if type(line) is bytes:
                line = line.decode("UTF-8")
            line = line.rstrip("\r\n")
            self.mount(Static(line, markup=False))