本文整理汇总了Python中ubuntui.utils.Color.body方法的典型用法代码示例。如果您正苦于以下问题:Python Color.body方法的具体用法?Python Color.body怎么用?Python Color.body使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ubuntui.utils.Color
的用法示例。
在下文中一共展示了Color.body方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _build_widget
# 需要导入模块: from ubuntui.utils import Color [as 别名]
# 或者: from ubuntui.utils.Color import body [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'))
示例2: _build_widget
# 需要导入模块: from ubuntui.utils import Color [as 别名]
# 或者: from ubuntui.utils.Color import body [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'))
示例3: build_menuable_items
# 需要导入模块: from ubuntui.utils import Color [as 别名]
# 或者: from ubuntui.utils.Color import body [as 别名]
def build_menuable_items(self):
""" Builds a list of bundles available to install
"""
cols = []
for bundle in app.bundles:
bundle_metadata = bundle['Meta']['bundle-metadata']
try:
conjure_data = bundle['Meta']['extra-info/conjure-up']
name = conjure_data.get('friendly-name',
bundle['Meta']['id']['Name'])
except KeyError:
name = bundle['Meta']['id']['Name']
self.fname_id_map[name] = bundle
cols.append(
Columns(
[
("weight", 0.2, Color.body(
menu_btn(label=name,
on_press=self.done),
focus_map="menu_button focus")),
("weight", 0.3, Text(
bundle_metadata.get('Description',
'Needs a description'),
align="left"))
],
dividechars=1
)
)
cols.append(Padding.line_break(""))
return Pile(cols)
示例4: _build_widget
# 需要导入模块: from ubuntui.utils import Color [as 别名]
# 或者: from ubuntui.utils.Color import body [as 别名]
def _build_widget(self):
total_items = [
Padding.center_60(HR())
]
for spell in self.spells:
total_items.append(Padding.center_60(
Color.body(
menu_btn(label=spell,
on_press=self.submit),
focus_map='menu_button focus'
)
))
total_items.append(
Padding.center_60(HR()))
total_items.append(Padding.center_20(self._build_buttons()))
return Filler(Pile(total_items), valign='top')
示例5: _build_widget
# 需要导入模块: from ubuntui.utils import Color [as 别名]
# 或者: from ubuntui.utils.Color import body [as 别名]
def _build_widget(self):
total_items = [
Padding.center_60(Instruction("Choose a Cloud")),
Padding.center_60(HR())
]
for item in self.clouds:
total_items.append(Padding.center_60(
Color.body(
menu_btn(label=item,
on_press=self.submit),
focus_map='menu_button focus'
)
))
total_items.append(
Padding.center_60(HR()))
total_items.append(Padding.center_20(self._build_buttons()))
return Filler(Pile(total_items), valign='top')
示例6: build_menuable_items
# 需要导入模块: from ubuntui.utils import Color [as 别名]
# 或者: from ubuntui.utils.Color import body [as 别名]
def build_menuable_items(self):
""" Builds a list of bundles available to install
"""
bundles = self.common['config']['bundles']
cols = []
for bundle in bundles:
cols.append(
Columns(
[
("weight", 0.2, Color.body(
menu_btn(label=bundle['name'],
on_press=self.done),
focus_map="button_primary focus")),
("weight", 0.3, Text(bundle['summary'],
align="left"))
],
dividechars=1
)
)
cols.append(Padding.line_break(""))
return BoxAdapter(SimpleList(cols),
height=len(cols)+2)
示例7: build_widget
# 需要导入模块: from ubuntui.utils import Color [as 别名]
# 或者: from ubuntui.utils.Color import body [as 别名]
def build_widget(self):
""" Provides a rendered spell widget suitable for pile
"""
return Color.body(
menu_btn(label=self.spell["name"], on_press=self.cb, user_data=self.spell), focus_map="menu_button focus"
)