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


Python Frame.set_footer方法代码示例

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


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

示例1: PegasusGUI

# 需要导入模块: from urwid import Frame [as 别名]
# 或者: from urwid.Frame import set_footer [as 别名]

#.........这里部分代码省略.........

    def show_maas_input(self, title, cb):
        widget = MaasServerInput(title, cb)
        self.show_widget_on_top(widget, width=50, height=10)

    def hide_show_maas_input(self):
        self.hide_widget_on_top()

    def show_dhcp_range(self, range_low, range_high, title, cb):
        widget = DhcpRangeInput(range_low, range_high, title, cb)
        self.show_widget_on_top(widget, width=50, height=10)

    def hide_show_dhcp_range(self):
        self.hide_widget_on_top()

    def show_landscape_input(self, title, cb):
        widget = LandscapeInput(title, cb)
        self.show_widget_on_top(widget, width=50, height=9)

    def hide_show_landscape_input(self):
        self.hide_widget_on_top()

    def set_pending_deploys(self, pending_charms):
        self.frame.footer.set_pending_deploys(pending_charms)

    def flash(self, msg):
        self.frame.body.flash("{}\N{HORIZONTAL ELLIPSIS}".format(msg))

    def flash_reset(self):
        self.frame.body.flash_reset()

    def status_message(self, text):
        self.frame.footer.message(text)
        self.frame.set_footer(self.frame.footer)

    def status_error_message(self, message):
        self.frame.footer.error_message(message)

    def status_info_message(self, message):
        self.frame.footer.info_message(
            "{}\N{HORIZONTAL ELLIPSIS}".format(message))

    def set_dashboard_url(self, ip, user, password):
        self.frame.footer.set_dashboard_url(ip, user, password)

    def set_jujugui_url(self, ip):
        self.frame.footer.set_jujugui_url(ip)

    def set_openstack_rel(self, text):
        self.frame.footer.set_openstack_rel(text)

    def clear_status(self):
        self.frame.footer = None
        self.frame.set_footer(self.frame.footer)

    def render_services_view(self, nodes, juju_state, maas_state, config,
                             **kwargs):
        if self.services_view is None:
            self.services_view = ServicesView(nodes, juju_state, maas_state,
                                              config)

        self.services_view.update(nodes)
        self.frame.set_body(self.services_view)
        self.header.set_show_add_units_hotkey(True)

    def render_node_install_wait(self, message=None, **kwargs):
开发者ID:pmondal08,项目名称:openstack-installer,代码行数:70,代码来源:gui.py

示例2: CursesInterface

# 需要导入模块: from urwid import Frame [as 别名]
# 或者: from urwid.Frame import set_footer [as 别名]
class CursesInterface(WidgetWrap):
    """
    Creates a curses interface for the program, providing functions to draw
    all the components of the UI.

    Provides a facade API to draw the representation of the
    :class:`~turses.models.TimelineList`, help :class:`HelpBuffer`
    and intro :class:`Banner` screens.
    """

    def __init__(self):
        self._editor = None

        # header
        header = TabsWidget()

        # body
        body = Banner()

        # footer
        self._status_bar = configuration.styles.get('status_bar', False)
        if self._status_bar:
            footer = StatusBar('')
        else:
            footer = None

        self.frame = Frame(body,
                           header=header,
                           footer=footer)

        super(CursesInterface, self).__init__(self.frame)

    def _build_overlay_widget(self,
                              top_w,
                              align,
                              width,
                              valign,
                              height,
                              min_width,
                              min_height):
        return Overlay(top_w=Filler(top_w),
                       bottom_w=self.frame,
                       align=align,
                       width=width,
                       valign=valign,
                       height=height,
                       min_width=width,
                       min_height=height)

    # -- Modes ----------------------------------------------------------------

    def draw_timelines(self, timelines):
        self.frame.body = TimelinesBuffer(timelines)
        self.frame.set_body(self.frame.body)

    def show_info(self):
        self.frame.header.clear()
        self.frame.body = Banner()
        self.frame.set_body(self.frame.body)

    def show_help(self):
        self.clear_header()
        self.status_info_message(_('type <esc> to leave the help page.'))
        self.frame.body = HelpBuffer()
        self.frame.set_body(self.frame.body)

    # -- Header ---------------------------------------------------------------

    def clear_header(self):
        self.frame.header.clear()

    def set_tab_names(self, names):
        self.frame.header.set_tabs(names)
        self.frame.set_header(self.frame.header)

    def activate_tab(self, index):
        self.frame.header.set_active_tab(index)
        self.frame.set_header(self.frame.header)

    def highlight_tabs(self, indexes):
        self.frame.header.set_visible_tabs(indexes)

    # -- Footer ---------------------------------------------------------------

    @property
    def can_write_status(self):
        if self._status_bar:
            if self.frame.footer is None:
                self.frame.footer = StatusBar('')
            return True
        return False

    def status_message(self, text):
        if self.can_write_status:
            self.frame.footer.message(text)
            self.frame.set_footer(self.frame.footer)

    def status_error_message(self, message):
        if self.can_write_status:
            self.frame.footer.error_message(message)
