當前位置: 首頁>>代碼示例>>Python>>正文


Python urwid.SimpleListWalker方法代碼示例

本文整理匯總了Python中urwid.SimpleListWalker方法的典型用法代碼示例。如果您正苦於以下問題:Python urwid.SimpleListWalker方法的具體用法?Python urwid.SimpleListWalker怎麽用?Python urwid.SimpleListWalker使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在urwid的用法示例。


在下文中一共展示了urwid.SimpleListWalker方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: build

# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import SimpleListWalker [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

示例2: _create_relation_input

# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import SimpleListWalker [as 別名]
def _create_relation_input(self):
        choices = dict(models.get_choices(self.session, self.modelclass, self.metadata.colname, None))
        addnew = urwid.Button("Add New")
        urwid.connect_signal(addnew, 'click', self._add_new_related)
        # Cancel
        canc = urwid.Button("Cancel")
        urwid.connect_signal(canc, 'click', self._cancel)
        butcol = urwid.Columns([AM(addnew, "buttn", "buttnf"), AM(canc, "buttn", "buttnf")])
        wlist = [butcol]
        if self.metadata.nullable:
            entry = ListEntry(urwid.Text("None (remove)"))
            urwid.connect_signal(entry, 'activate', self._single_select)
            wlist.append(entry)
        for pk, cname in choices.items():
            entry = ListEntry(urwid.Text(cname))
            urwid.connect_signal(entry, 'activate', self._single_select, pk)
            wlist.append(entry)
        listbox = urwid.ListBox(urwid.SimpleListWalker(wlist))
        return urwid.BoxAdapter(urwid.LineBox(listbox), 9) 
開發者ID:kdart,項目名稱:pycopia,代碼行數:21,代碼來源:widgets.py

示例3: build

# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import SimpleListWalker [as 別名]
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])) 
開發者ID:kdart,項目名稱:pycopia,代碼行數:20,代碼來源:widgets.py

示例4: _build_list

# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import SimpleListWalker [as 別名]
def _build_list(self):
        choices = get_related_choices(self.session, self.modelclass, self.metadata, None)

        #listbox.body.remove(listentry)

        #choices.update(self.currentvalue)
        wlist = []
#        current = self.currentvalue
#        for pk, cobj in choices.items():
#            if pk in current:
#                but = urwid.CheckBox(str(cobj), state=True)
#            else:
#                but = urwid.CheckBox(str(cobj), state=False)
#            urwid.connect_signal(but, 'change', self._multi_select, (pk, cobj))
#            wlist.append(but)
#        return urwid.ListBox(urwid.SimpleListWalker(wlist)) 
開發者ID:kdart,項目名稱:pycopia,代碼行數:18,代碼來源:widgets.py

示例5: setup_widgets

# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import SimpleListWalker [as 別名]
def setup_widgets(self):
        self.intro_frame = urwid.LineBox(
            urwid.Filler(
                urwid.Text(('body_text', self.INTRO_MESSAGE.format("")), align=urwid.CENTER),
                valign=urwid.MIDDLE,
            )
        )

        self.frame = urwid.Frame(
            body=self.intro_frame,
            footer=urwid.Text(
                [self.FOOTER_START, ('heartbeat_inactive', self.HEARTBEAT_ICON)],
                align=urwid.CENTER
            )
        )

        self.loop = urwid.MainLoop(
            urwid.AttrMap(self.frame, 'body_text'),
            unhandled_input=show_or_exit,
            palette=PALETTE,
        )

        self.list_walker = urwid.SimpleListWalker(self.message_list)
        self.list_box = urwid.ListBox(self.list_walker)
        urwid.connect_signal(self.list_walker, "modified", self.item_focused) 
開發者ID:CaliDog,項目名稱:certstream-python,代碼行數:27,代碼來源:gui.py

示例6: make_failed_view

# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import SimpleListWalker [as 別名]
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) 
開發者ID:chishui,項目名稱:terminal-leetcode,代碼行數:27,代碼來源:result.py

示例7: make_compile_error_view

# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import SimpleListWalker [as 別名]
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) 
開發者ID:chishui,項目名稱:terminal-leetcode,代碼行數:24,代碼來源:result.py

示例8: make_runtime_error_view

# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import SimpleListWalker [as 別名]
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) 
開發者ID:chishui,項目名稱:terminal-leetcode,代碼行數:21,代碼來源:result.py

示例9: make_unified_error_view

# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import SimpleListWalker [as 別名]
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) 
開發者ID:chishui,項目名稱:terminal-leetcode,代碼行數:24,代碼來源:result.py

示例10: __init__

# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import SimpleListWalker [as 別名]
def __init__(self, parent):

        self.text = (
            "{}\n\nThe hosts are accessible to the installer. "
            "The next step is to 'probe' the hosts to validate their "
            "configuration is usable.".format(self.title)
        )

        self.probe_btn = ui_button(label='Probe', align='center',
                                   callback=self.probe)
        self.next_btn = ui_button(label='Next', align='right',
                                  callback=self.next_page)

        self.table_body = urwid.SimpleListWalker([])
        self.table = urwid.ListBox(self.table_body)
        self.table_footer = urwid.Text(
            "Use arrow keys to move, 'space' to toggle the use of a host")
        self.probed = False

        UIBaseClass.__init__(self, parent) 
