本文整理汇总了Python中ubuntui.utils.Padding.center_90方法的典型用法代码示例。如果您正苦于以下问题:Python Padding.center_90方法的具体用法?Python Padding.center_90怎么用?Python Padding.center_90使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ubuntui.utils.Padding
的用法示例。
在下文中一共展示了Padding.center_90方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from ubuntui.utils import Padding [as 别名]
# 或者: from ubuntui.utils.Padding import center_90 [as 别名]
def __init__(self, common, cb):
self.common = common
self.cb = cb
_pile = [
Padding.center_90(Text("Choose a solution to get started:")),
Padding.center_90(Divider("\N{BOX DRAWINGS LIGHT HORIZONTAL}")),
Padding.center_90(self.build_menuable_items()),
Padding.line_break(""),
Padding.center_20(self.buttons())
]
super().__init__(ListBox(_pile))
示例2: build_widgets
# 需要导入模块: from ubuntui.utils import Padding [as 别名]
# 或者: from ubuntui.utils.Padding import center_90 [as 别名]
def build_widgets(self):
readme_files = glob(os.path.join(app.config['spell-dir'], 'README.*'))
if len(readme_files) == 0:
self.readme_w = Text("No README found for bundle.")
else:
readme_file = readme_files[0]
if len(readme_files) != 1:
utils.warning("Unexpected: {} files matching README.*"
"- using {}".format(len(readme_files),
readme_file))
with open(readme_file) as rf:
rlines = [Text(l) for l in rf.readlines()]
self.readme_w = BoxAdapter(ListBox(rlines),
self.initial_height)
ws = [Text("About {}:".format(app.config['spell'])),
Padding.right_50(Color.button_primary(
PlainButton("Continue",
self.do_continue),
focus_map='button_primary focus')),
Padding.center(HR()),
Padding.center(self.readme_w, left=2),
Padding.center(HR()),
Padding.center(Text("Use arrow keys to scroll text "
"and TAB to select the button."))]
self.pile = Pile(ws)
return Padding.center_90(Filler(self.pile, valign="top"))
示例3: build_footer
# 需要导入模块: from ubuntui.utils import Padding [as 别名]
# 或者: from ubuntui.utils.Padding import center_90 [as 别名]
def build_footer(self):
cancel = menu_btn(on_press=self.do_cancel,
label="\n BACK\n")
confirm = menu_btn(on_press=self.do_commit,
label="\n APPLY CHANGES\n")
self.buttons = Columns([
('fixed', 2, Text("")),
('fixed', 13, Color.menu_button(
cancel,
focus_map='button_primary focus')),
Text(""),
('fixed', 20, Color.menu_button(
confirm,
focus_map='button_primary focus')),
('fixed', 2, Text(""))
])
footer = Pile([
HR(top=0),
Padding.center_90(self.description_w),
Padding.line_break(""),
Color.frame_footer(Pile([
Padding.line_break(""),
self.buttons]))
])
return footer
示例4: build_footer
# 需要导入模块: from ubuntui.utils import Padding [as 别名]
# 或者: from ubuntui.utils.Padding import center_90 [as 别名]
def build_footer(self):
# cancel = menu_btn(on_press=self.cancel,
# label="\n BACK\n")
self.buttons = Columns([
('fixed', 2, Text("")),
# ('fixed', 13, Color.menu_button(
# cancel,
# focus_map='button_primary focus')),
Text(""),
('fixed', 40, Color.menu_button(
self.skip_rest_button,
focus_map='button_primary focus'
)),
('fixed', 2, Text(""))
])
footer = Pile([
HR(top=0),
Padding.center_90(self.description_w),
Padding.line_break(""),
Color.frame_footer(Pile([
Padding.line_break(""),
self.buttons]))
])
return footer
示例5: __init__
# 需要导入模块: from ubuntui.utils import Padding [as 别名]
# 或者: from ubuntui.utils.Padding import center_90 [as 别名]
def __init__(self, app, steps, cb=None):
""" init
Arguments:
cb: process step callback
"""
self.app = app
self.cb = cb
self.steps = steps
self.step_pile = Pile(
[Padding.center_90(HR()),
Padding.line_break("")] +
[Padding.center_90(s) for s in self.steps] +
[Padding.line_break("")]
)
super().__init__(Filler(self.step_pile, valign="top"))
示例6: build_widgets
# 需要导入模块: from ubuntui.utils import Padding [as 别名]
# 或者: from ubuntui.utils.Padding import center_90 [as 别名]
def build_widgets(self):
controller_is_maas = app.current_cloud == 'maas'
if controller_is_maas:
extra = (" Press enter on a machine ID to pin it to "
"a specific MAAS node.")
else:
extra = ""
ws = [Text("Choose where to place {} unit{} of {}.{}".format(
self.application.num_units,
"" if self.application.num_units == 1 else "s",
self.application.service_name,
extra))]
self.juju_machines_list = JujuMachinesList(
self.application,
self._machines,
self.do_assign,
self.do_unassign,
self.add_machine,
self.remove_machine,
self,
show_filter_box=True,
show_pins=controller_is_maas)
ws.append(self.juju_machines_list)
self.pile = Pile(ws)
return Padding.center_90(Filler(self.pile, valign="top"))
示例7: __init__
# 需要导入模块: from ubuntui.utils import Padding [as 别名]
# 或者: from ubuntui.utils.Padding import center_90 [as 别名]
def __init__(self, app, results, cb):
self.app = app
self.results = results
self.cb = cb
self.result_pile = [
Padding.line_break("")
]
self.result_pile += [Padding.center_90(s)
for s in self.build_results()]
super().__init__(Filler(Pile(self.result_pile), valign="top"))
示例8: __init__
# 需要导入模块: from ubuntui.utils import Padding [as 别名]
# 或者: from ubuntui.utils.Padding import center_90 [as 别名]
def __init__(self, cb):
self.cb = cb
self.fname_id_map = {}
self.current_focus = 2
_pile = [
Padding.line_break(""),
Padding.center_90(self.build_menuable_items()),
Padding.line_break(""),
Padding.center_20(self.buttons())
]
super().__init__(Filler(Pile(_pile), valign="top"))
示例9: build_widgets
# 需要导入模块: from ubuntui.utils import Padding [as 别名]
# 或者: from ubuntui.utils.Padding import center_90 [as 别名]
def build_widgets(self):
self.description_w = Text("Description Loading…")
self.readme_w = Text("README Loading…")
self.scale_edit = IntegerEditor(default=self.service.num_units)
connect_signal(self.scale_edit._edit, 'change',
self.handle_scale_changed)
self.skip_rest_button = PlainButton(
"Deploy all {} Remaining Applications with Bundle Defaults".format(
self.n_remaining),
self.do_skip_rest
)
col = Columns(
[
(6, Text('Units:', align='right')),
(15,
Color.string_input(self.scale_edit,
focus_map='string_input focus'))
], dividechars=1
)
if self.n_remaining == 0:
buttons = [Padding.right_50(Color.button_primary(
PlainButton("Deploy and Continue",
self.do_deploy),
focus_map='button_primary focus'))]
else:
buttons = [
Padding.right_50(Color.button_primary(
PlainButton(
"Deploy and Configure Next Application",
self.do_deploy),
focus_map='button_primary focus')),
Padding.right_50(
Color.button_secondary(
self.skip_rest_button,
focus_map='button_secondary focus'))]
ws = [Text("{} of {}: {}".format(self.idx+1, self.n_total,
self.service.service_name.upper())),
Padding.center(HR()),
Padding.center(self.description_w, left=2),
Padding.line_break(""),
Padding.center(self.readme_w, left=2),
Padding.center(HR())]
if not self.service.subordinate:
ws.append(Padding.left(col, left=1))
ws.append(Padding.line_break(""))
ws += buttons
self.pile = Pile(ws)
return Padding.center_90(Filler(self.pile, valign="top"))
示例10: build_widgets
# 需要导入模块: from ubuntui.utils import Padding [as 别名]
# 或者: from ubuntui.utils.Padding import center_90 [as 别名]
def build_widgets(self):
ws = [Text("{} Applications in {}:".format(len(self.applications),
app.config['spell']))]
max_app_name_len = max([len(a.service_name) for a in
self.applications])
for a in self.applications:
ws.append(Text(""))
wl = get_options_whitelist(a.service_name)
hide_config = a.subordinate and len(wl) == 0
ws.append(ApplicationWidget(a, max_app_name_len,
self.controller,
self.do_deploy,
hide_config=hide_config))
self.description_w = Text("App description")
self.pile = Pile(ws)
return Padding.center_90(Filler(self.pile, valign="top"))
示例11: build_widgets
# 需要导入模块: from ubuntui.utils import Padding [as 别名]
# 或者: from ubuntui.utils.Padding import center_90 [as 别名]
def build_widgets(self):
self.machines_list = MachinesList(
select_cb=self.select_machine,
unselect_cb=self.unselect_machine,
target_info=str(self.juju_machine_id),
current_pin_cb=self.controller.get_pin_for_maas_machine,
constraints=self.controller.get_constraints(
self.juju_machine_id),
show_hardware=True,
show_only_ready=True,
show_filter_box=True
)
header = Text("Choose a MAAS machine to pin to Juju Machine {}".format(
self.juju_machine_id))
self.pile = Pile([header,
self.machines_list])
return Padding.center_90(Filler(self.pile,
valign="top"))
示例12: build_widgets
# 需要导入模块: from ubuntui.utils import Padding [as 别名]
# 或者: from ubuntui.utils.Padding import center_90 [as 别名]
def build_widgets(self):
ws = [Text("Configure {}".format(
self.application.service_name))]
num_unit_ow = OptionWidget("Units", "int",
"How many units to deploy.",
self.application.orig_num_units,
current_value=self.application.num_units,
value_changed_callback=self.handle_scale)
ws.append(num_unit_ow)
ws += self.get_whitelisted_option_widgets()
self.toggle_show_all_button_index = len(ws) + 1
self.toggle_show_all_button = PlainButton(
"Show Advanced Configuration",
self.do_toggle_show_all_config)
ws += [HR(),
Columns([('weight', 1, Text(" ")),
(36, Color.button_secondary(
self.toggle_show_all_button))])]
self.pile = Pile(ws)
return Padding.center_90(Filler(self.pile, valign="top"))