#.........这里部分代码省略.........
开发者ID:Erik-k,项目名称:turses,代码行数:103,代码来源:ui.py

示例3: PegasusGUI

# 需要导入模块: from urwid import Frame [as 别名]
# 或者: from urwid.Frame import set_footer [as 别名]

#.........这里部分代码省略.........
        self.controller = self.frame.body
        self.frame.body = HelpScreen()

    def show_step_info(self, msg):
        self.frame.body = StepInfo(msg)

    def show_selector_with_desc(self, title, opts, cb):
        self.frame.body = SelectorWithDescription(title, opts, cb)

    def show_fatal_error_message(self, msg, cb):
        w = InfoDialog(msg, cb)
        self.show_widget_on_top(w, width=50, height=20)

    def show_password_input(self, title, cb):
        self.frame.body = PasswordInput(title, cb)

    def show_maas_input(self, title, cb):
        self.frame.body = MaasServerInput(title, cb)

    def show_landscape_input(self, title, cb):
        self.frame.body = LandscapeInput(title, cb)

    def set_pending_deploys(self, pending_charms):
        self.frame.footer.set_pending_deploys(pending_charms)

    def flash(self, msg):
        self.frame.body.flash("{}\N{HORIZONTAL ELLIPSIS}".format(msg))

    def flash_reset(self):
        self.frame.body.flash_reset()

    def status_message(self, text):
        self.frame.footer.message(text)
        self.frame.set_footer(self.frame.footer)

    def status_error_message(self, message):
        self.frame.footer.error_message(message)

    def status_info_message(self, message):
        self.frame.footer.info_message("{}\N{HORIZONTAL ELLIPSIS}".format(message))

    def set_dashboard_url(self, ip, user, password):
        self.frame.footer.set_dashboard_url(ip, user, password)

    def set_jujugui_url(self, ip):
        self.frame.footer.set_jujugui_url(ip)

    def set_openstack_rel(self, release):
        self.frame.header.set_openstack_rel(release)

    def clear_status(self):
        self.frame.footer = None
        self.frame.set_footer(self.frame.footer)

    def render_services_view(self, nodes, juju_state, maas_state, config, **kwargs):
        if self.services_view is None:
            self.services_view = ServicesView(nodes, juju_state, maas_state, config)

        self.services_view.update(nodes)
        self.frame.set_body(self.services_view)
        self.header.set_show_add_units_hotkey(True)
        dc = config.getopt("deploy_complete")
        dcstr = "complete" if dc else "pending"
        rc = config.getopt("relations_complete")
        rcstr = "complete" if rc else "pending"
        ppc = config.getopt("postproc_complete")
开发者ID:kavinsivak,项目名称:openstack-installer,代码行数:70,代码来源:gui.py

示例4: PegasusGUI

# 需要导入模块: from urwid import Frame [as 别名]
# 或者: from urwid.Frame import set_footer [as 别名]

