Python urwid.TreeListBox() Examples
The following are 7
code examples of urwid.TreeListBox().
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: widgets.py From pycopia with Apache License 2.0 | 5 votes |
def build(self, title, contents): header = AM(urwid.Text(title), 'header') #clist = self._build_tree(contents) #listbox = urwid.TreeWalker(PackageNode(contents[0])) #listbox = urwid.TreeListBox(urwid.TreeWalker(PackageNode(contents[0]))) #return urwid.Frame(AM(urwid.Filler(urwid.Text("Sample")), 'body'), header=header) #treelist = CollapsibleArrowTreeListWalker([ListEntry(e) for e in contents]) #mtw = ModuleTreeWalker([ListEntry(e) for e in contents]) # define a list of trees to be passed on to SimpleTreeWalker forrest = [construct_example_tree()] # stick out test tree into a SimpleTreeWalker swalker = walkers.SimpleTreeWalker(forrest) if_grandchild = lambda pos: swalker.depth(pos) > 1 treelist = CollapsibleIndentedTreeListWalker(swalker, #treelist = CollapsibleArrowTreeListWalker(swalker, is_collapsed=if_grandchild, #indent=6, #childbar_offset=1, selectable_icons=True, icon_focussed_att='focus', #icon_frame_left_char=None, #icon_frame_right_char=None, #icon_expanded_char='-', #icon_collapsed_char='+', ) #return urwid.Frame(AM(treebox, 'body'), header=header) wlist = [ListEntry(e) for e in contents] listbox = urwid.ListBox(urwid.SimpleListWalker(wlist)) treebox = TreeBox(treelist) #return urwid.Frame(AM(treebox, 'body'), header=header) return urwid.Pile([urwid.LineBox(listbox), urwid.LineBox(treebox)])
Example #2
Source File: threadFrame.py From TerminusBrowser with BSD 3-Clause "New" or "Revised" License | 5 votes |
def buildFrame(self): topnode = CommentNode(self.comments) return urwid.TreeListBox(urwid.TreeWalker(topnode))
Example #3
Source File: threadFrame.py From TerminusBrowser with BSD 3-Clause "New" or "Revised" License | 5 votes |
def buildFrame(self): topnode = CommentNode(self.comments) return urwid.TreeListBox(urwid.TreeWalker(topnode))
Example #4
Source File: threadFrame.py From TerminusBrowser with BSD 3-Clause "New" or "Revised" License | 5 votes |
def buildFrame(self): topnode = CommentNode(self.comments) return urwid.TreeListBox(urwid.TreeWalker(topnode))
Example #5
Source File: browse.py From zstack-utility with Apache License 2.0 | 5 votes |
def __init__(self): cwd = os.getcwd() store_initial_cwd(cwd) self.header = urwid.Text("") self.listbox = urwid.TreeListBox(urwid.TreeWalker(DirectoryNode(cwd))) self.listbox.offset_rows = 1 self.footer = urwid.AttrWrap(urwid.Text(self.footer_text), 'foot') self.view = urwid.Frame( urwid.AttrWrap(self.listbox, 'body'), header=urwid.AttrWrap(self.header, 'head'), footer=self.footer)
Example #6
Source File: setting.py From zstack-utility with Apache License 2.0 | 5 votes |
def __init__(self, category_list): ''' Constructor ''' assert category_list self.category_list = category_list self.listbox = urwid.TreeListBox(urwid.TreeWalker(CategoryNode('test'))) self.header = urwid.AttrWrap(urwid.Text(self.header_text), 'head') self.view = urwid.Frame(urwid.AttrWrap(self.listbox, 'body'), header=self.header)
Example #7
Source File: server_tree.py From Discurses with MIT License | 4 votes |
def __init__(self, chat_widget, close_callback=None): self.chat_widget = chat_widget self.ui = chat_widget.ui self.close_callback = close_callback items = [] for server in sorted(chat_widget.discord.servers, key=lambda s: s.name): node = {"name": server.name, 'server_tree': self, 'server': server, "children": []} for ch in server.channels: if ch.type == discord.ChannelType.text: node['children'].append({ 'name': ch.name, 'server_tree': self, 'channel': ch }) nodeobj = TreeNodeServer(node) nodeobj.expanded = False items.append(nodeobj) if len(chat_widget.discord.private_channels) > 0: node = {"name": "Private Chats", 'server_tree': self, 'server': None, "children": []} for ch in chat_widget.discord.private_channels: name = '' if ch.type == discord.ChannelType.private: name = ch.user.display_name elif ch.type == discord.ChannelType.group: name = ch.name or ', '.join(u.display_name for u in ch.recipients) else: continue node['children'].append({ 'name': name, 'server_tree': self, 'channel': ch }) nodeobj = TreeNodeServer(node) nodeobj.expanded = False items.append(nodeobj) self.w_listbox = urwid.TreeListBox(TreeWalker(items)) self.__super.__init__(self.w_listbox)