当前位置: 首页>>代码示例>>Python>>正文


Python utils.Color类代码示例

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


在下文中一共展示了Color类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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.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

示例3: 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

示例4: 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

示例5: _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

示例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: build_widgets

    def build_widgets(self, maxlen):
        num_str = "{}".format(self.application.num_units)
        col_pad = 6
        self.unit_w = Text('Units: {:4d}'.format(self.application.num_units),
                           align='right')
        cws = [
            (maxlen + col_pad,
             Text(self.application.service_name)),
            (10 + len(num_str), self.unit_w),
            # placeholder for instance type
            ('weight', 1, Text(" ")),
            # placeholder for configure button
            ('weight', 1, Text(" ")),
            (20, Color.button_primary(
                PlainButton("Deploy",
                            partial(self.deploy_cb,
                                    self.application)),
                focus_map='button_primary focus'))
        ]
        if not self.hide_config:
            cws[3] = (20, Color.button_secondary(
                PlainButton("Configure",
                            partial(self.controller.do_configure,
                                    self.application)),
                focus_map='button_secondary focus'))

        self.columns = Columns(cws, dividechars=1)
        return self.columns
开发者ID:battlemidget,项目名称:conjure-up,代码行数:28,代码来源:applicationlist.py

示例8: buttons

    def buttons(self):
        confirm = confirm_btn(on_press=self.submit)
        cancel = cancel_btn(on_press=self.cancel)

        buttons = [
            Color.button_primary(confirm, focus_map='button_primary focus'),
            Color.button_secondary(cancel, focus_map='button_secondary focus')
        ]
        return Pile(buttons)
开发者ID:benluteijn,项目名称:conjure-up,代码行数:9,代码来源:lxdsetup.py

示例9: buttons

    def buttons(self):
        confirm = confirm_btn(on_press=self.submit, label="Add credential")
        cancel = back_btn(on_press=self.cancel)

        buttons = [
            Color.button_primary(confirm, focus_map='button_primary focus'),
            Color.button_secondary(cancel, focus_map='button_secondary focus')
        ]
        return Pile(buttons)
开发者ID:benluteijn,项目名称:conjure-up,代码行数:9,代码来源:newcloud.py

示例10: _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)
开发者ID:Ubuntu-Solutions-Engineering,项目名称:openstack-installer,代码行数:10,代码来源:selectordialog.py

示例11: __init__

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

示例12: build_widgets

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

示例13: 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

示例14: _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)
开发者ID:Ubuntu-Solutions-Engineering,项目名称:urwid-ubuntu,代码行数:7,代码来源:error.py

示例15: refresh_nodes

    def refresh_nodes(self):
        """ Adds services to the view if they don't already exist
        """
        status = model_status()
        for name, service in sorted(status['applications'].items()):
            service_w = ServiceWidget(name, service)
            for unit in service_w.Units:
                services_list = []
                try:
                    unit_w = self.deployed[unit._name]
                except:
                    self.deployed[unit._name] = unit
                    unit_w = self.deployed[unit._name]
                    for k, label, width in self.view_columns:
                        if width == 0:
                            services_list.append(getattr(unit_w, k))
                        else:
                            if not hasattr(unit_w, k):
                                continue
                            services_list.append(('fixed', width,
                                                  getattr(unit_w, k)))

                    self.table.addColumns(unit._name, services_list)
                    if not hasattr(unit_w, 'WorkloadInfo'):
                        continue
                    self.table.addColumns(
                        unit._name,
                        [
                            ('fixed', 5, Text("")),
                            Color.info_context(
                                unit_w.WorkloadInfo)
                        ],
                        force=True)
                self.update_ui_state(unit_w, unit._unit)
开发者ID:battlemidget,项目名称:conjure-up,代码行数:34,代码来源:services.py


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