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

Python urwid.Frame类代码示例

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

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



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

示例1: __init__

    def __init__(self, loop):
        header = [AttrWrap(Text(TITLE_TEXT), "border"),
                  AttrWrap(Text('(Q) Quit'), "border"),
                  AttrWrap(Text('(F5) Refresh'), "border"),
                  AttrWrap(Text('(F6) Add units'), "border"),
                  AttrWrap(Text('(F8) Console'), "border")]
        header = Columns(header)
        self.timer = Text("", align="left")
        self.status_info = Text("", align="left")
        self.horizon_url = Text("", align="right")
        self.jujugui_url = Text("", align="right")
        footer = Columns([('weight', 0.2, self.status_info),
                          ('weight', 0.1, self.timer),
                          ('weight', 0.2, self.horizon_url),
                          ('weight', 0.2, self.jujugui_url)])
        footer = AttrWrap(footer, "border")
        self.poll_interval = 10
        self.ticks_left = 0
        self.juju_state = None
        self.maas_state = None
        self.nodes = ListWithHeader(NODE_HEADER)
        self.loop = loop

        self.cr = CommandRunner()
        Frame.__init__(self, header=header, body=self.nodes,
                       footer=footer)
        self.controller_overlay = ControllerOverlay(self, self.cr)
        self._target = self.controller_overlay
开发者ID:BoydYang,项目名称:cloud-installer,代码行数:28,代码来源:gui.py


示例2: __init__

 def __init__(self,
              configuration):
     Frame.__init__(self,
                    WelcomeBuffer(),
                    header=TabsWidget(),
                    footer=StatusBar(''))
     self._configuration = configuration
     self._editor_mode = False
开发者ID:gigigi,项目名称:turses,代码行数:8,代码来源:ui.py


示例3: create_interface

    def create_interface(self):
        self.screen = Screen()
        self.screen.start()

        self.screen.register_palette([
            ("title", "white", "dark blue", "standout"),
            ("line", "light gray", "black"),
            ("help", "white", "dark blue")]
        )

        self.body = ListBox(SimpleListWalker([]))
        self.lines = self.body.body

        self.title = Text(MAIN_TITLE)
        self.header = AttrWrap(self.title, "title")

        self.help = AttrWrap(
            Text(HELP_STRINGS["main"]),
            "help"
        )

        self.input = Edit(caption="%s> " % self.ircchannel)
        self.footer = Pile([self.help, self.input])

        self.top = Frame(self.body, self.header, self.footer)
开发者ID:spaceone,项目名称:circuits,代码行数:25,代码来源:circ.py


示例4: __init__

    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)
开发者ID:coyotevz,项目名称:nobix,代码行数:56,代码来源:viewer.py


示例5: keypress

    def keypress(self, size, key):
        """ Signal binding for NodeViewMode

        Keys:

        * F5 - Refreshes the node list
        """
        if key == 'f5':
            self.ticks_left = 0
        return Frame.keypress(self, size, key)
开发者ID:BoydYang,项目名称:cloud-installer,代码行数:10,代码来源:gui.py


示例6: __init__

    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)
开发者ID:gitter-badger,项目名称:cloud-installer,代码行数:11,代码来源:gui.py


示例7: __init__

    def __init__(self, header=None, body=None, footer=None):
        _check_encoding()  # Make sure terminal supports utf8
        self.header = header if header else Header()
        self.body = body if body else Banner()
        self.footer = footer if footer else StatusBar('')

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

        self.placement_view = None
        super().__init__(self.frame)
开发者ID:sparkiegeek,项目名称:openstack-installer,代码行数:12,代码来源:gui.py


示例8: __init__

    def __init__(self,
                 configuration):
        self._configuration = configuration
        self._editor = None

        # header
        header = TabsWidget()

        # body
        body = Banner(configuration)

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

        Frame.__init__(self,
                       body,
                       header=header,
                       footer=footer)
开发者ID:1reza,项目名称:turses,代码行数:22,代码来源:ui.py


示例9: __init__

    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)
开发者ID:mikemccracken,项目名称:cloud-installer,代码行数:16,代码来源:gui.py


示例10: __init__

    def __init__(self, header=None, body=None, footer=None):
        _check_encoding()  # Make sure terminal supports utf8
        cb = self.show_exception_message
        utils.register_async_exception_callback(cb)
        self.header = header if header else Header()
        self.body = body if body else Banner()
        self.footer = footer if footer else StatusBar("")

        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.add_services_dialog = None
        super().__init__(self.frame)
开发者ID:kavinsivak,项目名称:openstack-installer,代码行数:16,代码来源:gui.py


示例11: __init__

    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)
开发者ID:rnhmjoj,项目名称:turses,代码行数:19,代码来源:ui.py


示例12: __init__

    def __init__(self, configuration):
        self._configuration = configuration
        self._editor = None

        # header
        header = TabsWidget()

        # body
        body = Banner(configuration)

        # 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)

        WidgetWrap.__init__(self, self.frame)
开发者ID:ivanov,项目名称:turses,代码行数:20,代码来源:ui.py


示例13: PegasusGUI

class PegasusGUI(WidgetWrap):

    def __init__(self, header=None, body=None, footer=None):
        _check_encoding()  # Make sure terminal supports utf8
        cb = self.show_exception_message
        utils.register_async_exception_callback(cb)
        self.header = header if header else Header()
        self.body = body if body else Banner()
        self.footer = footer if footer else StatusBar('')

        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.add_services_dialog = None
        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):
        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 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):
        self.hide_step_info()
        widget = StepInfo(msg)
        self.show_widget_on_top(widget, width=60,
                                height=14,
                                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)

#.........这里部分代码省略.........
开发者ID:pmondal08,项目名称:openstack-installer,代码行数:101,代码来源:gui.py


示例14: CursesInterface

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,代码行数:101,代码来源:ui.py


示例15: PegasusGUI

class PegasusGUI(WidgetWrap):

    def __init__(self, header=None, body=None, footer=None):
        _check_encoding()  # Make sure terminal supports utf8
        self.header = header if header else Header()
        self.body = body if body else Banner()
        self.footer = footer if footer else StatusBar('')

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

        self.placement_view = None
        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, 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):
#.........这里部分代码省略.........
开发者ID:sparkiegeek,项目名称:openstack-installer,代码行数:101,代码来源:gui.py


示例16: PegasusGUI

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,代码行数:101,代码来源:gui.py


示例17: PegasusGUI

class PegasusGUI(WidgetWrap):
    key_conversion_map = {"tab": "down", "shift tab": "up"}

    def __init__(self, header=None, body=None, footer=None):
        _check_encoding()  # Make sure terminal supports utf8
        cb = self.show_exception_message
        utils.register_async_exception_callback(cb)
        self.header = header if header else Header()
        self.body = body if body else Banner()
        self.footer = footer if footer else StatusBar("")

        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.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 _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):
        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 hide_widget_on_top(self):
        """Hide the topmost widget (if any)."""
        self._w = self.frame

    def show_help_info(self):
        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()

#.........这里部分代码省略.........
开发者ID:kavinsivak,项目名称:openstack-installer,代码行数:101,代码来源:gui.py


示例18: PegasusGUI

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,代码行数:101,代码来源:gui.py


示例19: Listado

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,代码行数:76,代码来源:viewer.py


示例20: SubDiarioVentasTree

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.p 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python urwid.ListBox类代码示例发布时间:2022-05-27
下一篇:
Python urwid.Edit类代码示例发布时间: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