From 1189628ed64489fac96cdc06990064cb56cb5643 Mon Sep 17 00:00:00 2001 From: shekhar-cis Date: Fri, 8 Jul 2022 17:46:08 +0530 Subject: [PATCH] Add kivy Sent screen --- src/bitmessagekivy/baseclass/maildetail.py | 2 +- src/bitmessagekivy/baseclass/sent.py | 30 ++++++++++++++++++++++ src/bitmessagekivy/main.kv | 4 ++- src/bitmessagekivy/screens_data.json | 5 ++++ 4 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 src/bitmessagekivy/baseclass/sent.py diff --git a/src/bitmessagekivy/baseclass/maildetail.py b/src/bitmessagekivy/baseclass/maildetail.py index 633ed844..23f50f3e 100644 --- a/src/bitmessagekivy/baseclass/maildetail.py +++ b/src/bitmessagekivy/baseclass/maildetail.py @@ -147,7 +147,7 @@ class MailDetail(Screen): # pylint: disable=too-many-instance-attributes self.kivy_state.searching_text = '' self.children[0].children[0].active = True if self.kivy_state.detail_page_type == 'sent': - App.get_running_app().root.ids.sc4.ids.sent_search.ids.search_field.text = '' + App.get_running_app().root.ids.id_sent.ids.sent_search.ids.search_field.text = '' delete(self.kivy_state.mail_id) msg_count_objs.send_cnt.ids.badge_txt.text = str(int(self.kivy_state.sent_count) - 1) self.kivy_state.sent_count = str(int(self.kivy_state.sent_count) - 1) diff --git a/src/bitmessagekivy/baseclass/sent.py b/src/bitmessagekivy/baseclass/sent.py new file mode 100644 index 00000000..e0a97b99 --- /dev/null +++ b/src/bitmessagekivy/baseclass/sent.py @@ -0,0 +1,30 @@ +# pylint: disable=import-error, attribute-defined-outside-init, too-many-arguments +# pylint: disable=no-member, no-name-in-module, unused-argument, too-few-public-methods + +""" + Sent screen; All sent message managed here. +""" + +from kivy.properties import StringProperty, ListProperty +from kivy.uix.screenmanager import Screen +from kivy.app import App + +from pybitmessage.bitmessagekivy.baseclass.common import kivy_state_variables + + +class Sent(Screen): + """Sent Screen class for kivy UI""" + + queryreturn = ListProperty() + account = StringProperty() + has_refreshed = True + no_search_res_found = "No search result found" + label_str = "Yet no message for this account!" + + def __init__(self, *args, **kwargs): + """Association with the screen""" + super(Sent, self).__init__(*args, **kwargs) + self.kivy_state = kivy_state_variables() + if self.kivy_state.selected_address == '': + if App.get_running_app().identity_list: + self.kivy_state.selected_address = App.get_running_app().identity_list[0] diff --git a/src/bitmessagekivy/main.kv b/src/bitmessagekivy/main.kv index d2d3d10d..13f5578c 100644 --- a/src/bitmessagekivy/main.kv +++ b/src/bitmessagekivy/main.kv @@ -130,7 +130,7 @@ text: app.tr._('Sent') icon: 'send' divider: None - on_release: app.root.ids.scr_mngr.current = 'sent' + on_release: app.set_screen('sent') on_release: root.parent.set_state() NavigationItem: id: draft_cnt @@ -229,6 +229,8 @@ MDNavigationLayout: id:id_settings Inbox: id:id_inbox + Sent: + id:id_sent MDNavigationDrawer: id: nav_drawer diff --git a/src/bitmessagekivy/screens_data.json b/src/bitmessagekivy/screens_data.json index 492907fc..e788385b 100644 --- a/src/bitmessagekivy/screens_data.json +++ b/src/bitmessagekivy/screens_data.json @@ -36,5 +36,10 @@ "kv_string": "settings", "name_screen": "set", "Import": "from pybitmessage.bitmessagekivy.baseclass.settings import Setting" + }, + "Sent": { + "kv_string": "sent", + "name_screen": "sent", + "Import": "from pybitmessage.bitmessagekivy.baseclass.sent import Sent" } }