#.........这里部分代码省略.........
        self.hide_widget_on_top()

    def show_step_info(self, msg, width=60, height=10):
        self.hide_step_info()
        widget = StepInfo(msg, height)
        self.show_widget_on_top(widget, width=width, height=height + 1,
                                align="center",
                                valign="middle", min_height=10)

    def hide_step_info(self):
        self.hide_widget_on_top()

    def show_selector_info(self, title, opts, cb):
        widget = Selector(title, opts, cb)
        self.show_widget_on_top(widget, width=50, height=10)

    def hide_selector_info(self):
        self.hide_widget_on_top()

    def show_fatal_error_message(self, msg, cb):
        w = InfoDialog(msg, cb)
        self.show_widget_on_top(w, width=50, height=20)

    def show_password_input(self, title, cb):
        widget = PasswordInput(title, cb)
        self.show_widget_on_top(widget, width=50, height=10)

    def hide_show_password_input(self):
        self.hide_widget_on_top()

    def show_maas_input(self, title, cb):
        widget = MaasServerInput(title, cb)
        self.show_widget_on_top(widget, width=50, height=10)

    def hide_show_maas_input(self):
        self.hide_widget_on_top()

    def show_dhcp_range(self, range_low, range_high, title, cb):
        widget = DhcpRangeInput(range_low, range_high, title, cb)
        self.show_widget_on_top(widget, width=50, height=10)

    def hide_show_dhcp_range(self):
        self.hide_widget_on_top()

    def show_landscape_input(self, title, cb):
        widget = LandscapeInput(title, cb)
        self.show_widget_on_top(widget, width=50, height=10)

    def hide_show_landscape_input(self):
        self.hide_widget_on_top()

    def show_add_charm_info(self, charms, cb):
        widget = AddCharmDialog(charms, cb)
        self.show_widget_on_top(widget, width=50, height=10)

    def hide_add_charm_info(self):
        self.hide_widget_on_top()

    def set_pending_deploys(self, pending_charms):
        self.frame.footer.set_pending_deploys(pending_charms)

    def status_message(self, text):
        self.frame.footer.message(text)
        self.frame.set_footer(self.frame.footer)

    def status_error_message(self, message):
        self.frame.footer.error_message(message)

    def status_info_message(self, message):
        self.frame.footer.info_message(message)

    def status_dashboard_url(self, ip):
        self.frame.footer.set_dashboard_url(ip)

    def status_jujugui_url(self, ip):
        self.frame.footer.set_jujugui_url(ip)

    def status_openstack_rel(self, text):
        self.frame.footer.set_openstack_rel(text)

    def clear_status(self):
        self.frame.footer = None
        self.frame.set_footer(self.frame.footer)

    def render_nodes(self, nodes, juju_state, maas_state, **kwargs):
        self.frame.body = NodeViewMode(nodes, juju_state, maas_state)
        self.frame.set_body(self.frame.body)
        self.header.set_show_add_units_hotkey(True)

    def render_node_install_wait(self, **kwargs):
        self.frame.body = NodeInstallWaitMode(**kwargs)
        self.frame.set_body(self.frame.body)

    def render_placement_view(self, display_controller,
                              placement_controller):
        if self.placement_view is None:
            self.placement_view = PlacementView(display_controller,
                                                placement_controller)
        self.placement_view.update()
        self.frame.body = self.placement_view
开发者ID:sparkiegeek,项目名称:openstack-installer,代码行数:104,代码来源:gui.py

示例5: PegasusGUI

