• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python utils.Padding类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中ubuntui.utils.Padding的典型用法代码示例。如果您正苦于以下问题:Python Padding类的具体用法?Python Padding怎么用?Python Padding使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Padding类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: build_footer

    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
开发者ID:conjure-up,项目名称:conjure-up,代码行数:27,代码来源:applicationconfigure.py


示例2: _build_widget

    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'))
开发者ID:battlemidget,项目名称:conjure-up,代码行数:35,代码来源:ControllerListView.py


示例3: build_footer

    def build_footer(self):
        cancel = menu_btn(on_press=self.do_cancel,
                          label="\n  BACK\n")
        self.apply_button = menu_btn(on_press=self.do_done,
                                     label="\n DONE\n")
        self.buttons = Columns([
            ('fixed', 2, Text("")),
            ('fixed', 13, Color.menu_button(
                cancel,
                focus_map='button_primary focus')),
            Text(""),
            ('fixed', 20, Color.menu_button(
                self.apply_button,
                focus_map='button_primary focus')),
            ('fixed', 2, Text(""))
        ])

        footer = Pile([
            HR(top=0),
            Padding.line_break(""),
            Color.frame_footer(Pile([
                Padding.line_break(""),
                self.buttons]))
        ])

        return footer
开发者ID:conjure-up,项目名称:conjure-up,代码行数:26,代码来源:machine_pin_view.py


示例4: _build_widget

 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'))
开发者ID:battlemidget,项目名称:conjure-up,代码行数:25,代码来源:cloud.py


示例5: generate_additional_input

    def generate_additional_input(self):
        """ Generates additional input fields, useful for doing it after
        a previous step is run
        """
        self.set_description(self.model.description, 'body')
        self.icon.set_text((
            'pending_icon',
            self.icon.get_text()[0]
        ))
        for i in self.additional_input:
            self.app.log.debug(i)
            self.step_pile.contents.append((Padding.line_break(""),
                                            self.step_pile.options()))
            column_input = [
                ('weight', 0.5, Padding.left(i['label'], left=5))
            ]
            if i['input']:
                column_input.append(
                    ('weight', 1, Color.string_input(
                        i['input'],
                        focus_map='string_input focus')))
            self.step_pile.contents.append(
                (Columns(column_input, dividechars=3),
                 self.step_pile.options()))

        self.button = submit_btn(label="Run", on_press=self.submit)
        self.step_pile.contents.append(
            (Padding.right_20(
                Color.button_primary(self.button,
                                     focus_map='button_primary focus')),
             self.step_pile.options()))
        self.step_pile.contents.append((HR(), self.step_pile.options()))
        self.step_pile.focus_position = self.current_button_index
开发者ID:conjure-up,项目名称:conjure-up,代码行数:33,代码来源:step.py


示例6: build_footer

    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
开发者ID:conjure-up,项目名称:conjure-up,代码行数:26,代码来源:applicationlist.py


示例7: __init__

 def __init__(self, app, cb):
     self.app = app
     self.text = Text("deploying...")
     _pile = [
         Padding.center_79(self.text),
         Padding.line_break(""),
         Padding.center_20(self.buttons())
     ]
     super().__init__(Filler(Pile(_pile), valign="middle"))
开发者ID:battlemidget,项目名称:conjure-up,代码行数:9,代码来源:deploy.py


示例8: __init__

 def __init__(self, common, provider, cb):
     self.common = common
     self.provider = provider
     self.text = Text(self.provider.to_yaml())
     _pile = [
         Padding.center_79(self.text),
         Padding.line_break(""),
         Padding.center_20(self.buttons())
     ]
     super().__init__(Filler(Pile(_pile), valign="middle"))
开发者ID:pombredanne,项目名称:conjure,代码行数:10,代码来源:deploy.py


示例9: _build_footer

 def _build_footer(self):
     self.spell_description = Text("")
     footer_pile = Pile(
         [
             Padding.center_60(self.spell_description),
             Padding.line_break(""),
             Color.frame_footer(Columns([("fixed", 2, Text("")), ("fixed", 13, self._build_buttons())])),
         ]
     )
     return footer_pile
开发者ID:conjure-up,项目名称:conjure-up,代码行数:10,代码来源:spellpicker.py


示例10: __init__

 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"))
开发者ID:battlemidget,项目名称:conjure-up,代码行数:10,代码来源:summary.py


示例11: __init__

 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"))
开发者ID:battlemidget,项目名称:conjure-up,代码行数:11,代码来源:variant.py


