NomadNet/nomadnet/ui/textui/Conversations.py

39 lines
1.5 KiB
Python
Raw Normal View History

2021-05-04 05:08:16 -04:00
class ConversationsDisplayShortcuts():
def __init__(self, app):
import urwid
self.app = app
self.widget = urwid.AttrMap(urwid.Text("Conversations Display Shortcuts"), "shortcutbar")
class ConversationsDisplay():
def __init__(self, app):
import urwid
2021-05-04 09:10:21 -04:00
from nomadnet.vendor.additional_urwid_widgets import IndicativeListBox
2021-05-04 05:08:16 -04:00
self.app = app
2021-05-04 09:10:21 -04:00
conversation_list_widgets = []
for conversation in app.conversations():
widget = urwid.SelectableIcon(str(conversation), cursor_position=-1)
widget.conversation = conversation
conversation_list_widgets.append(urwid.AttrMap(widget, None, "list_focus"))
walker = urwid.SimpleFocusListWalker(conversation_list_widgets)
listbox = urwid.LineBox(urwid.Filler(IndicativeListBox(conversation_list_widgets), height=("relative", 100)))
placeholder = urwid.Text("Conversation Display Area", "left")
conversation_area = urwid.LineBox(
urwid.Frame(
urwid.Filler(placeholder,"top"),
footer=urwid.AttrMap(urwid.Edit(caption="\u270E", edit_text="Message input"), "msg_editor")
)
)
columns_widget = urwid.Columns([("weight", 0.33, listbox), ("weight", 0.67, conversation_area)], dividechars=0, focus_column=0, box_columns=[0])
2021-05-04 05:08:16 -04:00
self.shortcuts_display = ConversationsDisplayShortcuts(self.app)
2021-05-04 09:10:21 -04:00
self.widget = columns_widget
2021-05-04 05:08:16 -04:00
def shortcuts(self):
return self.shortcuts_display