# 需要导入模块: from urwid import Frame [as 别名]
# 或者: from urwid.Frame import set_footer [as 别名]
class PegasusGUI(WidgetWrap):
    def __init__(self):
        _check_encoding()  # Make sure terminal supports utf8
        header = Header()
        body = Banner()
        footer = StatusBar('')

        self.frame = Frame(body,
                           header=header,
                           footer=footer)

        super().__init__(self.frame)

    def _build_overlay_widget(self,
                              top_w,
                              align,
                              width,
                              valign,
                              height,
                              min_width,
                              min_height):
        return Overlay(top_w=Filler(top_w),
                       bottom_w=self.frame,
                       align=align,
                       width=width,
                       valign=valign,
                       height=height,
                       min_width=width,
                       min_height=height)

    def show_widget_on_top(self,
                           widget,
                           width,
                           height,
                           align='center',
                           valign='middle',
                           min_height=0,
                           min_width=0):
        """Show `widget` on top of :attr:`frame`."""
        self._w = self._build_overlay_widget(top_w=widget,
                                             align=align,
                                             width=width,
                                             valign=valign,
                                             height=height,
                                             min_width=min_width,
                                             min_height=min_height)

    def focus_next(self):
        self.frame.body.scroll_down()

    def focus_previous(self):
        self.frame.body.scroll_up()

    def focus_first(self):
        self.frame.body.scroll_top()

    def focus_last(self):
        self.frame.body.scroll_bottom()

    def hide_widget_on_top(self):
        """Hide the topmost widget (if any)."""
        self._w = self.frame

    def show_help_info(self):
        widget = HelpScreen()
        self.show_widget_on_top(widget, width=80, height=22,
                                align="center", valign="middle",
                                min_height=10)

    def hide_help_info(self):
        self.hide_widget_on_top()

    def show_step_info(self, msg=None):
        self.hide_step_info()
        widget = StepInfo(msg)
        self.show_widget_on_top(widget, width=50, height=3, align="center",
                                valign="middle", min_height=10)

    def hide_step_info(self):
        self.hide_widget_on_top()

    def show_add_charm_info(self, charms, cb):
        widget = AddCharmDialog(charms, cb)
        self.show_widget_on_top(widget, width=50, height=10)

    def hide_add_charm_info(self):
        self.hide_widget_on_top()

    def set_pending_deploys(self, pending_charms):
        self.frame.footer.set_pending_deploys(pending_charms)

    def status_message(self, text):
        self.frame.footer.message(text)
        self.frame.set_footer(self.frame.footer)

    def status_error_message(self, message):
        self.frame.footer.error_message(message)

    def status_info_message(self, message):
        self.frame.footer.info_message(message)
#.........这里部分代码省略.........
开发者ID:gitter-badger,项目名称:cloud-installer,代码行数:103,代码来源:gui.py

示例6: SubDiarioVentasTree

# 需要导入模块: from urwid import Frame [as 别名]
# 或者: from urwid.Frame import set_footer [as 别名]
class SubDiarioVentasTree(Dialog):#{{{

    def __init__(self, start_date=None, end_date=None, period=None):#{{{
        self.period = period
        if start_date is None:
            start_date = period + relativedelta(day=1)
        self.start_date = start_date
        if end_date is None:
            end_date = period + relativedelta(day=31)
        self.end_date = end_date

        title = "Subdiario de ventas"
        if period:
            stitle = " (periodo %s)" % period.strftime("%m/%Y")
        else:
            stitle = " (%s - %s)" % (start_date.strftime("%d/%m/%Y"), end_date.strftime("%d/%m/%Y"))

        list_header = Columns([
            ('fixed', 2, Divider()),
            ('fixed', 3, Text(u"Tip", align='center')),
            ('fixed', 6, Text(u"Número", align='center')),
            Text(u"Razón Social", align='left'),
            ('fixed', 5, Text(u"Hora", align='left')),
            ('fixed', 3, Text(u"Ven", align='right')),
            ('fixed', 6, Text(u"Impues", align='right')),
            ('fixed', 6, Text(u"Descue", align='right')),
            ('fixed', 9, Text(u"Total".upper(), align='right')),
        ], dividechars=1)

        title_row = [('listado.title.important', title), stitle]
        header_row = [
            AttrMap(Text(title_row, align='center', wrap='clip'), 'listado.title'),
            AttrMap(list_header, 'listado.list_header'),
        ]

        header = Pile(header_row)
        footer = Text("Calculando ...")
        self.short_footer = None
        self.large_footer = None
        self._current_footer = 0

        query = session.query(Documento.fecha).filter(Documento.fecha.between(start_date, end_date))\
                                              .order_by(Documento.fecha).distinct()

        treestore = TreeListWalker([DateNode(k[0]) for k in query])
        treebox = TreeListBox(treestore)

        self.content = Frame(
                AttrMap(treebox, 'listado.body'),
                header=header,
                footer=AttrMap(footer, 'listado.footer'))

        self.configure_subprocess()

        self.__super.__init__(self.content,
                height=('relative', 100),
                width=('relative', 100),
                with_border=False)
