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


Python urwid.WidgetPlaceholder方法代码示例

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


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

示例1: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import WidgetPlaceholder [as 别名]
def __init__(self, user, typing=None, is_read_only=False):
        self.read_only_widget = urwid.Text('You have no power here!', align='center')
        if typing != None:
            top_separator = TextDivider(('is_typing', '{} {} is typing...'.format(
                get_icon('keyboard'),
                typing
            )))
        else:
            top_separator = urwid.Divider('─')
        self.prompt_widget = MessagePrompt(user)
        middle = urwid.WidgetPlaceholder(self.read_only_widget if is_read_only else self.prompt_widget)
        self.body = urwid.Pile([
            urwid.WidgetPlaceholder(top_separator),
            middle,
            urwid.Divider('─')
        ])
        self._typing = typing
        super(MessageBox, self).__init__(self.body, None, {'prompt': 'active_prompt'}) 
开发者ID:haskellcamargo,项目名称:sclack,代码行数:20,代码来源:components.py

示例2: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import WidgetPlaceholder [as 别名]
def __init__(self, ts, channel_id, user, text, indicators, reactions=(), attachments=()):
        self.ts = ts
        self.channel_id = channel_id
        self.user_id = user.id
        self.markdown_text = text
        self.original_text = text.original_text
        self.text_widget = urwid.WidgetPlaceholder(text)
        main_column = [urwid.Columns([('pack', user), self.text_widget])]
        main_column.extend(attachments)
        self._file_index = len(main_column)
        if reactions:
            main_column.append(urwid.Columns([
                ('pack', reaction) for reaction in reactions
            ]))
        self.main_column = urwid.Pile(main_column)
        columns = [
            ('fixed', 7, Time(ts)),
            self.main_column,
            ('fixed', indicators.size, indicators)
        ]
        self.contents = urwid.Columns(columns)
        super(Message, self).__init__(self.contents, None, {
            None: 'active_message',
            'message': 'active_message'
        }) 
开发者ID:haskellcamargo,项目名称:sclack,代码行数:27,代码来源:message.py

示例3: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import WidgetPlaceholder [as 别名]
def __init__(self, provider, date):

        self.game_date = date

        self.toolbar = Toolbar()
        urwid.connect_signal(
            self.toolbar, "provider_change",
            lambda w, p: self.set_provider(p)
        )

        self.table_placeholder = urwid.WidgetPlaceholder(urwid.Text(""))

        self.datebar = DateBar(self.game_date)
        # self.table = GamesDataTable(self.toolbar.sport_id, self.game_date) # preseason
        self.pile  = urwid.Pile([
            (1, self.toolbar),
            (1, self.datebar),
            ("weight", 1, self.table_placeholder)
        ])
        self.pile.focus_position = 2

        super(ScheduleView, self).__init__(self.pile)
        self.set_provider(provider) 
开发者ID:tonycpsu,项目名称:mlbstreamer,代码行数:25,代码来源:__main__.py

示例4: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import WidgetPlaceholder [as 别名]
def __init__(self,
                 title,
                 sub_title_list,
                 y_label,
                 bar_graph_vector,
                 visible_graph_list):
        for bar_graph in bar_graph_vector:
            if not isinstance(bar_graph, ScalableBarGraph):
                raise Exception(
                    'graph vector items must be ScalableBarGraph')
        if not self.check_label(y_label):
            raise Exception(
                'Y label must be a valid label')

        self.visible_graph_list = visible_graph_list
        self.bar_graph_vector = []
        self.set_graph(bar_graph_vector)

        self.y_label_and_graphs = urwid.WidgetPlaceholder(urwid.Columns([]))
        self.y_label = []
        self.set_y_label(y_label)

        list_w = urwid.ListBox(urwid.SimpleFocusListWalker([]))
        self.title = urwid.WidgetPlaceholder(list_w)
        self.sub_title_list = sub_title_list
        self.set_title(title)

        super(LabeledBarGraphVector, self).__init__(urwid.Pile([]))
        self.set_visible_graphs(visible_graph_list) 
开发者ID:amanusk,项目名称:s-tui,代码行数:31,代码来源:complex_bar_graph.py

