我们从Python开源项目中,提取了以下40个代码示例,用于说明如何使用urwid.LineBox()。
def quit_prompt(self): """Pop-up window that appears when you try to quit.""" # Nothing fancy here. question = ur.Text(("bold", "Really quit?"), "center") yes_btn = ur.AttrMap(ur.Button( "Yes", self.button_press, "quit"), "red", None) no_btn = ur.AttrMap(ur.Button( "No", self.button_press, "back"), "green", None) prompt = ur.LineBox(ur.ListBox(ur.SimpleFocusListWalker( [question, self.div, self.div, no_btn, yes_btn]))) # The only interesting thing in this method is this Overlay widget. overlay = MyOverlay( prompt, self.loop.baseWidget, "center", 20, "middle", 8, 16, 8, parent=self) self.loop.Widget = overlay
def reply_box(self, button, thr_id): subject = ur.Edit(("blue", "Subject: "), wrap="clip") name = ur.Edit(("blue", "Name: "), "Anonymous", wrap="clip") if thr_id == -1: text = ur.Edit(multiline=True) else: text = ur.Edit(edit_text=">>" + thr_id, multiline=True) post_btn = ur.AttrMap(ur.Button( "Post", self.add_post, (subject, name, text, thr_id)), "green", "b_green") box = ur.LineBox(ur.ListBox(ur.SimpleFocusListWalker( [name, subject, ur.LineBox(text, "Post text"), self.parent.div, post_btn]))) self.loop.Widget = MyOverlay( box, self.loop.baseWidget, "center", ("relative", 100), "top", ("relative", 100), None, None, self.parent.margin, self.parent.margin, int(self.loop.dimensions[1] * 0.3), int(self.loop.dimensions[1] * 0.3), self.parent)
def __init__(self, title, message, entry_prompt=None, entry_text='', buttons=[], ring=None): button_widgets = [] for button in buttons: button_widgets.append(('pack', button)) button_columns = urwid.Columns(button_widgets, dividechars=2) rows = [] rows.append(urwid.Text(message)) if entry_prompt: self.entry = MyEdit(entry_prompt, edit_text=entry_text, ring=ring) rows.append(self.entry) else: self.entry = None rows.append(urwid.Divider()) rows.append(button_columns) listbox = urwid.ListBox(rows) super(ButtonDialog, self).__init__(urwid.LineBox(listbox, title))
def __init__(self, app, title, prompt, button, text, ring=None): self.app = app save_button = FixedButton(button) cancel_button = FixedButton('Cancel') urwid.connect_signal(save_button, 'click', lambda button:self._emit('save')) urwid.connect_signal(cancel_button, 'click', lambda button:self._emit('cancel')) button_widgets = [('pack', save_button), ('pack', cancel_button)] button_columns = urwid.Columns(button_widgets, dividechars=2) rows = [] self.entry = MyEdit(edit_text=text, multiline=True, ring=ring) rows.append(urwid.Text(prompt)) rows.append(self.entry) rows.append(urwid.Divider()) rows.append(button_columns) pile = urwid.Pile(rows) fill = urwid.Filler(pile, valign='top') super(TextEditDialog, self).__init__(urwid.LineBox(fill, title))
def __init__(self, title, topics): button_widgets = [] ok_button = mywid.FixedButton('OK') cancel_button = mywid.FixedButton('Cancel') urwid.connect_signal(ok_button, 'click', lambda button:self._emit('ok')) urwid.connect_signal(cancel_button, 'click', lambda button:self._emit('cancel')) button_widgets.append(('pack', ok_button)) button_widgets.append(('pack', cancel_button)) button_columns = urwid.Columns(button_widgets, dividechars=2) self.topic_buttons = [] self.topic_keys = {} rows = [] for key, name in topics: button = mywid.FixedRadioButton(self.topic_buttons, name) self.topic_keys[button] = key rows.append(button) rows.append(urwid.Divider()) rows.append(button_columns) pile = urwid.Pile(rows) fill = urwid.Filler(pile, valign='top') super(TopicSelectDialog, self).__init__(urwid.LineBox(fill, title))
def __init__(self): self.prefs = bbjrc("load") self.mode = None self.thread = None self.usermap = {} self.window_split = False self.last_pos = None # these can be changed and manipulated by other methods self.walker = urwid.SimpleFocusListWalker([]) self.box = ActionBox(self.walker) self.body = urwid.AttrMap( urwid.LineBox( self.box, title=self.prefs["frame_title"], **frame_theme()), "default" ) self.loop = urwid.MainLoop( urwid.Frame(self.body), palette=colormap, handle_mouse=self.prefs["mouse_integration"])
def __init__(self, return_fn): self.return_fn = return_fn self.about_message = ABOUT_MESSAGE self.time_out_ctrl = urwid.Text(self.about_message) cancel_button = urwid.Button('Exit', on_press=self.on_cancel) cancel_button._label.align = 'center' if_buttons = urwid.Columns([cancel_button]) title = urwid.Text(('bold text', u" About Menu \n"), 'center') self.titles = [title, self.time_out_ctrl, if_buttons] self.main_window = urwid.LineBox(ViListBox(self.titles))
def __init__(self, return_fn): self.return_fn = return_fn self.help_message = HELP_MESSAGE self.time_out_ctrl = urwid.Text(self.help_message) cancel_button = urwid.Button('Exit', on_press=self.on_cancel) cancel_button._label.align = 'center' if_buttons = urwid.Columns([cancel_button]) title = urwid.Text(('bold text', u" Help Menu \n"), 'center') self.titles = [title, self.time_out_ctrl, if_buttons] self.main_window = urwid.LineBox(ViListBox(self.titles))
def __init__(self, text, vertical_padding=True): content = [urwid.Padding(self.get_content(text), left=3, right=3)] if vertical_padding: content = [DIV] + content + [DIV] lbox = urwid.LineBox(urwid.Pile(content)) self.__super.__init__(urwid.AttrMap(urwid.Pile( [lbox]), 'image button', 'image button focus'))
def __init__(self, pic, text): content = self.get_content(text) lbox = urwid.LineBox(urwid.Pile([DIV, urwid.Padding( urwid.Columns([(8, pic), content], 4), left=3, right=3), DIV])) self.__super.__init__(urwid.AttrMap(urwid.Pile( [lbox]), 'image button', 'image button focus'))
def __init__(self, label="", label_width=15, next_callback=False): self.label, self.next_callback = label, next_callback self.edit = urwid.Padding(urwid.Edit(), left=1, right=1) label = urwid.LineBox( urwid.Text(label), tlcorner=' ', tline=' ', lline=' ', trcorner=' ', blcorner=' ', rline=' ', brcorner=' ', bline=' ') lbox = urwid.AttrMap( urwid.LineBox( self.edit, tlcorner=' ', tline=' ', lline=' ', trcorner=' ', blcorner=' ', rline=' ', brcorner=' '), 'input', 'input focus') cols = urwid.Columns([(label_width, label), lbox]) urwid.WidgetWrap.__init__(self, cols)
def __init__(self): self.top_string = urwid.Text('') self.bottom_string = urwid.Text('') self.small_blinks = urwid.Filler(self.top_string, 'top') self.large_blinks = ('weight', 10, urwid.Filler(self.bottom_string, 'top')) self.default_widget = urwid.LineBox( urwid.Pile([ self.large_blinks ]), title='Websockets' )
def __init__(self): self.walker = urwid.SimpleFocusListWalker(contents=self.log_messages) self.list_box = urwid.ListBox(self.walker) self.graph = urwid.BarGraph( attlist=['graph bg background', 'graph bg 1', 'graph bg 2'], satt={ (1, 0): 'graph bg 1 smooth', (2, 0): 'graph bg 2 smooth' } ) self.graph_widget = urwid.LineBox(self.graph, title=self.graph_title) self.default_widget = urwid.Columns([ urwid.LineBox( self.list_box, title="Logger" ), self.graph_widget ]) self.logger_widget = urwid.LineBox( self.list_box, title="Logger" )
def __init__(self, text, escape_method): self.escape_method = escape_method super(TestResultWindow, self).__init__(urwid.LineBox(urwid.Filler(urwid.Text(text))))
def handle_input(key): if key in ('q', 'Q'): print 'exiting on q' raise urwid.ExitMainLoop() elif key in ('1'): main_loop.widget = urwid.LineBox(urwid.Filler(urwid.Text('The second top window', align='right')))
def selectable(self): """Allow the user to interact with this widget""" # Decoration widgets like LineBox override selectable() so we need to # use an actual method return True
def __init__(self, pubpen): self.pubpen = pubpen self.save_button = urwid.Button('(S)ave') self.load_button = urwid.Button('(L)oad') self.quit_button = urwid.Button('(Q)uit') self.continue_button = urwid.Button('(ESC) Continue Game') self.buttons = urwid.SimpleFocusListWalker(( urwid.AttrMap(self.save_button, None, focus_map='reversed'), urwid.AttrMap(self.load_button, None, focus_map='reversed'), urwid.AttrMap(self.quit_button, None, focus_map='reversed'), urwid.AttrMap(self.continue_button, None, focus_map='reversed'), )) self.entrybox = urwid.ListBox(self.buttons) # Draw a box around the widget and constrain the widget's size linebox = urwid.LineBox(self.entrybox, tlcorner='\u2554', tline='\u2550', trcorner='\u2557', blcorner='\u255A', bline='\u2550', brcorner='\u255D', lline='\u2551', rline='\u2551') padding = urwid.Padding(linebox, align='center', width=len(self.continue_button.get_label()) + 6) filler = urwid.Filler(padding, valign='middle', height=len(self.buttons) + 2) outer_layout = LineBox(filler, lline=None, blcorner='?', tlcorner='?', trcorner='\u252c', brcorner='\u2524') super().__init__(outer_layout) urwid.connect_signal(self.save_button, 'click', self.save_game) urwid.connect_signal(self.load_button, 'click', self.load_game) urwid.connect_signal(self.quit_button, 'click', self.quit_client) urwid.connect_signal(self.continue_button, 'click', self.continue_game)
def __init__(self, pubpen): self.pubpen = pubpen username_label = urwid.Text('Username: ', align='right') password_label = urwid.Text('Password: ', align='right') self.username = urwid.Edit() self.password = urwid.Edit() login_button = urwid.Button('Login') decorated_login_button = urwid.AttrMap(login_button, None, focus_map='reversed') quit_button = urwid.Button('Quit') decorated_quit_button = urwid.AttrMap(quit_button, None, focus_map='reversed') buttons = urwid.Columns(( (len('Login') + 4, decorated_login_button), (len('Quit') + 4, decorated_quit_button), ), focus_column=1) labels = urwid.Pile([username_label, password_label]) self.fields = urwid.Pile([self.username, self.password, buttons], focus_item=0) entry_box = urwid.Columns([labels, self.fields]) self.status_message = urwid.Text(' ', align='center') entry_with_status = urwid.Pile([entry_box, self.status_message]) padded_entry_with_status = urwid.Padding(entry_with_status, align='center') self.display = urwid.Filler(padded_entry_with_status, valign='middle') decorate = urwid.LineBox(self.display) super().__init__(decorate) self.focusable_widgets = (w for w in itertools.cycle(( ((self.fields, 1),), ((self.fields, 2), (buttons, 0)), ((self.fields, 2), (buttons, 1)), ((self.fields, 0),) ))) urwid.connect_signal(login_button, 'click', self.attempt_login) urwid.connect_signal(quit_button, 'click', self.quit) self.pubpen.subscribe('user.login_success', self.handle_login_success) self.pubpen.subscribe('user.login_failure', self.handle_login_failure)
def __init__(self, pubpen): self.pubpen = pubpen blank = urwid.Text('This test page intentionally left blank') container = urwid.Filler(blank) outer_layout = LineBox(container, lline=None, blcorner='?', tlcorner='?', trcorner='\u252c', brcorner='\u2524') super().__init__(outer_layout) pass
def __init__(self, message): w = urwid.Filler(urwid.Text(message, align='center')) super(SystemMessage, self).__init__(urwid.LineBox(w, u'System Message'))
def __init__(self, app, title, current_key, values): self.app = app rows = [] self.key = None self.value = None for key, value in values(): button = SearchSelectInnerButton(key, value) urwid.connect_signal(button, 'click', lambda b:self.onSelected(b)) rows.append(button) pile = urwid.Pile(rows) fill = urwid.Filler(pile, valign='top') super(SearchSelectDialog, self).__init__(urwid.LineBox(fill, title))
def __init__(self, app): self.app = app save_button = mywid.FixedButton(u'Save') cancel_button = mywid.FixedButton(u'Cancel') urwid.connect_signal(save_button, 'click', lambda button:self._emit('save')) urwid.connect_signal(cancel_button, 'click', lambda button:self._emit('cancel')) rows = [] buttons = [('pack', save_button), ('pack', cancel_button)] buttons = urwid.Columns(buttons, dividechars=2) self.project_button = ProjectButton(self.app) self.status_button = StatusButton(self.app) self.assignee_button = AssigneeButton(self.app) self.title_field = mywid.MyEdit(u'', edit_text=u'', ring=app.ring) for (label, w) in [ (u'Project:', ('pack', self.project_button)), (u'Title:', self.title_field), (u'Status:', ('pack', self.status_button)), (u'Assignee:', ('pack', self.assignee_button)), ]: row = urwid.Columns([(12, urwid.Text(label)), w]) rows.append(row) rows.append(urwid.Divider()) rows.append(buttons) pile = urwid.Pile(rows) fill = urwid.Filler(pile, valign='top') super(NewTaskDialog, self).__init__(urwid.LineBox(fill, 'New Task'))
def __init__(self, callback, content=""): self.callback = callback self.w_edit = urwid.Edit(edit_text=content) self.w_lb = urwid.LineBox(self.w_edit) self.__super.__init__(self.w_lb)
def __init__(self, discord_client, chat_widget): self.discord = discord_client self.ui = self.discord.ui self.chat_widget = chat_widget self.editing = None self.edit = urwid.Edit(multiline=True, allow_tab=True) self.edit.keypress = self._edit_keypress self.w_lb = urwid.LineBox(urwid.Padding(self.edit, left=1, right=1)) self.w_text = urwid.Text("") self.w_typing = TypingList(self) self.pile = urwid.Pile([]) self.hide_channel_selector() self.__super.__init__(self.pile)
def __init__(self, message): listbox = urwid.ListBox(urwid.SimpleListWalker([ urwid.Text(line) for line in message.split("\n") ])) footer = urwid.Pile([ urwid.Divider(), urwid.Text("<close>") ]) self.box = urwid.LineBox(urwid.Frame(listbox, footer=footer)) super(PopUpDialog, self).__init__(urwid.AttrMap(self.box, 'popup'))
def main_window(self): self.graph = self.bar_graph() self.graph_wrap = urwid.WidgetWrap( self.graph ) vline = urwid.AttrWrap( urwid.SolidFill(u'\u2502'), 'line') c = self.graph_controls() w = urwid.Columns([('weight',2,self.graph_wrap), ('fixed',1,vline), c], dividechars=1, focus_column=2) w = urwid.Padding(w,('fixed left',1),('fixed right',0)) w = urwid.AttrWrap(w,'body') w = urwid.LineBox(w) w = urwid.AttrWrap(w,'line') w = self.main_shadow(w) return w
def main(): term = urwid.Terminal(None) mainframe = urwid.LineBox( urwid.Pile([ ('weight', 70, term), ('fixed', 1, urwid.Filler(urwid.Edit('focus test edit: '))), ]), ) def set_title(widget, title): mainframe.set_title(title) def quit(*args, **kwargs): raise urwid.ExitMainLoop() def handle_key(key): if key in ('q', 'Q'): quit() urwid.connect_signal(term, 'title', set_title) urwid.connect_signal(term, 'closed', quit) loop = urwid.MainLoop( mainframe, handle_mouse=False, unhandled_input=handle_key) term.main_loop = loop loop.run()
def __init__(self, text, width, host_view, loop = None): self.running = False self.lock = EasyLock() self.loop = loop self.overlay = urwid.Overlay( urwid.LineBox(urwid.Text(text)), host_view, #urwid.SolidFill(), 'center', width, 'middle', None) urwid.Frame.__init__(self, self.overlay)
def __init__(self, text, width, host_view, loop = None): self.loop = loop self.host_view = host_view self.overlay = urwid.Overlay( urwid.LineBox(urwid.Text(text)), host_view, #urwid.SolidFill(), 'center', width, 'middle', None) urwid.Frame.__init__(self, self.overlay)
def __init__(self, websocket_url, **kwargs): # Configuration stuff self.frame = None self.websocket_url = urllib.parse.urlparse(websocket_url) self.total_connections = kwargs.get('total_connections', 250) self._exiting = False self.extra_headers = None # Asyncio stuff self.loop = asyncio.get_event_loop() self.loop.set_exception_handler(self.handle_exceptions) self.connection_semaphore = asyncio.Semaphore(kwargs.get('max_connecting_sockets', 15)) # Counts and buffers self.global_message_counter = itertools.count() self.socket_count = itertools.count(1) self.sockets = OrderedDict() self.ring_buffer = deque(maxlen=10) if kwargs.get('header'): self.extra_headers = dict([map(lambda x: x.strip(), kwargs['header'].split(':'))]) if kwargs.get('setup_tasks', True): self.setup_tasks() self.blinkboard = BlinkBoardWidget() self.logger = LoggerWidget() self.default_view = urwid.Pile([ self.blinkboard.default_widget, (10, self.logger.default_widget) ]) self.logger_view = urwid.Pile([ self.logger.logger_widget, ]) self.graph_view = urwid.Pile([ self.logger.graph_widget, ]) self.small_blink_and_graph_view = urwid.Pile([ self.logger.graph_widget, (10, urwid.LineBox(self.blinkboard.small_blinks)), ])
def select_project(project_list, path_callback): max_width = len(max(project_list, key=len)) f = ProjectSelector(project_list, 'normal', 'highlighted', 'selected') def refresh_list(key=''): if key: if key in ('delete', 'backspace'): f.remove_key() else: if key in 'abcdefghijklmnopqrstuvwxyz- .0123456789': f.add_key(key) s = f.render() txt.set_text(s) def exit_on_q(key): if key.__class__ is not str: return if key in ('Q',): raise urwid.ExitMainLoop() if key == 'up': f.up() if key == 'down': f.down() if key == 'enter': path_callback(f.select()) raise urwid.ExitMainLoop() key = key.lower() refresh_list(key) palette = [ ('normal', 'light gray', ''), ('selected', 'yellow, bold', ''), ('highlighted', 'black, bold', 'yellow'), ('quit button', 'light red, bold', ''), ('enter button', 'light green, bold', '') ] txt = urwid.Text('', align='left') fill = urwid.Filler(txt) pad = urwid.Padding(fill, align='center', width=max_width+4) box = urwid.LineBox(pad, title="Projects") footer = urwid.Text(['Start typing to search. Use arrow keys to navigate. Press (', ('enter button', 'Enter'), ') to select project. ', 'Press (', ('quit button', 'Q'), ') to exit.']) frame = urwid.Frame(body=box, footer=footer) loop = urwid.MainLoop(frame, palette, unhandled_input=exit_on_q) refresh_list() loop.run()
def __init__(self, pubpen): self.pubpen = pubpen self.display_stack = [] self.blank = LineBox(urwid.SolidFill(' '), lline=None, blcorner='?', tlcorner='?', trcorner='\u252c', brcorner='\u2524') self.background = urwid.WidgetPlaceholder(self.blank) super().__init__(self.background) # Widgets traded in and out of the main display area self.market_display = MarketDisplay(self.pubpen) self.cargo_order_dialog = CargoOrderDialog(self.pubpen) self.travel_menu = TravelDisplay(self.pubpen) self.game_menu = GameMenuDialog(self.pubpen) self.port_display = PortDisplay(self.pubpen) self.equip_order_dialog = EquipOrderDialog(self.pubpen) self.financial_display = FinancialDisplay(self.pubpen) self.display_map = { 'MarketDisplay': self.market_display, 'CargoOrderDialog': self.cargo_order_dialog, 'PortDisplay': self.port_display, 'EquipOrderDialog': self.equip_order_dialog, 'FinancialDisplay': self.financial_display, 'TravelDisplay': self.travel_menu, 'GameMenuDialog': self.game_menu, 'Blank': self.blank } self.dialogs = frozenset(n for n in self.display_map if n.endswith('Dialog')) self.push_display('Blank') urwid.connect_signal(self.market_display, 'close_market_display', self.pop_display) urwid.connect_signal(self.market_display, 'open_cargo_order_dialog', partial(self.push_display, 'CargoOrderDialog')) urwid.connect_signal(self.cargo_order_dialog, 'close_cargo_order_dialog', self.pop_display) urwid.connect_signal(self.port_display, 'open_equip_order_dialog', partial(self.push_display, 'EquipOrderDialog')) urwid.connect_signal(self.equip_order_dialog, 'close_equip_order_dialog', self.pop_display) urwid.connect_signal(self.travel_menu, 'close_travel_menu', self.pop_display) urwid.connect_signal(self.game_menu, 'close_game_menu', self.pop_display)
def graph_controls(self): modes = self.controller.get_modes() # setup mode radio buttons self.mode_buttons = [] group = [] for m in modes: rb = self.radio_button( group, m, self.on_mode_button ) self.mode_buttons.append( rb ) # setup animate button self.animate_button = self.button( "", self.on_animate_button) self.on_animate_button( self.animate_button ) self.offset = 0 self.animate_progress = self.progress_bar() animate_controls = urwid.GridFlow( [ self.animate_button, self.button("Reset", self.on_reset_button), ], 9, 2, 0, 'center') if urwid.get_encoding_mode() == "utf8": unicode_checkbox = urwid.CheckBox( "Enable Unicode Graphics", on_state_change=self.on_unicode_checkbox) else: unicode_checkbox = urwid.Text( "UTF-8 encoding not detected") self.animate_progress_wrap = urwid.WidgetWrap( self.animate_progress) l = [ urwid.Text("Mode",align="center"), ] + self.mode_buttons + [ urwid.Divider(), urwid.Text("Animation",align="center"), animate_controls, self.animate_progress_wrap, urwid.Divider(), urwid.LineBox( unicode_checkbox ), urwid.Divider(), self.button("Quit", self.exit_program ), ] w = urwid.ListBox(urwid.SimpleListWalker(l)) return w
def __init__(self, return_fn): # What is shown in menu self.current_mode = None # Sensor Applied self.current_active_mode = None self.no_malloc = False title = urwid.Text(('bold text', u" Available Temperature Sensors \n"), 'center') self.available_sensors = [] sensors_dict = dict() try: sensors_dict = psutil.sensors_temperatures() except (AttributeError, IOError): logging.debug("Unable to create sensors dict") for key,value in sensors_dict.items(): sensor_name = key for itr in range(len(value)): sensor_label = "" try: sensor_label = value[itr].label logging.debug("Sensor Label") logging.debug(sensor_label) except (IndexError): pass self.available_sensors.append(sensor_name +\ "," +str(itr) +\ "," + sensor_label) group = [] self.sensor_buttons = [] for sensor in self.available_sensors: rb = radio_button(group, sensor, self.on_mode_button) self.sensor_buttons.append(rb) #rb = radio_button(group, "INVALID", self.on_mode_button) #self.sensor_buttons.append(rb) self.return_fn = return_fn cancel_button = urwid.Button('Cancel', on_press=self.on_cancel) cancel_button._label.align = 'center' apply_button = urwid.Button('Apply', on_press=self.on_apply) apply_button._label.align = 'center' if_buttons = urwid.Columns([apply_button,cancel_button]) self.titles = [title] + self.sensor_buttons + [if_buttons] self.main_window = urwid.LineBox(ViListBox(self.titles))
def graph_controls(self): """ Dislplay sidebar controls. i.e. buttons, and controls""" modes = self.controller.get_modes() # setup mode radio buttons group = [] for m in modes: rb = radio_button(group, m, self.on_mode_button) self.mode_buttons.append(rb) # Create list of buttons control_options = [button("Reset", self.on_reset_button)] if stress_installed: control_options.append(button('Stress Options', self.on_stress_menu_open)) control_options.append(button('Temp Sensors', self.on_temp_sensors_menu_open)) control_options.append(button('Help', self.on_help_menu_open)) control_options.append(button('About', self.on_about_menu_open)) # Create the menu animate_controls = urwid.GridFlow(control_options, 18, 2, 0, 'center') if urwid.get_encoding_mode() == "utf8": unicode_checkbox = urwid.CheckBox( "Smooth Graph", state=False, on_state_change=self.on_unicode_checkbox) else: unicode_checkbox = urwid.Text( "UTF-8 encoding not detected") install_stress_message = urwid.Text("") if not stress_installed: install_stress_message = urwid.Text(('button normal', u"(N/A) install stress")) graph_checkboxes = [urwid.CheckBox(x.get_graph_name(), state=True, on_state_change=lambda w, state, x=x: self.change_checkbox_state(x, state)) for x in self.available_graphs.values()] unavalable_graphs = [urwid.Text(( "[N/A] " + x.get_graph_name()) ) for x in self.graphs.values() if x.source.get_is_available() == False] graph_checkboxes += unavalable_graphs buttons = [urwid.Text(('bold text', u"Modes"), align="center"), ] + self.mode_buttons + [ install_stress_message, urwid.Divider(), urwid.Text(('bold text', u"Control Options"), align="center"), animate_controls, urwid.Divider(), self.refresh_rate_ctrl, urwid.Divider(), urwid.LineBox(urwid.Pile(graph_checkboxes)), urwid.LineBox(unicode_checkbox), urwid.Divider(), button("Quit", self.exit_program), ] return buttons