#}}}
    def keypress(self, key):#{{{
        if key in ('enter', 'esc', ' ', 'f10'):
            self.quit()
        elif key in ('v', 'V'):
            self.switch_footer()
        return self.__super.keypress(key)
#}}}
    def switch_footer(self):#{{{
        if self.large_footer and self.short_footer:
            self.content.set_footer((self.short_footer, self.large_footer)[self._current_footer])
            self._current_footer = 1 - (1 * self._current_footer)
#}}}
    def run(self):#{{{
        message_waiter(u" Procesando información ... ")
        self._subprocess.start()
        return self.__super.run()
#}}}
    def configure_subprocess(self):#{{{
        self._subquery = session.query(Documento)\
                                .filter(Documento.fecha.between(self.start_date, self.end_date))\
                                #.filter(Documento.tipo.in_([u'FAC', u'FAA'])).order_by(Documento.fecha)
        self._qout = Queue()
        self._subprocess = Process(target=self.execute_query, args=(self._qout,))
#}}}
    def configure_subloop(self, loop):#{{{
        self._loop = loop
        self._handle = loop.event_loop.watch_file(self._qout._reader, self.result_callback)
#}}}
    def execute_query(self, qout):#{{{
        from sqlalchemy import create_engine
        fresh_engine = create_engine(get_current_config().database_uri)
        self._subquery.session.bind = fresh_engine
        qout.put([(d.vendedor, d.total, d.tipo) for d in self._subquery])
        qout.close()
#}}}
    def result_callback(self):#{{{
        result = self._qout.get()
        vend = get_current_config().vendedores
        data = defaultdict(lambda: defaultdict(list))
        k0 = itemgetter(0)
        k1 = itemgetter(1)
#.........这里部分代码省略.........
开发者ID:coyotevz,项目名称:nobix,代码行数:103,代码来源:viewer.py

示例7: Listado

# 需要导入模块: from urwid import Frame [as 别名]
# 或者: from urwid.Frame import set_footer [as 别名]
class Listado(Dialog):#{{{

    def __init__(self, title=None, stitle=None, list_header=None):#{{{
        self._check_methods()

        query = self.build_query()
        max_rows = self.build_max_rows()

        self.walker = QueryWalker(query, self.formatter, max_rows, self.row_adapter, self.result_callback)
        querylist = ListBox(self.walker)

        header_row = []
        title_row = []

        if title:
            title_row.append(('listado.title.important', title))
        if stitle:
            title_row.append(stitle)

        if len(title_row) > 0:
            header_row.append(AttrMap(Text(title_row, align='center', wrap='clip'), 'listado.title'))

        if list_header:
            header_row.append(AttrMap(list_header, 'listado.list_header'))

        if len(header_row) > 0:
            header = Pile(header_row)
        else:
            header = None

        footer = Text("Calculando ...")
        self.short_footer = None
        self.large_footer = None
        self._current_footer = 0

        self.content = Frame(
                AttrMap(querylist, 'listado.body'),
                header=header,
                footer=AttrMap(footer, 'listado.footer'))

        self.__super.__init__(self.content,
                height=('relative', 100),
                width=('relative', 100),
                with_border=False)
#}}}
    def _check_methods(self):#{{{
        for meth in ('build_query', 'build_max_rows', 'formatter', 'row_adapter', 'result_callback'):
            method = getattr(self, meth, None)
            if not method:
                raise NotImplementedError("'%s' must be implemented in subclasses of Listado" % meth)
            if not callable(method):
                raise RuntimeError("'%s.%s' must be callable method to run properly" %\
                        (type(self).__name__, meth))
