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


Python urwid.Pile方法代码示例

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


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

示例1: edit

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Pile [as 别名]
def edit(title):
    try:
        text, verify = wiki.init_edit(title)
        wiki.login()

        newtext = runEditor(text)
        if newtext == text:
            ex.notify('Edit Canceled: No Change')
            return

        def submit(button):
            closeOverlay()
            wiki.commit_edit(newtext, summary.edit_text,
                             minor.get_state(), verify)
            openPage(title)
        def cancel(button):
            closeOverlay()
        summary = urwid.Edit('Summary: ')
        minor = urwid.CheckBox('Minor Edit')
        cancel_button = urwid.Button('Cancel', cancel)
        submit_button = urwid.Button('Submit', submit)
        pile = urwid.Pile([summary, minor, cancel_button, submit_button])
        openOverlay(pile, 'Edit', 'pack')
    except WikiError as e:
        ex.notify('Error: ' + str(e)) 
开发者ID:ids1024,项目名称:wikicurses,代码行数:27,代码来源:main.py

示例2: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Pile [as 别名]
def __init__(self, key=None, value=('', '')):
        self.trigger = key
        self.yn = value[0]
        self.yn_but = MyButton([('attention', 'Use proxy: '), self.yn], self.on_change)
        self.input_addr = urwid.Edit(('attention', u' \N{BULLET} Address  : '), edit_text=value[1], wrap='clip')
        self.input_port = urwid.IntEdit(('attention', u' \N{BULLET} Port     : '), default=value[2])
        self.input_port.set_wrap_mode('clip')
        exit_but = urwid.Padding(urwid.Button('OKay'.center(8), self.item_callback), 'center', 12)

        widgets = [self.yn_but] \
                  + [urwid.AttrMap(wid, None, 'popbgs') for wid in (self.input_addr, self.input_port, exit_but)]

        self.pile = urwid.Pile(widgets)
        fill = urwid.LineBox(urwid.Filler(self.pile))
        self.__super.__init__(urwid.AttrWrap(fill, 'popbg'))

        self.chosen = value 
开发者ID:Dragon2fly,项目名称:vpngate-with-proxy,代码行数:19,代码来源:ui_elements.py

示例3: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Pile [as 别名]
def __init__(self, topics_btn_list: List[Any], view: Any,
                 stream_button: Any) -> None:
        self.view = view
        self.log = urwid.SimpleFocusListWalker(topics_btn_list)
        self.topics_btn_list = topics_btn_list
        self.stream_button = stream_button
        self.focus_index_before_search = 0
        self.list_box = urwid.ListBox(self.log)
        self.topic_search_box = PanelSearchBox(self,
                                               'SEARCH_TOPICS',
                                               self.update_topics)
        self.header_list = urwid.Pile([self.stream_button,
                                       urwid.Divider('─'),
                                       self.topic_search_box])
        super().__init__(self.list_box, header=urwid.LineBox(
            self.header_list, tlcorner='─', tline='', lline='',
            trcorner='─', blcorner='─', rline='',
            bline='─', brcorner='─'
        ))
        self.search_lock = threading.Lock() 
开发者ID:zulip,项目名称:zulip-terminal,代码行数:22,代码来源:views.py

示例4: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Pile [as 别名]
def __init__(self, exit_code):
        self.exit_code = exit_code
        self.message = Text('Do you want to quit?', align='center')
        super().__init__(LineBox(Pile([
            Padding.line_break(""),
            self.message,
            Padding.line_break(""),
            Columns([
                Text(""),
                SubmitButton('Yes', lambda _: self.confirm()),
                Text(""),
                SubmitButton('No', lambda _: self.cancel()),
                Text(""),
            ]),
            Padding.line_break(""),
        ])))
        if events.Error.is_set():
            self.confirm() 
开发者ID:conjure-up,项目名称:conjure-up,代码行数:20,代码来源:shutdown.py

