Work on Conversations UI

This commit is contained in:
Mark Qvist 2021-05-04 15:10:21 +02:00
parent f5d263ee31
commit 0c1108f00e
4 changed files with 57 additions and 12 deletions

View file

@ -29,12 +29,14 @@ THEME_LIGHT = 0x02
THEMES = {
THEME_DARK: [
# Style name # 16-color style # Monochrome style # 88, 256 and true-color style
('heading', 'light gray,underline', 'default', 'underline', 'g93,underline', 'default'),
('menubar', 'black', 'light gray', 'standout', '#111', '#bbb'),
('shortcutbar', 'black', 'light gray', 'standout', '#111', '#bbb'),
('body_text', 'white', 'default', 'default', '#0a0', 'default'),
('buttons', 'light green,bold', 'default', 'default', '#00a533', 'default')
# Style name # 16-color style # Monochrome style # 88, 256 and true-color style
('heading', 'light gray,underline', 'default', 'underline', 'g93,underline', 'default'),
('menubar', 'black', 'light gray', 'standout', '#111', '#bbb'),
('shortcutbar', 'black', 'light gray', 'standout', '#111', '#bbb'),
('body_text', 'white', 'default', 'default', '#0a0', 'default'),
('buttons', 'light green,bold', 'default', 'default', '#00a533', 'default'),
('msg_editor', 'black', 'light cyan', 'standout', '#111', '#0bb'),
("list_focus", "black", "light cyan", "standout", "#111", "#0bb"),
]
}

View file

@ -8,14 +8,32 @@ class ConversationsDisplayShortcuts():
class ConversationsDisplay():
def __init__(self, app):
import urwid
from nomadnet.vendor.additional_urwid_widgets import IndicativeListBox
self.app = app
pile = urwid.Pile([
urwid.Text(("body_text", "Conversations Display \U0001F332")),
])
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])
self.shortcuts_display = ConversationsDisplayShortcuts(self.app)
self.widget = urwid.Filler(pile, 'top')
self.widget = columns_widget
def shortcuts(self):
return self.shortcuts_display