How to use the sen.tui.widgets.list.util.RowWidget function in sen

To help you get started, we’ve selected a few sen examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TomasTomecek / sen / sen / tui / views / image_info.py View on Github external
def _layers(self):
        self.walker.append(RowWidget([SelectableText("")]))
        self.walker.append(RowWidget([SelectableText("Layers", maps=get_map("main_list_white"))]))

        i = self.docker_image
        parent = i.parent_image
        layers = self.docker_image.layers
        index = 0

        if isinstance(parent, RootImage) and len(layers) > 0:  # pulled image, docker 1.10+
            for image in layers:
                self.walker.append(
                    RowWidget([LayerWidget(self.ui, image, index=index)])
                )
                index += 1
        else:
            self.walker.append(RowWidget([LayerWidget(self.ui, self.docker_image, index=index)]))
            while True:
github TomasTomecek / sen / sen / tui / widgets / list / util.py View on Github external
if hasattr(w, "set_map"):
                w.set_map('focus' if focus else 'normal')
        return urwid.AttrMap.render(self, size, focus)


class RowWidget(UnselectableRowWidget):
    def selectable(self):
        return True


class SingleTextRow(RowWidget):
    def __init__(self, text_markup, maps=None):
        super().__init__([SelectableText(text_markup, maps=maps)])


class ResponsiveRowWidget(RowWidget):
    def __init__(self, columns, attr="main_list_dg", focus_map=MAIN_LIST_FOCUS, dividechars=1):
        self.widgets = columns
        self.columns = ResponsiveColumns(columns, dividechars=dividechars)
        urwid.AttrMap.__init__(self, self.columns, attr, focus_map=focus_map)
github TomasTomecek / sen / sen / tui / views / container_info.py View on Github external
def __getitem__(self, pos):
        logger.debug("do widget for %s", pos)
        return RowWidget([SelectableText(str(pos))])
github TomasTomecek / sen / sen / tui / views / image_info.py View on Github external
def _containers(self):
        if not self.docker_image.containers():
            return
        self.walker.append(RowWidget([SelectableText("")]))
        self.walker.append(RowWidget([SelectableText("Containers", maps=get_map("main_list_white"))]))
        for container in self.docker_image.containers():
            self.walker.append(RowWidget([ContainerOneLinerWidget(self.ui, container)]))
github TomasTomecek / sen / sen / tui / views / image_info.py View on Github external
def _labels(self):
        if not self.docker_image.labels:
            return []
        data = []
        self.walker.append(RowWidget([SelectableText("")]))
        self.walker.append(RowWidget([SelectableText("Labels", maps=get_map("main_list_white"))]))
        for label_key, label_value in self.docker_image.labels.items():
            data.append([SelectableText(label_key, maps=get_map("main_list_green")), SelectableText(label_value)])
        self.walker.extend(assemble_rows(data, ignore_columns=[1]))
github TomasTomecek / sen / sen / tui / views / container_info.py View on Github external
def _resources(self):
        self.view_widgets.append(RowWidget([SelectableText("")]))
        self.view_widgets.append(RowWidget([SelectableText("Resource Usage",
                                                     maps=get_map("main_list_white"))]))
        cpu_g = ContainerInfoGraph("graph_lines_cpu_tips", "graph_lines_cpu")
        mem_g = ContainerInfoGraph("graph_lines_mem_tips", "graph_lines_mem")
        blk_r_g = ContainerInfoGraph("graph_lines_blkio_r_tips", "graph_lines_blkio_r")
        blk_w_g = ContainerInfoGraph("graph_lines_blkio_w_tips", "graph_lines_blkio_w")
        net_r_g = ContainerInfoGraph("graph_lines_net_r_tips", "graph_lines_net_r")
        net_w_g = ContainerInfoGraph("graph_lines_net_w_tips", "graph_lines_net_w")

        cpu_label = ColorText("CPU ", "graph_lines_cpu_legend")
        cpu_value = ColorText("0.0 %", "graph_lines_cpu_legend")
        mem_label = ColorText("Memory ", "graph_lines_mem_legend")
        mem_value = ColorText("0.0 %", "graph_lines_mem_legend")
        blk_r_label = ColorText("I/O Read ", "graph_lines_blkio_r_legend")
        blk_r_value = ColorText("0 B", "graph_lines_blkio_r_legend")
        blk_w_label = ColorText("I/O Write ", "graph_lines_blkio_w_legend")
github TomasTomecek / sen / sen / tui / widgets / tree.py View on Github external
def __getitem__(self, pos):
        return RowWidget([TreeNodeWidget(self.ui, pos)])
github TomasTomecek / sen / sen / tui / views / container_info.py View on Github external
def _image(self):
        if self.docker_container.image:
            self.view_widgets.append(RowWidget([SelectableText("")]))
            self.view_widgets.append(RowWidget([SelectableText("Image", maps=get_map("main_list_white"))]))
            self.view_widgets.append(RowWidget([LayerWidget(self.ui, self.docker_container.image)]))
github TomasTomecek / sen / sen / tui / views / container_info.py View on Github external
def _process_tree(self):
        top = self.docker_container.top().response
        logger.debug(top)
        if top:
            self.view_widgets.append(RowWidget([SelectableText("")]))
            self.view_widgets.append(RowWidget([SelectableText("Process Tree",
                                                         maps=get_map("main_list_white"))]))
            self.view_widgets.append(BoxAdapter(ProcessTree(top), len(top)))
github TomasTomecek / sen / sen / tui / views / container_info.py View on Github external
def _logs(self):
        operation = self.docker_container.logs(follow=False, lines=10)
        if operation.response:
            l = []
            l.append(RowWidget([SelectableText("")]))
            l.append(RowWidget([SelectableText("Logs", maps=get_map("main_list_white"))]))
            l.extend([RowWidget([SelectableText(x)]) for x in operation.response.splitlines()])
            self.view_widgets.extend(l)