Add logo screen when conversation is not selected

This commit is contained in:
John Mertz 2024-03-01 20:46:57 -07:00
parent c76f53daab
commit 16e4bd41c3
Signed by: jpm
GPG Key ID: E9C5EA2D867501AB
1 changed files with 28 additions and 2 deletions

View File

@ -73,7 +73,6 @@ class ConversationModel:
self.conversations = []
for key in self.data:
self.conversations.append(key)
self.current_conversation=self.conversations[0]
def get_conversations(self):
return self.conversations
@ -120,6 +119,8 @@ class ConversationView(urwid.WidgetWrap):
palette = [
("body", "black", "light gray", "standout"),
("logo_red", "dark red", "light gray", "standout"),
("logo_black", "black", "light gray", "standout"),
("header", "white", "dark red", "bold"),
("footer", "black", "dark cyan"),
("sidebar", "dark gray", "black"),
@ -132,8 +133,30 @@ class ConversationView(urwid.WidgetWrap):
self.started = True
self.offset = 0
self.last_offset = None
self.current_conversation=None
super().__init__(self.main_window())
def logo(self):
return [
urwid.Divider(" ", top=10),
urwid.Padding(
urwid.Pile([
urwid.Text([("logo_red","┌─┐ ┌─┐┌──────┐┌─┐┌─────┐"),("logo_black","┌───────┐┌──────┐")],align=urwid.CENTER),
urwid.Text([("logo_red","│ │ │ ││ ┌──┐ │└─┘└───┐ │"),("logo_black","│ ┌───┐ ││ ┌────┘")],align=urwid.CENTER),
urwid.Text([("logo_red","│ └┐┌┘ ││ │ │ │┌─┐┌───┘ │"),("logo_black","│ │┌─┐│ ││ └┐┌──┐")],align=urwid.CENTER),
urwid.Text([("logo_red","└┐ └┘ ┌┘│ │ │ ││ ││ ┌───┘"),("logo_black","│ ││ ││ │└──┘└┐ │")],align=urwid.CENTER),
urwid.Text([("logo_red"," └┐ ┌┘ │ └──┘ ││ ││ │"),("logo_black"," ┌─┐│ ││ ││ │┌────┘ │")],align=urwid.CENTER),
urwid.Text([("logo_red"," └──┘ └──────┘└─┘└─┘"),("logo_black"," └─┘└─┘└─┘└─┘└──────┘")],align=urwid.CENTER),
urwid.Text([("logo_black","┌─────┐┌───────┐┌─────┐"),("logo_red"," ┌─────┐┌─┐ ┌─┐┌───┐")],align=urwid.CENTER),
urwid.Text([("logo_black","│ ┌───┘│ ┌┐ ┌┐ ││ ┌───┘"),("logo_red"," └─┐ ┌─┘│ │ │ │└┐ ┌┘")],align=urwid.CENTER),
urwid.Text([("logo_black","│ └───┐│ ││ ││ ││ └───┐┌─┐"),("logo_red","│ │ │ │ │ │ │ │ ")],align=urwid.CENTER),
urwid.Text([("logo_black","└───┐ ││ ││ ││ │└───┐ │└─┘"),("logo_red","│ │ │ │ │ │ │ │ ")],align=urwid.CENTER),
urwid.Text([("logo_black","┌───┘ ││ ││ ││ │┌───┘ │"),("logo_red"," │ │ │ └─┘ │┌┘ └┐")],align=urwid.CENTER),
urwid.Text([("logo_black","└─────┘└─┘└─┘└─┘└─────┘"),("logo_red"," └─┘ └─────┘└───┘")],align=urwid.CENTER),
]),
),
]
def update_conversation(self, force_update=False):
return self.model.get_messages()
@ -164,7 +187,10 @@ class ConversationView(urwid.WidgetWrap):
conversation = self.model.get_conversations()[0]
def conversation(self):
return self.update_conversation()
if self.current_conversation == None:
return self.logo()
else:
return self.model.get_messages()
def button(self, t, fn):
w = urwid.Button(t, fn)