| 8 | |
| 9 | |
| 10 | class FlowItem(urwid.WidgetWrap): |
| 11 | def __init__(self, master, flow): |
| 12 | self.master, self.flow = master, flow |
| 13 | w = self.get_text() |
| 14 | urwid.WidgetWrap.__init__(self, w) |
| 15 | |
| 16 | def get_text(self): |
| 17 | cols, _ = self.master.ui.get_cols_rows() |
| 18 | layout = self.master.options.console_flowlist_layout |
| 19 | if layout == "list" or (layout == "default" and cols < 100): |
| 20 | render_mode = common.RenderMode.LIST |
| 21 | else: |
| 22 | render_mode = common.RenderMode.TABLE |
| 23 | |
| 24 | return common.format_flow( |
| 25 | self.flow, |
| 26 | render_mode=render_mode, |
| 27 | focused=self.flow is self.master.view.focus.flow, |
| 28 | hostheader=self.master.options.showhost, |
| 29 | ) |
| 30 | |
| 31 | def selectable(self): |
| 32 | return True |
| 33 | |
| 34 | def mouse_event(self, size, event, button, col, row, focus): |
| 35 | if event == "mouse press" and button == 1: |
| 36 | self.master.commands.execute("console.view.flow @focus") |
| 37 | return True |
| 38 | |
| 39 | def keypress(self, size, key): |
| 40 | return key |
| 41 | |
| 42 | |
| 43 | class FlowListWalker(urwid.ListWalker): |