開發者ID:pcuzner,項目名稱:ceph-ansible-copilot,代碼行數:22,代碼來源:host_validation.py

示例11: populate_table

# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import SimpleListWalker [as 別名]
def populate_table(self):
        app = self.parent

        table_rows = []
        for hostname in sorted(app.hosts.keys()):
            # establish column field defaults
            if app.hosts[hostname]._facts:
                this_host = app.hosts[hostname]
                w = urwid.AttrMap(TableRow(this_host.info(), app),
                                  'body',
                                  'reverse')
                table_rows.append(w)

        self.table_body = urwid.SimpleListWalker(table_rows)

        return 
開發者ID:pcuzner,項目名稱:ceph-ansible-copilot,代碼行數:18,代碼來源:host_validation.py

示例12: __init__

# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import SimpleListWalker [as 別名]
def __init__(self, app):
        self.app = app
        self.walker = urwid.SimpleListWalker([])
        for log_record in logger.get_logs():
            self._append_log(log_record)
        logger.on_log_event += self._append_log
        self.listbox = urwid.ListBox(self.walker)

        self.debug_data = urwid.Text('')

        super(DebugPage, self).__init__([
            ('pack', self.debug_data),
            ('pack', urwid.Text('')),
            ('pack', urwid.Text('Hit "Enter" to copy selected message to clipboard.')),
            ('pack', urwid.Divider(u'\u2550')),
            self.listbox
        ])

        gp.auth_state_changed += self.update

        self.update() 
開發者ID:and3rson,項目名稱:clay,代碼行數:23,代碼來源:debug.py

示例13: __init__

# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import SimpleListWalker [as 別名]
def __init__(self, optimizer):
        self.optimizer = optimizer
        self.guidanceOptions = copy.deepcopy(optimizer.humanGuidedATPEOptimizer.guidanceOptions)

        self.parameterLockedValueEdits = {}
        self.parameterMinEdits = {}
        self.parameterMaxEdits = {}
        self.statusLabels = {}

        self.listWalker = urwid.SimpleListWalker(self.generateGrid())
        listbox = urwid.ListBox(self.listWalker)

        close_button = urwid.Button("Close")
        urwid.connect_signal(close_button, 'click',lambda button: self.close())

        buttons = urwid.Filler(urwid.Columns([close_button]))

        super(HumanGuidancePopup, self).__init__(makeMountedFrame(urwid.Pile([(5, buttons), listbox]), 'Apply Human Guidance'))

        self.optimizer = optimizer 
開發者ID:electricbrainio,項目名稱:hypermax,代碼行數:22,代碼來源:cui.py

示例14: initAll

# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import SimpleListWalker [as 別名]
def initAll(self):
    self.tasksWidget = list()
    self.taskWalker = urwid.SimpleListWalker(self.tasksWidget)
    self.taskListbox = urwid.ListBox(self.taskWalker)

    self.taskHeader = urwid.AttrWrap(urwid.Text(["Task list"],  align='center'), 'taskheader')
    self.taskView = urwid.Frame(urwid.AttrWrap(self.taskListbox, 'body'), header=self.taskHeader)

    ### Control widgets
    self.blank = urwid.Divider()

    self.spinningText = urwid.Text("SPINNING (is on automated task mode)", align='center')
    self.spinningButton = urwid.Button("Switch spinning OFF", self.spin_switch)


    self.control_content = [
        self.blank,
        self.spinningText,
        urwid.Text("This is another content"), self.blank,self.blank,

        urwid.GridFlow(
            [urwid.AttrWrap(urwid.Button("Update mission",  self.update_mission), 'button'),
            urwid.AttrWrap(self.spinningButton, 'button'),
            urwid.AttrWrap(urwid.Button("This is a button"), 'button'),
            urwid.AttrWrap(urwid.Button("This is a button"), 'button'),
            urwid.AttrWrap(urwid.Button("This is a button"), 'button')]
        ,15, 3, 1, 'center')]

    self.controlListBox = urwid.ListBox(self.control_content)
    self.controlHeader = urwid.AttrWrap(urwid.Text(["Controller"],  align='center'), 'header')
    self.controlView = urwid.Frame(urwid.AttrWrap(self.controlListBox, 'body'), header=self.controlHeader)
    #view = urwid.Frame(urwid.AttrWrap(columns, 'body'), header=header)

    self.columns = urwid.Columns([self.controlView, self.taskView]) 
開發者ID:AlexisTM,項目名稱:flyingros,代碼行數:36,代碼來源:urwid_app.py

示例15: _build_test_selector

# 需要導入模塊: import urwid [as 別名]
# 或者: from urwid import SimpleListWalker [as 別名]
def _build_test_selector(self):
        jobs = [widgets.ListEntry(job.name) for job in db.get_job_list()]
        jobwalker = urwid.SimpleListWalker(jobs)
        return urwid.ListBox(jobwalker) 
開發者ID:kdart,項目名稱:pycopia,代碼行數:6,代碼來源:runner.py


注:本文中的urwid.SimpleListWalker方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。