示例5: set_visible_graphs

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import WidgetPlaceholder [as 别名]
def set_visible_graphs(self, visible_graph_list=None):
        """Show a column of the graph selected for display"""
        if visible_graph_list is None:
            visible_graph_list = self.visible_graph_list

        vline = urwid.AttrWrap(urwid.SolidFill(u'|'), 'line')

        graph_vector_column_list = []
        for state, graph, sub_title in zip(visible_graph_list,
                                           self.bar_graph_vector,
                                           self.sub_title_list):
            if state:
                text_w = urwid.Text(sub_title, align='center')
                sub_title_widget = urwid.ListBox([text_w])
                graph_a = [('fixed', 1, sub_title_widget),
                           ('weight', 1, graph)]
                graph_and_title = urwid.Pile(graph_a)
                graph_vector_column_list.append(('weight', 1, graph_and_title))
                graph_vector_column_list.append(('fixed', 1, vline))

        # if all sub graph are disabled
        if not graph_vector_column_list:
            self.visible_graph_list = visible_graph_list
            self.original_widget = urwid.Pile([])
            return

        # remove the last vertical line separator
        graph_vector_column_list.pop()

        y_label_a = ('weight', 1, urwid.Columns(graph_vector_column_list))
        y_label_and_graphs = [self.y_label,
                              y_label_a]
        column_w = urwid.Columns(y_label_and_graphs, dividechars=1)
        y_label_and_graphs_widget = urwid.WidgetPlaceholder(column_w)

        init_widget = urwid.Pile([('fixed', 1, self.title),
                                  ('weight', 1, y_label_and_graphs_widget)])

        self.visible_graph_list = visible_graph_list
        self.original_widget = init_widget 
开发者ID:amanusk,项目名称:s-tui,代码行数:42,代码来源:complex_bar_graph.py

示例6: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import WidgetPlaceholder [as 别名]
def __init__(self, controller):
        # constants
        self.left_margin = 0
        self.top_margin = 0

        # main control
        self.controller = controller
        self.main_window_w = []

        # general urwid items
        self.clock_view = urwid.Text(ZERO_TIME, align="center")
        self.refresh_rate_ctrl = urwid.Edit((u'Refresh[s]:'),
                                            self.controller.refresh_rate)
        self.hline = urwid.AttrWrap(urwid.SolidFill(u' '), 'line')

        self.mode_buttons = []

        self.summary_widget_index = None

        # Visible graphs are the graphs currently displayed, this is a
        # subset of the available graphs for display
        self.graph_place_holder = urwid.WidgetPlaceholder(urwid.Pile([]))

        # construct the various menus during init phase
        self.stress_menu = StressMenu(self.on_menu_close,
                                      self.controller.stress_exe)
        self.help_menu = HelpMenu(self.on_menu_close)
        self.about_menu = AboutMenu(self.on_menu_close)
        self.graphs_menu = SensorsMenu(self.on_graphs_menu_close,
                                       self.controller.sources,
                                       self.controller.graphs_default_conf)
        self.summary_menu = SensorsMenu(self.on_summary_menu_close,
                                        self.controller.sources,
                                        self.controller.summary_default_conf)

        # call super
        urwid.WidgetPlaceholder.__init__(self, self.main_window())
        urwid.connect_signal(self.refresh_rate_ctrl, 'change',
                             self.update_refresh_rate) 
开发者ID:amanusk,项目名称:s-tui,代码行数:41,代码来源:s_tui.py

示例7: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import WidgetPlaceholder [as 别名]
def __init__(self, main_widget):
        self._main_widget = main_widget
        self._pop_up = urwid.Frame(urwid.WidgetPlaceholder(None))
        self._w_placeholder = urwid.WidgetPlaceholder(self._main_widget)
        self._pop_up_overlay = urwid.Overlay(urwid.LineBox(self._pop_up),
                                            self._main_widget,
                                            'center',
                                            ('relative', 60),
                                            'middle',
                                            ('relative', 60)) 
开发者ID:topisani,项目名称:Discurses,代码行数:12,代码来源:has_modal.py


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