本文整理汇总了Python中ubuntui.utils.Padding.center_80方法的典型用法代码示例。如果您正苦于以下问题:Python Padding.center_80方法的具体用法?Python Padding.center_80怎么用?Python Padding.center_80使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ubuntui.utils.Padding
的用法示例。
在下文中一共展示了Padding.center_80方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _build_widget
# 需要导入模块: from ubuntui.utils import Padding [as 别名]
# 或者: from ubuntui.utils.Padding import center_80 [as 别名]
def _build_widget(self):
total_items = []
if len(self.clouds) > 0:
total_items.append(Text("Choose a Cloud"))
total_items.append(HR())
for item in self.clouds:
total_items.append(
Color.body(
menu_btn(label=item,
on_press=self.submit),
focus_map='menu_button focus'
)
)
total_items.append(Padding.line_break(""))
total_items.append(Text("Configure a New Cloud"))
total_items.append(HR())
for item in ['localhost', 'maas']:
total_items.append(
Color.body(
menu_btn(label=item,
on_press=self.submit),
focus_map='menu_button focus'
)
)
return Padding.center_80(Filler(Pile(total_items), valign='top'))
示例2: _build_widget
# 需要导入模块: from ubuntui.utils import Padding [as 别名]
# 或者: from ubuntui.utils.Padding import center_80 [as 别名]
def _build_widget(self):
total_items = []
if len(self.controllers) > 0:
total_items.append(HR())
cdict = defaultdict(lambda: defaultdict(list))
for cname, d in self.controllers.items():
cdict[d['cloud']][d.get('region', None)].append(cname)
for cloudname, cloud_d in sorted(cdict.items()):
total_items.append(Color.label(
Text(" {}".format(cloudname))))
for regionname, controllers in cloud_d.items():
for controller in sorted(controllers):
label = " {}".format(controller)
if regionname:
label += " ({})".format(regionname)
total_items.append(
Color.body(
menu_btn(label=label,
on_press=partial(self.submit,
controller)),
focus_map='menu_button focus'
)
)
total_items.append(Padding.line_break(""))
total_items.append(Padding.line_break(""))
total_items.append(HR())
total_items.append(
Color.body(
menu_btn(label="Create New",
on_press=self.handle_create_new),
focus_map='menu_button focus'
)
)
return Padding.center_80(Filler(Pile(total_items), valign='top'))
示例3: __init__
# 需要导入模块: from ubuntui.utils import Padding [as 别名]
# 或者: from ubuntui.utils.Padding import center_80 [as 别名]
def __init__(self, app, steps, cb=None):
""" init
Arguments:
cb: process step callback
"""
self.app = app
self.table = Table()
self.cb = cb
self.steps_queue = steps
for step_model in self.steps_queue:
step_widget = self.add_step_widget(step_model)
self.table.addColumns(
step_model.path,
[
('fixed', 3, step_widget['icon']),
step_widget['description'],
]
)
# Need to still prompt for the user to submit
# even though no questions are asked
if len(step_widget['additional_input']) == 0:
self.table.addRow(
Padding.right_20(
Color.button_primary(
submit_btn(on_press=self.submit,
user_data=(step_model, step_widget)),
focus_map='button_primary focus')), False)
for i in step_widget['additional_input']:
self.table.addRow(Padding.line_break(""), False)
self.table.addColumns(
step_model.path,
[
('weight', 0.5, Padding.left(i['label'], left=5)),
('weight', 1, Color.string_input(
i['input'],
focus_map='string_input focus')),
], force=True
)
self.table.addRow(
Padding.right_20(
Color.button_primary(
submit_btn(
on_press=self.submit,
user_data=(step_model, step_widget)),
focus_map='button_primary focus')), False)
self.table.addRow(Padding.line_break(""), False)
self.table.addRow(Padding.center_20(
Color.button_primary(
done_btn(on_press=self.done, label="View Summary"),
focus_map='button_primary focus')))
super().__init__(Padding.center_80(self.table.render()))
示例4: __init__
# 需要导入模块: from ubuntui.utils import Padding [as 别名]
# 或者: from ubuntui.utils.Padding import center_80 [as 别名]
def __init__(self, error):
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.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"))
示例5: __init__
# 需要导入模块: from ubuntui.utils import Padding [as 别名]
# 或者: from ubuntui.utils.Padding import center_80 [as 别名]
def __init__(self, app):
self.app = app
self.deployed = {}
self.unit_w = None
self.table = Table()
super().__init__(Padding.center_80(self.table.render()))