当前位置: 首页>>代码示例>>Python>>正文


Python Color.error_icon方法代码示例

本文整理汇总了Python中cloudinstall.ui.utils.Color.error_icon方法的典型用法代码示例。如果您正苦于以下问题:Python Color.error_icon方法的具体用法?Python Color.error_icon怎么用?Python Color.error_icon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cloudinstall.ui.utils.Color的用法示例。


在下文中一共展示了Color.error_icon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _build_node_columns

# 需要导入模块: from cloudinstall.ui.utils import Color [as 别名]
# 或者: from cloudinstall.ui.utils.Color import error_icon [as 别名]
    def _build_node_columns(self, unit, charm_class):
        """ builds columns of node status """
        node_cols = []

        status_txt = "{:20}".format("[{}]".format(unit.agent_state))

        # unit.agent_state may be "pending" despite errors elsewhere,
        # so we check for error_info first.
        # if the agent_state is "error", _detect_errors returns that.
        error_info = self._detect_errors(unit, charm_class)

        if error_info:
            status = Color.error_icon(Text("\N{TETRAGRAM FOR FAILURE} "))
            if unit.agent_state != "error":
                status_txt = "{:20}".format("[{} (error)]" "".format(unit.agent_state))
        elif unit.agent_state == "pending":
            pending_status = [
                Color.pending_icon(Text("\N{CIRCLED BULLET} ")),
                Color.pending_icon(Text("\N{CIRCLED WHITE BULLET} ")),
                Color.pending_icon_on(Text("\N{FISHEYE} ")),
            ]
            status = random.choice(pending_status)
        elif unit.agent_state == "installed":
            status = Color.pending_icon(Text("\N{HOURGLASS} "))
        elif unit.agent_state == "started":
            status = Color.success_icon(Text("\u2713 "))
        elif unit.agent_state == "stopped":
            status = Color.error_icon(Text("\N{BLACK FLAG} "))
        elif unit.agent_state == "down":
            status = Color.error_icon(Text("\N{DOWNWARDS BLACK ARROW} "))
        else:
            # NOTE: Should not get here, if we do make sure we account
            # for that error type above.
            status = Color.error_icon(Text(unit.agent_state))
        node_cols.append(("pack", status))
        node_cols.append(("pack", Text(status_txt)))
        if unit.public_address:
            node_cols.append(("pack", Text("{0:<12}".format(unit.public_address))))
        elif error_info:
            node_cols.append(("pack", Text("{:<12}".format("Error"))))
        else:
            node_cols.append(("pack", Text("{:<12}".format("IP Pending"))))

        if error_info:
            infos = [("pack", Text(" | {}".format(error_info)))]
        else:
            hw_text = Text([" | "] + self._get_hardware_info(unit))

            if "glance-simplestreams-sync" in unit.unit_name:
                status_oneline = get_sync_status().replace("\n", " - ")
                sync_text = Text("   " + status_oneline)
                infos = [hw_text, sync_text]
            else:
                infos = [hw_text]

        if self.config.getopt("show_logs"):
            log_text = Text([("label", self.get_log_text(unit.unit_name))])
            infos.append(log_text)

        node_cols.append(Pile(infos))

        return Columns(node_cols)
开发者ID:kavinsivak,项目名称:openstack-installer,代码行数:64,代码来源:gui.py


注:本文中的cloudinstall.ui.utils.Color.error_icon方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。