本文整理匯總了Python中cloudinstall.ui.utils.Color類的典型用法代碼示例。如果您正苦於以下問題:Python Color類的具體用法?Python Color怎麽用?Python Color使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Color類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _build_widget
def _build_widget(self, **kwargs):
total_items = []
for _item in self.radio_items.keys():
desc = Color.string_input(
Text(" {}".format(
self.radio_items[_item][1])),
focus_map='string_input focus')
total_items.append(
Color.string_input(self.radio_items[_item][0],
focus_map='string_input focus'))
total_items.append(AttrWrap(desc, 'input'))
total_items.append(Divider('-'))
self.input_lbox = ListBox(SimpleListWalker(total_items[:-1]))
self.add_buttons()
self.container_box_adapter = BoxAdapter(self.input_lbox,
len(total_items))
self.container_lbox = ListBox(
[self.container_box_adapter,
Divider(),
self.btn_pile])
return LineBox(
BoxAdapter(self.container_lbox,
height=len(total_items) + 3),
title=self.title)
示例2: __init__
def __init__(self):
w = []
w.append(Color.frame_header(
Text("Ubuntu Openstack Installer - Software Installation")))
w.append(Color.frame_subheader(Text(
'(Q)uit', align='center')))
w = Pile(w)
super().__init__(w)
示例3: __init__
def __init__(self):
help_text = [
Padding.line_break(""),
Text("OpenStack Installer - Help \u21C5 Scroll (ESC) Close",
align="center"),
Divider('-', 1, 1),
Text("For full documentation, please refer to "
"https://help.ubuntu.com/lts/clouddocs/installer/"),
Color.header_title(Text("Overview")),
Divider('-'),
Text("""
- Header
The header shows a few common command keys for quick reference.
- Main Table
The main table has a row for each Juju service in the current environment,
updated every ten seconds. Each row will contain a status icon indicator, agent
state, ip address, machine type, and hardware specifications.
There may also be an additional status field with information in the event of
provisioning errors or additional status notifications.
- Footer
The footer displays a status message, and the URLs for the two web dashboards
installed, one for OpenStack Horizon and the other for the Juju GUI.
"""),
Color.header_title(Text("Command Reference")),
Divider('-'),
Text("""
- (R/F5) refreshes the displayed state immediately
- (A/a/F6) brings up a dialog box for adding additional units. This is how to
add compute units or a storage service. This dialog takes care of launching
required dependencies, so for example, launching swift here will add a
swift-proxy service and enough swift-storage nodes to meet the replica
criterion (currently 3).
- '(H/h/?)' displays this help screen.
- 'q' quits.
"""),
Color.header_title(Text("Troubleshooting")),
Divider('-'),
Text("""
The juju commands used to deploy the services listed are logged in
~/.cloud-install/commands.log
Note: In a multi-install, MAAS may be unable to find machines that match the
default constraints set for one of the services the installer deploys. This
will be shown in the table under the service's heading, along with detail
about what those constraints were.
""")]
w = Padding.center_79(SimpleList(help_text))
super().__init__(w)
示例4: __init__
def __init__(self):
self.text = Text(self.TITLE_TEXT)
self.widget = Color.frame_header(self.text)
w = [
Color.frame_header(self.widget),
Color.frame_subheader(Text(
'(Q)uit', align='center'))
]
super().__init__(Pile(w))
示例5: _build_buttons
def _build_buttons(self):
buttons = [
Color.button_primary(
Button("Confirm", self.submit),
focus_map='button_primary focus'),
Color.button_secondary(
Button("Cancel", self.cancel),
focus_map='button_secondary focus')
]
return Pile(buttons)
示例6: _build_node_waiting
def _build_node_waiting(self):
""" creates a loading screen if nodes do not exist yet """
text = [Padding.line_break(""), Text(self.message, align="center"), Padding.line_break("")]
load_box = [
Color.pending_icon_on(Text("\u2581", align="center")),
Color.pending_icon_on(Text("\u2582", align="center")),
Color.pending_icon_on(Text("\u2583", align="center")),
Color.pending_icon_on(Text("\u2584", align="center")),
Color.pending_icon_on(Text("\u2585", align="center")),
Color.pending_icon_on(Text("\u2586", align="center")),
Color.pending_icon_on(Text("\u2587", align="center")),
Color.pending_icon_on(Text("\u2588", align="center")),
]
# Add loading boxes
random.shuffle(load_box)
loading_boxes = []
loading_boxes.append(("weight", 1, Text("")))
for i in load_box:
loading_boxes.append(("pack", load_box[random.randrange(len(load_box))]))
loading_boxes.append(("weight", 1, Text("")))
loading_boxes = Columns(loading_boxes)
return Filler(Pile(text + [loading_boxes]), valign="middle")
示例7: _build_buttons
def _build_buttons(self):
buttons = [
Color.button_secondary(
cancel_btn(label="Quit", on_press=self.cancel),
focus_map="button_secondary focus")
]
return Pile(buttons)
示例8: _build_widget
def _build_widget(self, **kwargs):
total_items = [
Padding.center_60(Text(self.title, align="center")),
Padding.center_60(
Divider("\N{BOX DRAWINGS LIGHT HORIZONTAL}", 1, 1))
]
if self.input_items:
for item in self.input_items:
key = item[0]
caption = item[1]
try:
mask = item[2]
except:
mask = None
self.input_selection[key] = EditInput(caption="",
mask=mask)
col = Columns(
[
("weight", 0.4, Text(caption, align="right")),
Color.string_input(self.input_selection[key],
focus_map="string_input focus")
]
)
total_items.append(Padding.center_60(col))
total_items.append(
Padding.center_60(
Divider("\N{BOX DRAWINGS LIGHT HORIZONTAL}", 1, 1)))
total_items.append(Padding.center_20(self._build_buttons()))
return Filler(Pile(total_items), valign='middle')
示例9: _build_status_extra
def _build_status_extra(self):
return Color.frame_footer(
Pile([
self._horizon_url,
self._jujugui_url,
self._openstack_rel,
self._status_line
]))
示例10: _build_buttons
def _build_buttons(self):
buttons = [
Padding.line_break(""),
Color.button_secondary(
Button("Quit", self.cancel),
focus_map='button_secondary focus'),
]
return Pile(buttons)
示例11: update
def update(self):
if self.show_add_units:
add_unit_string = '(A)dd Services \N{BULLET}'
else:
add_unit_string = ''
tw = Color.frame_subheader(Text(add_unit_string + ' (H)elp \N{BULLET} '
'(R)efresh \N{BULLET} (Q)uit',
align='center'))
self.pile.contents[1] = (tw, self.pile.options())
示例12: _build_status_extra
def _build_status_extra(self):
col = Columns([
('weight', 0.3, self._horizon_url),
('weight', 0.3, self._jujugui_url),
self._openstack_rel
], dividechars=1)
return Color.frame_footer(Pile([
col, self._status_line
]))
示例13: update
def update(self):
if self.show_add_units:
add_unit_string = "(A)dd Services \N{BULLET}"
else:
add_unit_string = ""
tw = Color.frame_subheader(
Text(add_unit_string + " (H)elp \N{BULLET} " "(R)efresh \N{BULLET} (Q)uit", align="center")
)
self.pile.contents[1] = (tw, self.pile.options())
示例14: _build_widget
def _build_widget(self):
total_items = [
Padding.center_60(Text(self.title, align="center")),
Padding.center_60(
Divider("\N{BOX DRAWINGS LIGHT HORIZONTAL}", 1, 1))
]
for item in self.radio_items.keys():
opt, desc = self.radio_items[item]
col = Columns(
[
("weight", 0.4, opt),
Color.body(Text(desc))
], dividechars=1)
total_items.append(Padding.center_60(col))
total_items.append(
Padding.center_60(
Divider("\N{BOX DRAWINGS LIGHT HORIZONTAL}", 1, 1)))
total_items.append(Padding.center_20(self._build_buttons()))
return Filler(Pile(total_items), valign='middle')
示例15: __init__
def __init__(self, error):
log.debug("showing error view for: {}".format(error))
bug_url = ("https://github.com/Ubuntu-Solutions-Engineering"
"/openstack-installer/issues/new")
body = [
Padding.center_60(
Text("Oops, there was a problem with your install:",
align="center")),
Padding.center_95(
Divider("\N{BOX DRAWINGS LIGHT HORIZONTAL}", 1, 1)),
Padding.center_85(Text("Reason:")),
Padding.center_80(Color.error_major(Text(error))),
Padding.line_break(""),
Padding.center_85(
Text("Please file a bug with the above output and of "
"~/.cloud-install/*.log at {}".format(bug_url))),
Padding.line_break(""),
Padding.center_95(
Divider("\N{BOX DRAWINGS LIGHT HORIZONTAL}", 1, 1)),
Padding.center_20(self._build_buttons())
]
super().__init__(Filler(Pile(body), valign="middle"))