示例5: _build_footer

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Pile [as 别名]
def _build_footer(self):
        no = menu_btn(on_press=self.cancel,
                      label="\n  NO\n")
        yes = menu_btn(on_press=self.submit,
                       label="\n  YES\n")
        self.buttons = Columns([
            ('fixed', 2, Text("")),
            ('fixed', 11, Color.menu_button(
                no,
                focus_map='button_primary focus')),
            Text(""),
            ('fixed', 11, Color.menu_button(
                yes,
                focus_map='button_primary focus')),
            ('fixed', 2, Text(""))
        ])

        self.footer = Pile([
            Padding.line_break(""),
            self.buttons
        ])
        return Color.frame_footer(self.footer) 
开发者ID:conjure-up,项目名称:conjure-up,代码行数:24,代码来源:destroy_confirm.py

示例6: build_widget

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Pile [as 别名]
def build_widget(self):
        self.widgets = {}
        rows = [
            Columns([
                ('fixed', 3, Text('')),
                ('weight', 0.1, Text('Application')),
                ('weight', 0.4, Text('Result'))
            ], dividechars=5),
            HR(),
        ]
        for step in app.all_steps:
            if not step.has_after_deploy:
                continue
            widget = StepResult(step)
            self.widgets[step.name] = widget
            rows.extend([
                widget,
                HR(),
            ])
        self.pile = Pile(rows)
        return self.pile 
开发者ID:conjure-up,项目名称:conjure-up,代码行数:23,代码来源:steps.py

示例7: build

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Pile [as 别名]
def build(self):
        environments = db.get_environment_names()
        reports = [None] + db.get_report_names()

        self._envsel = widgets.ListScrollSelector(environments)
        self._repsel = widgets.ListScrollSelector(reports)
        self._tclist = urwid.SimpleListWalker([])
        butcols = urwid.Columns([
                ("pack", urwid.Text("environment:")),
                AM(self._envsel, "selectable", "butfocus"),
                ("pack", urwid.Text("report:")),
                AM(self._repsel, "selectable", "butfocus"),
            ], dividechars=2)
        header = urwid.Pile([
        AM(urwid.Text("Select environment, report, and set options. Use Tab to switch to environment selector. Selected:"), "subhead"),
                urwid.BoxAdapter(urwid.ListBox(self._tclist), 2),
                butcols,
        ])
        body = self._build_test_selector(False)
        return urwid.Frame(body, header=header, focus_part="body") 
开发者ID:kdart,项目名称:pycopia,代码行数:22,代码来源:runner.py

示例8: get_form_buttons

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Pile [as 别名]
def get_form_buttons(self, defaultdata=None, create=False):
        ok = urwid.Button("OK")
        urwid.connect_signal(ok, 'click', self._ok, defaultdata)
        ok = AM(ok, 'selectable', 'butfocus')
        cancel = urwid.Button("Cancel")
        urwid.connect_signal(cancel, 'click', self._cancel)
        cancel = AM(cancel, 'selectable', 'butfocus')
        l = [ok, cancel]
        if create:
            ok_edit = urwid.Button("OK and Edit")
            urwid.connect_signal(ok_edit, 'click', self._ok_and_edit, defaultdata)
            ok_edit = AM(ok_edit, 'selectable', 'butfocus')
            l = [ok, ok_edit, cancel]
        else:
            l = [ok, cancel]
        butgrid = urwid.GridFlow(l, 15, 3, 1, 'center')
        return urwid.Pile([urwid.Divider(), butgrid ], focus_item=1) 
开发者ID:kdart,项目名称:pycopia,代码行数:19,代码来源:widgets.py

示例9: build

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Pile [as 别名]
def build(self):
        header = urwid.Pile([
                urwid.AttrMap(urwid.Text("Create Equipment"), "formhead"),
                urwid.AttrMap(urwid.Text("Arrow keys navigate, Enter to select form button. Type into other fields."), "formhead"),
                urwid.Divider(),
                ])
        formstack = []
        for groupname, group in [
                (None, ("model", "name", "serno")),
                ("Localization", ("language",)),
                ("Asset management", ("owner", "location", "sublocation", "vendor")),
                ("Automation", ("account",)),
                ("structural relationship", ('parent',)),
                ("Addtional Info", ("comments",)),
                ]:
            if groupname:
                formstack.append(self.build_divider(groupname))
            for colname in group:
                colmd = self.metadata[colname]
                wid = self.build_input(colmd)
                formstack.append(wid)
        data = self.get_default_data(["active", "addeddate"])
        formstack.append(self.get_form_buttons(data, create=True))
        listbox = urwid.ListBox(urwid.SimpleListWalker(formstack))
        return urwid.Frame(urwid.AttrMap(listbox, 'body'), header=header) 
开发者ID:kdart,项目名称:pycopia,代码行数:27,代码来源:widgets.py

示例10: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Pile [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

示例11: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Pile [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

示例12: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Pile [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

示例13: set_y_label

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Pile [as 别名]
def set_y_label(self, y_label):
        if not y_label:
            text = urwid.Text("1")
            pile = urwid.Pile([urwid.ListBox([text])])
            self.y_label = ('fixed', 1, pile)
            return

        str_y_label = [str(i) for i in y_label]
        y_label_nums = str_y_label[1:]
        y_list_walker = [(1, urwid.ListBox([urwid.Text(str_y_label[0])]))]

        for num in y_label_nums:
            y_list_walker = [urwid.ListBox([urwid.Text(num)])] + y_list_walker

        y_list_walker = urwid.Pile(y_list_walker, focus_item=0)
        y_scale_len = len(max(str_y_label, key=len))

        self.y_label = ('fixed', y_scale_len, y_list_walker) 
开发者ID:amanusk,项目名称:s-tui,代码行数:20,代码来源:complex_bar_graph.py

示例14: generate_content

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Pile [as 别名]
def generate_content(status_code):
    try:
        code_descriptions, num, status_code = get_yaml_dictionary(status_code)
        content = code_descriptions[status_code]
        pile = urwid.Pile([
            urwid.Text("STATCODE: The Manual for HTTP Status Codes and Headers\n", align="center"),
            urwid.Text(("title", "STATUS MESSAGE" if num else "HEADER INFO")),
            urwid.Padding(
                urwid.Text(''.join([str(status_code), ": " if num else ", Example= ", content["message"], '\n'])),
                left=5),
            urwid.Text(("title", "CATEGORY")),
            urwid.Padding(urwid.Text(''.join([content["category"], '\n'])), left=5),
            urwid.Text(("title", "DESCRIPTION")),
            urwid.Padding(urwid.Text(''.join([content["description"], '\n'])), left=5),
            urwid.Text(("title", "COPYRIGHT")),
            urwid.Padding(urwid.Text(''.join([__load_file_data(num), '\n'])), left=5),
        ])
        padding = urwid.Padding(Scrollable(pile), left=1, right=1)

        return padding
    except KeyError:  # None is used to print "not recognized", so KeyError. Other errors have nothing to do with it
        return None 
开发者ID:shobrook,项目名称:statcode,代码行数:24,代码来源:statcode.py

示例15: _find_match_indexes

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import Pile [as 别名]
def _find_match_indexes(self, size):
        phrase = self._search_phrase
        case_sensitive = self._case_sensitive

        def row_matches(row):
            for _,_,text in row:
                text_dec = text.decode()
                if case_sensitive and phrase in text_dec:
                    return True
                elif not case_sensitive and phrase in text_dec.casefold():
                    return True
            return False

        # Render the full Pile canvas because long lines can cause line breaks
        # and so we can't just get indexes from self._lines.
        full_canv = self._w.base_widget.render((size[0],), False)
        indexes = []
        for i,row in enumerate(full_canv.content()):
            if row_matches(row):
                indexes.append(i)
        self._match_indexes = indexes 
开发者ID:rndusr,项目名称:stig,代码行数:23,代码来源:text.py


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