# Path: sen/tui/widgets/util.py
# class SelectableText(ColorTextMixin, AdHocAttrMap):
#     def __init__(self, text, maps=None):
#         maps = maps or get_map()
#         super().__init__(urwid.Text(text, align="left", wrap="clip"), maps)
# 
# def get_map(defult="main_list_dg"):
#     return {"normal": defult, "focus": MAIN_LIST_FOCUS}


import logging
from sen.tui.widgets.util import SelectableText, get_map
"""




logger = logging.getLogger(__name__)


class ContainerStatusWidget(SelectableText):
    def __init__(self, docker_container, nice_status=True):
        markup, attr = get_container_status_markup(docker_container, nice_status=nice_status)
        super().__init__(markup, attr)


class ContainerOneLinerWidget(SelectableText):
    def __init__(self, ui, docker_container):
        self.ui = ui
        self.docker_container = docker_container
        super().__init__(get_basic_container_markup(docker_container))


def get_detailed_container_row(docker_container):
    row = []
    container_id = SelectableText(docker_container.short_id)
    row.append(container_id)

    commands = docker_container.command.split("\n")
    command_str = commands[0]
    if len(commands) > 0:
        command_str += "..."

# Path: sen/tui/widgets/util.py
# class SelectableText(ColorTextMixin, AdHocAttrMap):
#     def __init__(self, text, maps=None):
#         maps = maps or get_map()
#         super().__init__(urwid.Text(text, align="left", wrap="clip"), maps)
# 
# def get_map(defult="main_list_dg"):
#     return {"normal": defult, "focus": MAIN_LIST_FOCUS}


# Path: sen/tui/chunks/container.py
import logging
from sen.tui.widgets.util import SelectableText, get_map

"""




logger = logging.getLogger(__name__)


class ContainerStatusWidget(SelectableText):
    def __init__(self, docker_container, nice_status=True):
        markup, attr = get_container_status_markup(docker_container, nice_status=nice_status)
        super().__init__(markup, attr)


class ContainerOneLinerWidget(SelectableText):
    def __init__(self, ui, docker_container):
        self.ui = ui
        self.docker_container = docker_container
        super().__init__(get_basic_container_markup(docker_container))


def get_detailed_container_row(docker_container):
    row = []
    container_id = SelectableText(docker_container.short_id)
    row.append(container_id)

    commands = docker_container.command.split("\n")
    command_str = commands[0]
    if len(commands) > 0:
        command_str += "..."

    command = SelectableText(command_str, get_map(defult="main_list_ddg"))