Settings button + scrollable contact list

This commit is contained in:
John Mertz 2024-03-01 21:26:28 -07:00
parent 16e4bd41c3
commit 563427397e
Signed by: jpm
GPG Key ID: E9C5EA2D867501AB
1 changed files with 60 additions and 12 deletions

View File

@ -69,6 +69,46 @@ class ConversationModel:
'msg': "oh, hi"
}
],
"0": [],
"1": [],
"2": [],
"3": [],
"4": [],
"5": [],
"6": [],
"7": [],
"8": [],
"9": [],
"10": [],
"11": [],
"12": [],
"13": [],
"14": [],
"15": [],
"16": [],
"17": [],
"18": [],
"19": [],
"20": [],
"21": [],
"22": [],
"23": [],
"24": [],
"25": [],
"26": [],
"27": [],
"28": [],
"29": [],
"30": [],
"31": [],
"32": [],
"33": [],
"34": [],
"35": [],
"36": [],
"37": [],
"38": [],
"39": [],
}
self.conversations = []
for key in self.data:
@ -131,8 +171,6 @@ class ConversationView(urwid.WidgetWrap):
def __init__(self, model):
self.model = model
self.started = True
self.offset = 0
self.last_offset = None
self.current_conversation=None
super().__init__(self.main_window())
@ -172,7 +210,6 @@ class ConversationView(urwid.WidgetWrap):
urwid.AttrMap(self.chat, "body"),
footer=self.send
)
self.last_offset = None
def on_conversation_change(self, m):
"""Handle external conversation change by updating radio buttons."""
@ -235,17 +272,17 @@ class ConversationView(urwid.WidgetWrap):
def main_window(self):
self.chat = self.conversation()
self.send_content = "Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. Oh, Hi. wassup!"
self.send_content = ""
self.send_edit = urwid.Edit("", self.send_content, multiline=True)
self.send_box = urwid.Padding(self.send_edit, left=1, right=1)
urwid.connect_signal(self.send_edit, 'change', self.send_update(self.send_content,self.send_edit))
self.send_button = urwid.Padding(
urwid.AttrMap(
urwid.Button(
"SEND", self.send_message(self.send_edit), align=urwid.CENTER
),
"buttn", "buttnf"
urwid.AttrMap(
urwid.Button(
"SEND", self.send_message(self.send_edit), align=urwid.CENTER
),
"buttn", "buttnf"
),
left=0,
right=0
)
@ -260,15 +297,26 @@ class ConversationView(urwid.WidgetWrap):
])
self.header = urwid.Text("VoIP.ms SMS TUI", urwid.CENTER)
self.scrollable = urwid.Scrollable(urwid.Pile(self.chat))
self.sb = urwid.ScrollBar(self.scrollable, trough_char=urwid.ScrollBar.Symbols.LITE_SHADE)
self.sb_chat = urwid.ScrollBar(self.scrollable, trough_char=urwid.ScrollBar.Symbols.LITE_SHADE)
self.view = urwid.Pile([
('pack', urwid.AttrMap(self.header, "header")),
urwid.AttrMap(self.sb, "body"),
urwid.AttrMap(self.sb_chat, "body"),
('pack', urwid.AttrMap(self.send, "footer")),
]
)
self.scroll_to_bottom()
c = self.conversation_selection()
selection = self.conversation_selection()
sb_selection = urwid.ScrollBar(selection, trough_char=urwid.ScrollBar.Symbols.LITE_SHADE)
settings = urwid.AttrMap(
urwid.Button(
"Settings", self.send_message(self.send_edit), align=urwid.CENTER
),
"buttn", "buttnf"
)
c = urwid.Pile([
sb_selection,
('pack',settings)
])
w = urwid.Columns(
[
urwid.AttrMap(c, "sidebar"),