Settings button + scrollable contact list
This commit is contained in:
parent
16e4bd41c3
commit
563427397e
|
@ -69,6 +69,46 @@ class ConversationModel:
|
||||||
'msg': "oh, hi"
|
'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 = []
|
self.conversations = []
|
||||||
for key in self.data:
|
for key in self.data:
|
||||||
|
@ -131,8 +171,6 @@ class ConversationView(urwid.WidgetWrap):
|
||||||
def __init__(self, model):
|
def __init__(self, model):
|
||||||
self.model = model
|
self.model = model
|
||||||
self.started = True
|
self.started = True
|
||||||
self.offset = 0
|
|
||||||
self.last_offset = None
|
|
||||||
self.current_conversation=None
|
self.current_conversation=None
|
||||||
super().__init__(self.main_window())
|
super().__init__(self.main_window())
|
||||||
|
|
||||||
|
@ -172,7 +210,6 @@ class ConversationView(urwid.WidgetWrap):
|
||||||
urwid.AttrMap(self.chat, "body"),
|
urwid.AttrMap(self.chat, "body"),
|
||||||
footer=self.send
|
footer=self.send
|
||||||
)
|
)
|
||||||
self.last_offset = None
|
|
||||||
|
|
||||||
def on_conversation_change(self, m):
|
def on_conversation_change(self, m):
|
||||||
"""Handle external conversation change by updating radio buttons."""
|
"""Handle external conversation change by updating radio buttons."""
|
||||||
|
@ -235,7 +272,7 @@ class ConversationView(urwid.WidgetWrap):
|
||||||
|
|
||||||
def main_window(self):
|
def main_window(self):
|
||||||
self.chat = self.conversation()
|
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_edit = urwid.Edit("", self.send_content, multiline=True)
|
||||||
self.send_box = urwid.Padding(self.send_edit, left=1, right=1)
|
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))
|
urwid.connect_signal(self.send_edit, 'change', self.send_update(self.send_content,self.send_edit))
|
||||||
|
@ -260,15 +297,26 @@ class ConversationView(urwid.WidgetWrap):
|
||||||
])
|
])
|
||||||
self.header = urwid.Text("VoIP.ms SMS TUI", urwid.CENTER)
|
self.header = urwid.Text("VoIP.ms SMS TUI", urwid.CENTER)
|
||||||
self.scrollable = urwid.Scrollable(urwid.Pile(self.chat))
|
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([
|
self.view = urwid.Pile([
|
||||||
('pack', urwid.AttrMap(self.header, "header")),
|
('pack', urwid.AttrMap(self.header, "header")),
|
||||||
urwid.AttrMap(self.sb, "body"),
|
urwid.AttrMap(self.sb_chat, "body"),
|
||||||
('pack', urwid.AttrMap(self.send, "footer")),
|
('pack', urwid.AttrMap(self.send, "footer")),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
self.scroll_to_bottom()
|
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(
|
w = urwid.Columns(
|
||||||
[
|
[
|
||||||
urwid.AttrMap(c, "sidebar"),
|
urwid.AttrMap(c, "sidebar"),
|
||||||
|
|
Loading…
Reference in New Issue