當前位置: 首頁>>代碼示例>>Python>>正文


Python Color.success_icon方法代碼示例

本文整理匯總了Python中cloudinstall.ui.utils.Color.success_icon方法的典型用法代碼示例。如果您正苦於以下問題:Python Color.success_icon方法的具體用法?Python Color.success_icon怎麽用?Python Color.success_icon使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cloudinstall.ui.utils.Color的用法示例。


在下文中一共展示了Color.success_icon方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _build_node_columns

# 需要導入模塊: from cloudinstall.ui.utils import Color [as 別名]
# 或者: from cloudinstall.ui.utils.Color import success_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.success_icon方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。