示例12: __init__

 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))
开发者ID:pombredanne,项目名称:conjure,代码行数:11,代码来源:welcome.py


示例13: __init__

 def __init__(self, app, cloud, schema, cb):
     self.app = app
     self.cloud = cloud
     self.input_items = schema
     self.cb = cb
     _pile = [
         Padding.center_60(Instruction(
             "Enter your {} credentials:".format(self.cloud.upper()))),
         Padding.center_60(HR()),
         Padding.center_60(self.build_inputs()),
         Padding.line_break(""),
         Padding.center_20(self.buttons())
     ]
     super().__init__(Filler(Pile(_pile), valign="top"))
开发者ID:benluteijn,项目名称:conjure-up,代码行数:14,代码来源:newcloud.py


示例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 = self.radio_items[item]
         col = Columns([opt])
         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')
开发者ID:Ubuntu-Solutions-Engineering,项目名称:openstack-installer,代码行数:15,代码来源:selectordialog.py


示例15: build_widgets

    def build_widgets(self):
        desc_text = Text(["\n", strip_solo_dots(self.description)])

        self.reset_button = PlainButton("Reset to Default", self.do_reset)
        if self.optype == OptionType.BOOLEAN:
            self.control = CheckBox('', state=bool(self.current_value))
            self.wrapped_control = self.control
        elif self.optype == OptionType.INT:
            self.control = IntEdit(default=self.current_value)
            self.wrapped_control = Color.string_input(
                self.control, focus_map='string_input focus')
        elif self.optype == OptionType.STRING:
            edit_text = self.current_value or ""
            self.control = StringEditor(edit_text=edit_text)
            self.wrapped_control = Color.string_input(
                self.control, focus_map='string_input focus')
        elif self.optype == OptionType.FLOAT:
            edit_text = str(self.current_value)
            self.control = StringEditor(edit_text=edit_text)
            self.wrapped_control = Color.string_input(
                self.control, focus_map='string_input focus')
        else:
            raise Exception("Unknown option type")

        self.control_columns = Columns(
            [
                ('pack', Text("{}:".format(self.name), align='right')),
                (80, self.wrapped_control)
            ],
            dividechars=1
        )

        if self.optype in [OptionType.STRING, OptionType.FLOAT]:
            connect_signal(self.control._edit, 'change',
                           self.handle_value_changed)
        else:
            connect_signal(self.control, 'change',
                           self.handle_value_changed)

        button_grid = GridFlow([
            Color.button_secondary(self.reset_button,
                                   focus_map='button_secondary focus')],
                               36, 1, 0, 'right')

        return Pile([Padding.line_break(""),
                     Padding.left(self.control_columns, left=1),
                     Padding.left(desc_text, left=2),
                     button_grid])
开发者ID:conjure-up,项目名称:conjure-up,代码行数:48,代码来源:option_widget.py


示例16: __init__

 def __init__(self, app, cb):
     self.app = app
     self.input_items = NETWORK
     self.cb = cb
     _pile = [
         # Padding.center_60(Instruction(
         #     "Enter LXD information:")),
         Padding.center_60(Instruction(
             "Please configure networking for LXD"
         )),
         Padding.center_60(HR()),
         Padding.center_60(self.build_info()),
         Padding.line_break(""),
         Padding.center_20(self.buttons())
     ]
     super().__init__(Filler(Pile(_pile), valign="middle"))
开发者ID:benluteijn,项目名称:conjure-up,代码行数:16,代码来源:lxdsetup.py


示例17: _build_widget

    def _build_widget(self):
        total_items = [HR()]
        total_items += [spell for spell in self.spells]
        total_items += [HR()]

        self.pile = Pile(total_items)
        return Padding.center_60(Filler(self.pile, valign="top"))
开发者ID:conjure-up,项目名称:conjure-up,代码行数:7,代码来源:spellpicker.py


示例18: __init__

    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"))
开发者ID:conjure-up,项目名称:conjure-up,代码行数:16,代码来源:steps.py


示例19: build_menuable_items

 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)
开发者ID:battlemidget,项目名称:conjure-up,代码行数:30,代码来源:variant.py


示例20: build_widgets

    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"))
开发者ID:conjure-up,项目名称:conjure-up,代码行数:27,代码来源:app_architecture_view.py



注:本文中的ubuntui.utils.Padding类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python handlers.MementoHandler类代码示例发布时间:2022-05-27
下一篇:
Python utils.Color类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap