Python urwid.Padding() Examples

The following are 30 code examples of urwid.Padding(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module urwid , or try the search function .
Example #1
Source File: networking.py    From ceph-ansible-copilot with GNU Lesser General Public License v2.1 6 votes vote down vote up
def render_page(self):

        return urwid.AttrMap(
                 urwid.Filler(
                   urwid.Pile([
                     urwid.Padding(
                       urwid.Text(self.text),
                       left=2, right=2),
                     urwid.Divider(),
                     urwid.Columns([
                         urwid.Pile([
                             urwid.Text("Public Network", align="center"),
                             urwid.Padding(self.public_buttons,left=4)
                         ]),
                         urwid.Pile([
                             urwid.Text("Cluster Network", align="center"),
                             urwid.Padding(self.cluster_buttons, left=4)
                         ])
                     ]),
                     urwid.Divider(),
                     self.next_btn
                   ]),
                   valign='top', top=1),
                 'active_step') 
Example #2
Source File: view.py    From binch with MIT License 6 votes vote down vote up
def __init__(self, filename):
        self.header = urwid.Text(" BINCH: %s" % (filename))

        self.disasmblr = Disassembler(filename)

        items = self.setup_list(True)
        self.disasmlist = DisassembleList(items)
        start_index = self.find_index(self.disasmblr.entry)
        if start_index != -1:
            self.disasmlist.set_focus(start_index)

        self.history = list()

        self.body = urwid.Padding(self.disasmlist, 'center', 105)
        self.body = urwid.Filler(self.body, ('fixed top',1), ('fixed bottom',1))

        self.footer = StatusBar("HotKeys -> g: Go to a address | s: Save | d: Remove | enter: Modify | q: Quit", self)
        self.view = DisassembleWindow(self,
                urwid.AttrWrap(self.body, 'body'),
                urwid.AttrWrap(self.header, 'head'),
                self.footer)

        signals.call_delay.connect(self.sig_call_delay) 
Example #3
Source File: statcode.py    From statcode with MIT License 6 votes vote down vote up
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 
Example #4
Source File: ui.py    From yTermPlayer with GNU General Public License v3.0 6 votes vote down vote up
def start_screen(self):
        #Ovrlay top screen at start
        txt1_1=urwid.Button("New playlist [Enter URL]")
        urwid.connect_signal(txt1_1, 'click', self.input_screen)
        txt1 = urwid.AttrMap(txt1_1,None,focus_map='reversed')
        txt2_2=urwid.Button("Load saved playlist")
        urwid.connect_signal(txt2_2, 'click', self.load_list_screen)
        txt2 = urwid.AttrMap(txt2_2,None,focus_map='reversed')
        start_list=urwid.SimpleFocusListWalker([txt1,txt2])
        box=urwid.ListBox(start_list)
        selection=urwid.LineBox(
                                box, title='', title_align='center',
                                tlcorner='┌', tline='─', lline='│',
                                trcorner='┐', blcorner='└', rline='│',
                                bline='─', brcorner='┘'
                                )
        selection_with_padding=urwid.Padding(selection,left=2,right=2)
        return selection_with_padding 
Example #5
Source File: widgets.py    From pycopia with Apache License 2.0 6 votes vote down vote up
def build(self):
        # buttons
        done = urwid.Button("Done")
        urwid.connect_signal(done, 'click', self._done_multiselect)
        done = urwid.AttrWrap(done, 'selectable', 'butfocus')
        add = urwid.Button("Add New")
        urwid.connect_signal(add, 'click', self._add_new)
        add = urwid.AttrWrap(add, 'selectable', 'butfocus')
        cancel = urwid.Button("Cancel")
        urwid.connect_signal(cancel, 'click', self._cancel)
        cancel = urwid.AttrWrap(cancel, 'selectable', 'butfocus')
        # footer and header
        header = urwid.GridFlow([done, add, cancel], 15, 3, 1, 'center')
        footer = urwid.Padding(urwid.Text(
            ("popup", "Tab to button box to select buttons. Arrow keys transfer selection.")))
        body = self._build_body()
        return urwid.Frame(body, header=header, footer=footer, focus_part="body") 
Example #6
Source File: widgets.py    From pycopia with Apache License 2.0 6 votes vote down vote up
def build(self):
        # buttons
        done = urwid.Button("Done")
        urwid.connect_signal(done, 'click', self._done_multiselect)
        done = urwid.AttrWrap(done, 'selectable', 'butfocus')
        add = urwid.Button("Add New")
        urwid.connect_signal(add, 'click', self._add_new)
        add = urwid.AttrWrap(add, 'selectable', 'butfocus')
        cancel = urwid.Button("Cancel")
        urwid.connect_signal(cancel, 'click', self._cancel)
        cancel = urwid.AttrWrap(cancel, 'selectable', 'butfocus')
        # footer and header
        footer = urwid.GridFlow([done, add, cancel], 15, 3, 1, 'center')
        header = urwid.Padding(urwid.Text(
            ("popup", "Select multiple items. Tab to button box to select buttons. Arrow keys move selection.")))
        listbox = self._build_list()
        return urwid.Frame(listbox, header=header, footer=footer, focus_part="body") 
Example #7
Source File: widgets.py    From pycopia with Apache License 2.0 6 votes vote down vote up
def build(self):
        showeq = urwid.Text(self._testequipment.equipment.name)
        maxlen = 0
        uutcb = urwid.CheckBox("DUT/UUT", state=self._testequipment.UUT)
        urwid.connect_signal(uutcb, 'change', self._uut_select)
        blist = [AM(uutcb, "important")]
        for role in self._roles:
            label = str(role)
            maxlen = max(len(label), maxlen)
            state = role in self._testequipment.roles
            but = urwid.CheckBox(str(role), state=state)
            urwid.connect_signal(but, 'change', self._multi_select, role)
            blist.append(but)
        roleboxes = urwid.Padding(urwid.GridFlow(blist, maxlen+4, 1, 0, "left"))
    #    # buttons
        ok, cancel = self.get_form_buttons()
        buts = urwid.Columns([(10, ok), (10, cancel)], dividechars=1, focus_column=0)
        div = urwid.Divider()
        return urwid.ListBox(urwid.SimpleListWalker([AM(showeq, "flagged"), div, roleboxes, div, buts])) 
Example #8
Source File: widgets.py    From pycopia with Apache License 2.0 6 votes vote down vote up
def build(self):
        self._showeq = urwid.Text("")
        eqi = self._create_equipment_input()
        maxlen = 0
        uutcb = urwid.CheckBox("DUT/UUT", state=False)
        urwid.connect_signal(uutcb, 'change', self._uut_select)
        blist = [AM(uutcb, "important")]
        for role in self._roles:
            label = str(role)
            maxlen = max(len(label), maxlen)
            but = urwid.CheckBox(str(role), state=False)
            urwid.connect_signal(but, 'change', self._multi_select, role)
            blist.append(but)
        roleboxes = urwid.Padding(urwid.GridFlow(blist, maxlen+4, 1, 0, "left"))
        # buttons
        ok, cancel = self.get_form_buttons()
        buts = urwid.Columns([(10, ok), (10, cancel)], dividechars=1, focus_column=0)
        return urwid.ListBox(urwid.SimpleListWalker([eqi, AM(self._showeq, "flagged"), roleboxes, buts])) 
Example #9
Source File: test_decoration.py    From anyMesh-Python with MIT License 6 votes vote down vote up
def test_reduced_padding_cursor(self):
        # FIXME: This is at least consistent now, but I don't like it.
        # pack() on an Edit should leave room for the cursor
        # fixing this gets deep into things like Edit._shift_view_to_cursor
        # though, so this might not get fixed for a while

        p = urwid.Padding(urwid.Edit(u'',u''), width='pack', left=4)
        self.assertEqual(p.render((10,), True).cursor, None)
        self.assertEqual(p.get_cursor_coords((10,)), None)
        self.assertEqual(p.render((4,), True).cursor, None)
        self.assertEqual(p.get_cursor_coords((4,)), None)

        p = urwid.Padding(urwid.Edit(u'',u''), width=('relative', 100), left=4)
        self.assertEqual(p.render((10,), True).cursor, (4, 0))
        self.assertEqual(p.get_cursor_coords((10,)), (4, 0))
        self.assertEqual(p.render((4,), True).cursor, None)
        self.assertEqual(p.get_cursor_coords((4,)), None) 
Example #10
Source File: ui.py    From yTermPlayer with GNU General Public License v3.0 6 votes vote down vote up
def load_list_screen(self,button):
        #overlay second screen after start case2
        txt=urwid.Text("Choose from the following:- ")
        _list=self.player_object.get_saved_lists()
        saved_list=[]
        for every_list in _list:
            b=urwid.Button(str(every_list).rstrip(),user_data=None)
            urwid.connect_signal(b, 'click', self.list_load)
            saved_list.append(urwid.AttrMap(b,None,focus_map='reversed'))
        box=urwid.ListBox(urwid.SimpleFocusListWalker(saved_list))
        list_box=urwid.LineBox(
                                box, title='', title_align='center',
                                tlcorner='┌', tline='─', lline='│',
                                trcorner='┐', blcorner='└', rline='│',
                                bline='─', brcorner='┘'
                                )
        list_box_padding=urwid.Padding(list_box,right=0,left=0)
        self.top.original_widget=list_box_padding 
Example #11
Source File: message_list.py    From Discurses with MIT License 6 votes vote down vote up
def __init__(self, chat_widget):
        self.chat_widget = chat_widget
        self.message = FakeMessage(datetime.datetime.min)
        self._selectable = False
        txt = urwid.Text(
            "                                                               \n"
            "                                                               \n"
            "                                                               \n"
            "                                                               \n"
            "< moo >                                                        \n"
            " -----                                                         \n"
            "        \   ^__^                                               \n"
            "         \  (oo)\_______                                       \n"
            "            (__)\       )\/\                                   \n"
            "                ||----w |                                      \n"
            "                ||     ||                                      \n"
            "                                                               \n"
            "                                                               \n"
            "Oops! This channel is Forbidden. You don't have access. Sorry!\n",
            align=urwid.CENTER)
        w = urwid.Padding(txt, left=5, right=5)
        self.__super.__init__(w) 
Example #12
Source File: result.py    From terminal-leetcode with MIT License 6 votes vote down vote up
def make_failed_view(self):
        blank = urwid.Divider()
        status_header = urwid.AttrWrap(urwid.Text('Run Code Status: '), 'body')
        status = urwid.AttrWrap(urwid.Text('Wrong Answer'), 'hometag')
        columns = urwid.Columns([(17, status_header), (20, status)])
        result_header = urwid.Text('--- Run Code Result: ---', align='center')
        passed_header = urwid.Text('Passed test cases:')
        s = self.result['compare_result']
        passed = urwid.Text('%d/%d' % (s.count('1'), len(s)))
        your_input_header = urwid.Text('Your input:')
        your_input = urwid.Text(self.result['input'])
        your_answer_header = urwid.Text('Your answer:')
        your_answer = urwid.Text(self.result['code_output'])
        expected_answer_header = urwid.Text('Expected answer:')
        expected_answer = urwid.Text(self.result['expected_output'])
        list_items = [
            result_header,
            blank, columns,
            blank, passed_header, passed,
            blank, your_input_header, your_input,
            blank, your_answer_header, your_answer,
            blank, expected_answer_header, expected_answer
        ]
        self._append_stdout_if_non_empty(list_items)
        return urwid.Padding(urwid.ListBox(urwid.SimpleListWalker(list_items)), left=2, right=2) 
Example #13
Source File: app.py    From toot with GNU General Public License v3.0 6 votes vote down vote up
def build_intro(self):
        font = urwid.font.Thin6x6Font()

        # NB: Padding with width="clip" will convert the fixed BigText widget
        # to a flow widget so it can be used in a Pile.

        big_text = "Toot {}".format(__version__)
        big_text = urwid.BigText(("intro_bigtext", big_text), font)
        big_text = urwid.Padding(big_text, align="center", width="clip")

        intro = urwid.Pile([
            big_text,
            urwid.Divider(),
            urwid.Text([
                "Maintained by ",
                ("intro_smalltext", "@ihabunek"),
                " and contributors"
            ], align="center"),
            urwid.Divider(),
            urwid.Text(("intro_smalltext", "Loading toots..."), align="center"),
        ])

        return urwid.Filler(intro) 
Example #14
Source File: result.py    From terminal-leetcode with MIT License 6 votes vote down vote up
def make_runtime_error_view(self):
        blank = urwid.Divider()
        status_header = urwid.AttrWrap(urwid.Text('Run Code Status: '), 'body')
        status = urwid.AttrWrap(urwid.Text('Runtime Error'), 'hometag')
        columns = urwid.Columns([(17, status_header), (20, status)])
        column_wrap = urwid.WidgetWrap(columns)
        result_header = urwid.Text('--- Run Code Result: ---', align='center')
        error_header = urwid.Text('Runtime Error Message:')
        error_message = urwid.Text(self.result['runtime_error'])
        your_input_header = urwid.Text('Last input:')
        your_input = urwid.Text(self.result['last_testcase'])
        list_items = [
            result_header,
            blank, column_wrap,
            blank, error_header, error_message,
            blank, your_input_header, your_input,
        ]
        self._append_stdout_if_non_empty(list_items)
        return urwid.Padding(urwid.ListBox(urwid.SimpleListWalker(list_items)), left=2, right=2) 
Example #15
Source File: Main.py    From topydo with GNU General Public License v3.0 6 votes vote down vote up
def _show_completion_box(self):
        contents = self.cli_wrapper.contents
        if len(contents) == 1:
            completion_box = self.commandline.completion_box
            opts = ('given', completion_box.height)

            max_width = self.cli_wrapper.width
            pos = self.commandline.get_cursor_coords((max_width,))[0]
            l_margin = pos - completion_box.margin
            r_margin = max_width - pos - completion_box.min_width + completion_box.margin

            padding = urwid.Padding(completion_box,
                                    min_width=completion_box.min_width,
                                    left=l_margin,
                                    right=r_margin)

            contents.insert(0, (padding, opts))
            completion_box.focus.set_attr_map({None: PaletteItem.MARKED})
            self.cli_wrapper.focus_position = 1 
Example #16
Source File: result.py    From terminal-leetcode with MIT License 6 votes vote down vote up
def make_unified_error_view(self, error_title):
        blank = urwid.Divider()
        status_header = urwid.AttrWrap(urwid.Text('Run Code Status: '), 'body')
        status = urwid.AttrWrap(urwid.Text(error_title), 'hometag')
        columns = urwid.Columns([(17, status_header), (30, status)])
        column_wrap = urwid.WidgetWrap(columns)
        if 'last_testcase' in self.result:
            result_header = urwid.Text('--- Run Code Result: ---', align='center')
            your_input_header = urwid.Text('Last executed input:')
            your_input = urwid.Text(self.result['last_testcase'])
            list_items = [
                result_header,
                blank, column_wrap,
                blank, your_input_header, your_input,
            ]
        else:
            list_items = [
                result_header,
                blank, column_wrap,
            ]
        self._append_stdout_if_non_empty(list_items)
        return urwid.Padding(urwid.ListBox(urwid.SimpleListWalker(list_items)), left=2, right=2) 
Example #17
Source File: message_list.py    From Discurses with MIT License 6 votes vote down vote up
def __init__(self, chat_widget):
        self.chat_widget = chat_widget
        self.message = FakeMessage(datetime.datetime.min)
        self._selectable = False
        txt = urwid.Text(
            "                                                               \n"
            "                                                               \n"
            "                                                               \n"
            "                                                               \n"
            "< moo >                                                        \n"
            " -----                                                         \n"
            "        \   ^__^                                               \n"
            "         \  (oo)\_______                                       \n"
            "            (__)\       )\/\                                   \n"
            "                ||----w |                                      \n"
            "                ||     ||                                      \n"
            "                                                               \n"
            "                                                               \n"
            "Congratulations! You have reached the top, Thats awesome! Unless "
            "the channel is empty, in which case, meh... big deal.\n\n",
            align=urwid.CENTER)
        w = urwid.Padding(txt, left=5, right=5)
        self.__super.__init__(w) 
Example #18
Source File: result.py    From terminal-leetcode with MIT License 6 votes vote down vote up
def make_compile_error_view(self):
        blank = urwid.Divider()
        status_header = urwid.AttrWrap(urwid.Text('Run Code Status: '), 'body')
        status = urwid.AttrWrap(urwid.Text('Compile Error'), 'hometag')
        columns = urwid.Columns([(17, status_header), (20, status)])
        column_wrap = urwid.WidgetWrap(columns)
        result_header = urwid.Text('--- Run Code Result: ---', align='center')
        your_input_header = urwid.Text('Your input:')
        your_input = urwid.Text('')
        your_answer_header = urwid.Text('Your answer:')
        your_answer = urwid.Text(self.result['compile_error'])
        expected_answer_header = urwid.Text('Expected answer:')
        expected_answer = urwid.Text('Unkown Error')
        list_items = [
            result_header,
            blank, column_wrap,
            blank, your_input_header, your_input,
            blank, your_answer_header, your_answer,
            blank, expected_answer_header, expected_answer
        ]
        self._append_stdout_if_non_empty(list_items)
        return urwid.Padding(urwid.ListBox(urwid.SimpleListWalker(list_items)), left=2, right=2) 
Example #19
Source File: host_definition.py    From ceph-ansible-copilot with GNU Lesser General Public License v2.1 6 votes vote down vote up
def render_page(self):

        host_widgets = urwid.Padding(self.host_panels,
                                    left=2, right=2)

        return urwid.AttrMap(
                 urwid.Filler(
                   urwid.Pile([
                               urwid.Padding(urwid.Text(self.text),
                                             left=2, right=2),
                               urwid.Divider(),
                               host_widgets,
                               urwid.Divider(),
                               self.next_btn]),
                   valign='top',top=1),
                 'active_step') 
Example #20
Source File: ui_elements.py    From vpngate-with-proxy with GNU General Public License v2.0 6 votes vote down vote up
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 
Example #21
Source File: timeline.py    From toot with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, name, statuses, focus=0, is_thread=False):
        self.name = name
        self.is_thread = is_thread
        self.statuses = statuses
        self.status_list = self.build_status_list(statuses, focus=focus)
        try:
            self.status_details = StatusDetails(statuses[focus], is_thread)
        except IndexError:
            self.status_details = StatusDetails(None, is_thread)

        super().__init__([
            ("weight", 40, self.status_list),
            ("weight", 0, urwid.AttrWrap(urwid.SolidFill("│"), "blue_selected")),
            ("weight", 60, urwid.Padding(self.status_details, left=1)),
        ]) 
Example #22
Source File: screenElements.py    From alertR with GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self, title: str, statusType: str, statusValue: str):

        self.title = title
        self.statusType = statusType
        self.statusValue = statusValue

        self.statusTextWidget = urwid.Text(self.statusType + ": " + str(self.statusValue))
        statusBox = urwid.LineBox(self.statusTextWidget, title=self.title)
        paddedStatusBox = urwid.Padding(statusBox, left=0, right=0)
        self.statusUrwidMap = urwid.AttrMap(paddedStatusBox, "neutral")

    # this function returns the final urwid widget that is used
    # to render the box of a status 
Example #23
Source File: screenElements.py    From alertR with GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self, title: str, statusType: str, statusValue: str):

        self.title = title
        self.statusType = statusType
        self.statusValue = statusValue

        self.statusTextWidget = urwid.Text(self.statusType + ": " + str(self.statusValue))
        statusBox = urwid.LineBox(self.statusTextWidget, title=self.title)
        paddedStatusBox = urwid.Padding(statusBox, left=0, right=0)
        self.statusUrwidMap = urwid.AttrMap(paddedStatusBox, "neutral")

    # this function returns the final urwid widget that is used
    # to render the box of a status 
Example #24
Source File: timeline.py    From toot with GNU General Public License v3.0 5 votes vote down vote up
def draw_status_details(self, status):
        self.status_details = StatusDetails(status, self.is_thread)
        self.contents[2] = urwid.Padding(self.status_details, left=1), ("weight", 60, False) 
Example #25
Source File: test_decoration.py    From anyMesh-Python with MIT License 5 votes vote down vote up
def mctest(self, desc, left, right, size, cx, innercx):
        class Inner:
            def __init__(self, desc, innercx):
                self.desc = desc
                self.innercx = innercx
            def move_cursor_to_coords(self,size,cx,cy):
                assert cx==self.innercx, desc
        i = Inner(desc,innercx)
        p = urwid.Padding(i, ('fixed left',left),
            ('fixed right',right))
        p.move_cursor_to_coords(size, cx, 0) 
Example #26
Source File: member_list.py    From Discurses with MIT License 5 votes vote down vote up
def update_list(self):
        async def callback():
            servers = set()
            memberset = set()
            for ch in self.chat_widget.channels:
                if not ch.is_private:
                    servers.add(ch.server)
            for serv in servers:
                for member in serv.members:
                    memberset.add(member)
            items = []
            on = []
            idle = []
            off = []
            for member in memberset:
                if member.status == discord.Status.online:
                    on.append(member)
                if member.status == discord.Status.offline:
                    off.append(member)
                if member.status == discord.Status.idle:
                    idle.append(member)
            members = on + idle + off
            for member in members:
                items.append(
                    urwid.AttrMap(
                        urwid.Padding(
                            urwid.Text(member.display_name), left=1, right=1),
                        self._get_user_attr(member),
                        self._get_user_attr(member)))
            self.list_walker[:] = items

        self.chat_widget.discord.async_do(callback()) 
Example #27
Source File: member_list.py    From Discurses with MIT License 5 votes vote down vote up
def __init__(self, chat_widget):
        self.chat_widget = chat_widget
        self.list_walker = urwid.SimpleListWalker([])
        self.w_listbox = urwid.ListBox(self.list_walker)
        self.update_list()
        self.__super.__init__(urwid.Padding(self.w_listbox, left=2))
        keymaps.GLOBAL.add_command("redraw", self.update_list)

        def updlst(*args, **kwargs):
            self.update_list()
        self.chat_widget.discord.add_event_handler("on_member_join", updlst)
        self.chat_widget.discord.add_event_handler("on_member_remove", updlst)
        self.chat_widget.discord.add_event_handler("on_member_update", updlst) 
Example #28
Source File: host_credentials.py    From ceph-ansible-copilot with GNU Lesser General Public License v2.1 5 votes vote down vote up
def render_page(self):

        w = urwid.Pile([
                  urwid.Padding(urwid.Text(self.text),
                                left=1, right=1),
                  urwid.Divider(),
                  urwid.Padding(
                    urwid.Columns([
                        ("fixed", 20, self.enable_password),
                        ("fixed", 22, self.common_password)
                        ]),
                    left=1),
                  urwid.Divider(),
                  urwid.Padding(
                      urwid.Columns([
                          ("weight", 3, urwid.Pile([
                              self.pending_table_title,
                              urwid.BoxAdapter(
                                urwid.Frame(self.pending_table,
                                            header=self.pending_table_headings),
                                10),
                          ])),
                          ("weight", 1, urwid.Pile([
                              self.sshok_table_title,
                              urwid.BoxAdapter(
                                  urwid.Frame(self.sshok_table,
                                              header=self.sshok_table_headings),
                                  10),
                          ]))
                      ], dividechars=1),
                      left=1),
                  self.check_btn
              ])

        w.focus_position = 5                # the Check button widget

        return urwid.AttrMap(
                 urwid.Filler(w, valign='top', top=1),
                 "active_step") 
Example #29
Source File: commit.py    From ceph-ansible-copilot with GNU Lesser General Public License v2.1 5 votes vote down vote up
def render_page(self):
        return urwid.AttrMap(
                 urwid.Filler(
                   urwid.Pile([
                     urwid.Padding(
                       urwid.Text(self.text),
                       left=2, right=2),
                     urwid.Divider(),
                     self.next_btn]),
                   valign='top', top=1),
                 'active_step') 
Example #30
Source File: message_list.py    From Discurses with MIT License 5 votes vote down vote up
def get_widget(self):
            txt = urwid.Text(self.content, align=self.align)
            if self.padding[0] > 0 or self.padding[1] > 0:
                txt = urwid.Padding(
                    txt, left=self.padding[0], right=self.padding[1])
            return urwid.AttrMap(txt, self.attr_map)