#}}}
    def keypress(self, key):#{{{
        if key in ('enter', 'esc', ' ', 'f10'):
            self.quit()
        elif key in ('v', 'V'):
            self.switch_footer()
        return self.__super.keypress(key)
#}}}
    def configure_subloop(self, subloop):#{{{
        self.walker.connect_watcher(subloop)
#}}}
    def quit(self, *args):#{{{
        self.walker.stop_workers()
        return self.__super.quit(*args)
#}}}
    def switch_footer(self):#{{{
        if self.large_footer and self.short_footer:
            self.content.set_footer((self.short_footer, self.large_footer)[self._current_footer])
            self._current_footer = 1 - (1 * self._current_footer)
#}}}
    def run(self):#{{{
        message_waiter(u" Procesando información ... ")
        return self.__super.run()
开发者ID:coyotevz,项目名称:nobix,代码行数:78,代码来源:viewer.py

示例8: PegasusGUI

# 需要导入模块: from urwid import Frame [as 别名]
# 或者: from urwid.Frame import set_footer [as 别名]
class PegasusGUI(WidgetWrap):
    key_conversion_map = {'tab': 'down', 'shift tab': 'up'}

    def __init__(self, header=None, body=None, footer=None):
        self.header = header if header else Header()
        self.body = body if body else Banner()
        self.footer = footer if footer else StatusBarWidget()

        self.frame = Frame(self.body,
                           header=self.header,
                           footer=self.footer)

        self.services_view = None
        self.placement_view = None
        self.controller = None
        self.machine_wait_view = None
        self.node_install_wait_view = None
        self.add_services_dialog = None
        super().__init__(self.frame)

    def keypress(self, size, key):
        key = self.key_conversion_map.get(key, key)
        return super().keypress(size, key)

    def focus_next(self):
        if hasattr(self.frame.body, 'scroll_down'):
            self.frame.body.scroll_down()

    def focus_previous(self):
        if hasattr(self.frame.body, 'scroll_up'):
            self.frame.body.scroll_up()

    def focus_first(self):
        if hasattr(self.frame.body, 'scroll_top'):
            self.frame.body.scroll_top()

    def focus_last(self):
        if hasattr(self.frame.body, 'scroll_bottom'):
            self.frame.body.scroll_bottom()

    def show_help_info(self):
        self.controller = self.frame.body
        self.frame.body = HelpView()

    def show_step_info(self, msg):
        self.frame.body = StepInfoView(msg)

    def show_selector_with_desc(self, title, opts, cb):
        self.frame.body = SelectorWithDescriptionWidget(title, opts, cb)

    def show_password_input(self, title, cb):
        self.frame.body = PasswordInput(title, cb)

    def show_maas_input(self, title, cb):
        self.frame.body = MaasServerInput(title, cb)

    def show_landscape_input(self, title, cb):
        self.frame.body = LandscapeInput(title, cb)

    def set_pending_deploys(self, pending_charms):
        self.frame.footer.set_pending_deploys(pending_charms)

    def status_message(self, text):
        self.frame.footer.message(text)
        self.frame.set_footer(self.frame.footer)

    def status_error_message(self, message):
        self.frame.footer.error_message(message)

    def status_info_message(self, message):
        self.frame.footer.info_message(
            "{}\N{HORIZONTAL ELLIPSIS}".format(message))

    def set_openstack_rel(self, release):
        self.frame.header.set_openstack_rel(release)

    def clear_status(self):
        self.frame.footer = None
        self.frame.set_footer(self.frame.footer)

    def render_services_view(self, nodes, juju_state, maas_state, config):
        self.services_view = ServicesView(nodes, juju_state, maas_state,
                                          config)
        self.frame.body = self.services_view
        self.header.set_show_add_units_hotkey(True)
        self.update_phase_status(config)

    def refresh_services_view(self, nodes, config):
        self.services_view.refresh_nodes(nodes)
        self.update_phase_status(config)

    def update_phase_status(self, config):
        dc = config.getopt('deploy_complete')
        dcstr = "complete" if dc else "pending"
        rc = config.getopt('relations_complete')
        rcstr = "complete" if rc else "pending"
        ppc = config.getopt('postproc_complete')
        ppcstr = "complete" if ppc else "pending"
        self.status_info_message("Status: Deployments {}, "
                                 "Relations {}, "
#.........这里部分代码省略.........
开发者ID:mikemccracken,项目名称:cloud-installer,代码行数:103,代码来源:gui.py

示例9: PegasusGUI

# 需要导入模块: from urwid import Frame [as 别名]
# 或者: from urwid.Frame import set_footer [as 别名]
class PegasusGUI(WidgetWrap):
    key_conversion_map = {'tab': 'down', 'shift tab': 'up'}

    def __init__(self, header=None, body=None, footer=None):
        self.header = header if header else Header()
        self.body = body if body else Banner()
        self.footer = footer if footer else StatusBarWidget()

        self.frame = Frame(self.body,
                           header=self.header,
                           footer=self.footer)

        self.services_view = None
        self.placement_view = None
        self.controller = None
        self.machine_wait_view = None
        self.node_install_wait_view = None
        self.add_services_dialog = None
        super().__init__(self.frame)

    def keypress(self, size, key):
        key = self.key_conversion_map.get(key, key)
        return super().keypress(size, key)

    def focus_next(self):
        if hasattr(self.frame.body, 'scroll_down'):
            self.frame.body.scroll_down()

    def focus_previous(self):
        if hasattr(self.frame.body, 'scroll_up'):
            self.frame.body.scroll_up()

    def focus_first(self):
        if hasattr(self.frame.body, 'scroll_top'):
            self.frame.body.scroll_top()

    def focus_last(self):
        if hasattr(self.frame.body, 'scroll_bottom'):
            self.frame.body.scroll_bottom()

    def show_help_info(self):
        self.controller = self.frame.body
        self.frame.body = HelpView()

    def show_step_info(self, msg):
        self.frame.body = StepInfoView(msg)

    def show_selector_with_desc(self, title, opts, cb):
        self.frame.body = SelectorWithDescriptionWidget(title, opts, cb)

    def show_password_input(self, title, cb):
        self.frame.body = PasswordInput(title, cb)

    def show_maas_input(self, title, cb):
        self.frame.body = MaasServerInput(title, cb)

    def show_landscape_input(self, title, cb):
        self.frame.body = LandscapeInput(title, cb)

    def set_pending_deploys(self, pending_charms):
        self.frame.footer.set_pending_deploys(pending_charms)

    def status_message(self, text):
        self.frame.footer.message(text)
        self.frame.set_footer(self.frame.footer)

    def status_error_message(self, message):
        self.frame.footer.error_message(message)

    def status_info_message(self, message):
        self.frame.footer.info_message(
            "{}\N{HORIZONTAL ELLIPSIS}".format(message))

    def set_openstack_rel(self, release):
        self.frame.header.set_openstack_rel(release)

    def clear_status(self):
        self.frame.footer = None
        self.frame.set_footer(self.frame.footer)

    def render_services_view(self, nodes, juju_state, maas_state, config):
        self.services_view = ServicesView(nodes, juju_state, maas_state,
                                          config)
        self.frame.body = self.services_view
        self.header.set_show_add_units_hotkey(True)
        self.update_phase_status(config)

    def refresh_services_view(self, nodes, config):
        self.services_view.refresh_nodes(nodes)
        self.update_phase_status(config)

    def update_phase_status(self, config):
        dc = config.getopt('deploy_complete')
        dcstr = "complete" if dc else "pending"
        rc = config.getopt('relations_complete')
        rcstr = "complete" if rc else "pending"
        ppc = config.getopt('postproc_complete')
        ppcstr = "complete" if ppc else "pending"
        self.status_info_message("Status: Deployments {}, "
                                 "Relations {}, "
#.........这里部分代码省略.........
开发者ID:battlemidget,项目名称:openstack-installer,代码行数:103,代码来源:gui.py


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