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


Python urwid.Pile类代码示例

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


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

示例1: build_widgets

    def build_widgets(self):
        self.message = Text("Please review available machines in MAAS", align="center")

        self.button_pile = Pile([])

        self.main_pile = Pile([self.message, Divider(), self.button_pile])
        return Filler(self.main_pile, valign="middle")
开发者ID:kavinsivak,项目名称:openstack-installer,代码行数:7,代码来源:machinewait.py

示例2: DeployView

class DeployView(WidgetWrap):

    def __init__(self, display_controller, placement_controller,
                 placement_view):
        self.display_controller = display_controller
        self.placement_controller = placement_controller
        self.placement_view = placement_view
        self.prev_status = None
        w = self.build_widgets()
        super().__init__(w)
        self.update()

    def selectable(self):
        return True

    def build_widgets(self):
        self.deploy_ok_msg = ("\u2713 All the required OpenStack services are "
                              "placed on a machine, and you can now deploy.")

        self.deploy_button = AttrMap(
            Button("Deploy", on_press=self.do_deploy),
            'button_primary', 'button_primary focus')
        self.deploy_grid = GridFlow([self.deploy_button], 10, 1, 0, 'center')

        self.unplaced_msg = "Some required services are still unassigned."

        self.main_pile = Pile([Divider()])
        return self.main_pile

    def update(self):
        changed = self.prev_status != self.placement_controller.can_deploy()

        if self.placement_controller.can_deploy():
            if changed:
                self.show_deploy_button()
        else:
            self.main_pile.contents[0] = (Divider(),
                                          self.main_pile.options())
            if changed:
                self.display_controller.status_error_message(self.unplaced_msg)

        self.prev_status = self.placement_controller.can_deploy()

    def show_deploy_button(self):
        self.main_pile.contents[0] = (AttrMap(self.deploy_grid,
                                              'deploy_highlight_start'),
                                      self.main_pile.options())
        self.display_controller.status_info_message(self.deploy_ok_msg)

    def do_deploy(self, sender):
        self.placement_view.do_deploy_cb()
开发者ID:mikemccracken,项目名称:bundle-placement,代码行数:51,代码来源:__init__.py

示例3: build_widgets

    def build_widgets(self, title_widgets):
        if title_widgets is None:
            title_widgets = [Text("Machines", align='center')]

        self.filter_edit_box = FilterBox(self.handle_filter_change)

        header_widgets = title_widgets + [Divider()]

        if self.show_filter_box:
            header_widgets += [self.filter_edit_box, Divider()]
        labels = ["ID", "Cores", "Memory (GiB)", "Storage (GiB)"]
        if self.show_assignments:
            labels += ["Assignments", ""]
        else:
            labels += [""]

        header_label_col = Columns([Text(m) for m in labels],
                                   dividechars=2)
        header_widgets.append(header_label_col)
        self.header_padding = len(header_widgets)
        self.add_new_button = AttrMap(
            PlainButton("Add New Machine",
                        on_press=self.do_add_machine),
            'button_secondary',
            'button_secondary focus')
        self.add_new_cols = Columns([Text(s) for s in
                                     [' ', ' ', ' ', ' ', ' ']] +
                                    [self.add_new_button], dividechars=2)
        self.machine_pile = Pile(header_widgets + self.machine_widgets +
                                 [self.add_new_cols])
        return self.machine_pile
开发者ID:conjure-up,项目名称:conjure-up,代码行数:31,代码来源:juju_machines_list.py

示例4: __init__

    def __init__(self, title=None, cls=None):
        if cls is None:
            cls = type('Dummy', (object,), {'__init__': lambda *a, **k: None, 'run': lambda *a: None})
        self.cls = cls
        self._obj = None

        _edit_cancel = lambda *w: self.focus_button(1)

        self.codigo_box = MaeterCodeBox(max_length=12, align='right')
        connect_signal(self.codigo_box, 'focus-in', highlight_focus_in),
        connect_signal(self.codigo_box, 'edit-done', self.on_codigo_edit_done)
        connect_signal(self.codigo_box, 'edit-cancel', _edit_cancel)
        connect_signal(self.codigo_box, 'search-client', self.on_client_search)

        self.nombre = Text(u'')

        client_row = Columns([
            ('fixed', 8, AttrMap(Text("Cliente", align='right'), 'dialog.selectdate.label')),
            ('fixed', 6, AttrMap(self.codigo_box, 'dialog.selectdate.input', 'dialog.selectdate.input.focus')),
            AttrMap(self.nombre, 'dialog.selectdate.label'),
        ], dividechars=1)

        self.content = Pile([
            client_row,
            Divider(),
        ])

        buttons = [("Continuar", self.run_list), ("Cancelar", self.quit)]

        self.__super.__init__(self.content, buttons,
                title=title or u'<Falta titulo>',
                height=None,
                width=60,
                attr_style='dialog.selectdate',
                title_attr_style='dialog.selectdate.title')
开发者ID:coyotevz,项目名称:nobix,代码行数:35,代码来源:viewer.py

示例5: build_widgets

 def build_widgets(self):
     widgets = []
     if self.title:
         widgets = [Text(self.title), Divider(' ')]
     widgets += self.service_widgets
     self.service_pile = Pile(widgets)
     return self.service_pile
开发者ID:Ubuntu-Solutions-Engineering,项目名称:bundle-placement,代码行数:7,代码来源:services_list.py

示例6: build_widgets

    def build_widgets(self):

        self.action_button_cols = Columns([])
        self.action_buttons = []
        self.build_unselected_widgets()
        self.pile = Pile([self.unselected_columns])
        return self.pile
开发者ID:conjure-up,项目名称:conjure-up,代码行数:7,代码来源:juju_machine_widget.py

示例7: Header

class Header(WidgetWrap):

    TITLE_TEXT = "Ubuntu OpenStack Installer - Dashboard"

    def __init__(self):
        self.text = Text(self.TITLE_TEXT)
        self.widget = Color.frame_header(self.text)
        self.pile = Pile([self.widget, Text("")])
        self.set_show_add_units_hotkey(False)
        super().__init__(self.pile)

    def set_openstack_rel(self, release):
        self.text.set_text("{} ({})".format(self.TITLE_TEXT, release))

    def set_show_add_units_hotkey(self, show):
        self.show_add_units = show
        self.update()

    def update(self):
        if self.show_add_units:
            add_unit_string = "(A)dd Services \N{BULLET}"
        else:
            add_unit_string = ""
        tw = Color.frame_subheader(
            Text(add_unit_string + " (H)elp \N{BULLET} " "(R)efresh \N{BULLET} (Q)uit", align="center")
        )
        self.pile.contents[1] = (tw, self.pile.options())
开发者ID:kavinsivak,项目名称:openstack-installer,代码行数:27,代码来源:gui.py

示例8: __init__

    def __init__(self, filename, title=None, timeout=10, interval=0.1):#{{{
        self.filename = filename
        self.interval = interval
        self.timeout = timeout

        if title is None:
            title = "IMPRIMIENDO"

        msg = Text("Esperando la respuesta de la Impresora Fiscal ...", align='left')
        self.eta = Text("", align='left')

        self.dummy = Text("")
        self.dummy._selectable = True
        self.dummy.keypress = lambda s,k : None

        self.buttons = Columns([
            AttrMap(Button("Seguir esperando", on_press=self.remove_buttons),'dialog.button', 'dialog.button.focus'),
            AttrMap(Button("Cancelar Impresion", on_press=lambda *w: self.quit()), 'dialog.button', 'dialog.button.focus'),
        ], dividechars=1)

        self.content = Pile([
            msg,
            Divider(),
            self.eta,
            self.dummy,
        ])

        self.__super.__init__(
            self.content,
            title=title,
            attr_style='dialog.waitfiscal',
            title_attr_style='dialog.waitfiscal.title',
            height=None,
            width=60,
        )
开发者ID:coyotevz,项目名称:nobix,代码行数:35,代码来源:widget.py

示例9: build_widgets

    def build_widgets(self):

        self.button = MenuSelectButton("I AM A MACHINE", self.do_select)
        self.action_button_cols = Columns([])
        self.action_buttons = []

        self.pile = Pile([self.button])
        return self.pile
开发者ID:benluteijn,项目名称:conjure-up,代码行数:8,代码来源:simple_machine_widget.py

示例10: __init__

 def __init__(self, walker, **kwargs):
     if not isinstance(walker, TreeListWalker):
         walker = TreeListWalker(walker)
     self._walker = walker
     self._lines = []
     self.loadlines()
     logging.debug('lines:\n\n%s' % str(self._lines))
     self._pile = Pile(self._lines)
     self.__super.__init__(self._pile)
开发者ID:pazz,项目名称:urwidtrees-V1,代码行数:9,代码来源:sandbox.treepile.py

示例11: build_widgets

    def build_widgets(self):

        self.button = MenuSelectButton("I AM A SERVICE", self.do_select)

        self.action_button_cols = Columns([], dividechars=1)
        self.action_buttons = []

        self.pile = Pile([self.button])
        return self.pile
开发者ID:benluteijn,项目名称:conjure-up,代码行数:9,代码来源:simple_service_widget.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):
        self.deploy_ok_msg = ("\u2713 All the required OpenStack services are "
                              "placed on a machine, and you can now deploy.")

        self.deploy_button = AttrMap(
            Button("Deploy", on_press=self.do_deploy),
            'button_primary', 'button_primary focus')
        self.deploy_grid = GridFlow([self.deploy_button], 10, 1, 0, 'center')

        self.unplaced_msg = "Some required services are still unassigned."

        self.main_pile = Pile([Divider()])
        return self.main_pile
开发者ID:mikemccracken,项目名称:bundle-placement,代码行数:13,代码来源:__init__.py

示例14: build_widgets

    def build_widgets(self, title_widgets):
        if title_widgets is None:
            if len(self.constraints) > 0:
                cstr = " matching constraints"
            else:
                cstr = ""

            title_widgets = Text("Machines" + cstr, align="center")

        self.filter_edit_box = FilterBox(self.handle_filter_change)

        self.machine_pile = Pile([title_widgets, Divider(), self.filter_edit_box] + self.machine_widgets)
        return self.machine_pile
开发者ID:mikemccracken,项目名称:bundle-placement,代码行数:13,代码来源:machines_list.py

示例15: build_widgets

    def build_widgets(self):
        self.machines_list = MachinesList(self.placement_controller,
                                          self.display_controller,
                                          None,
                                          show_hardware=True,
                                          show_assignments=False,
                                          show_placeholders=False,
                                          show_only_ready=True,
                                          title_widgets=[])

        self.machines_list.update()

        self.machines_list_pile = Pile([self.machines_list,
                                        Divider()])

        return self.machines_list_pile
开发者ID:Ubuntu-Solutions-Engineering,项目名称:bundle-placement,代码行数:16,代码来源:machines_column.py


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