From 0f53c1e03c04d117659d64548e009f0c144682ab Mon Sep 17 00:00:00 2001 From: shekhar-cis Date: Thu, 7 Jul 2022 21:40:26 +0530 Subject: [PATCH] Add Trash Screen --- src/bitmessagekivy/baseclass/trash.py | 33 +++++++++++++++++++++++++++ src/bitmessagekivy/main.kv | 2 ++ src/bitmessagekivy/screens_data.json | 5 ++++ 3 files changed, 40 insertions(+) create mode 100644 src/bitmessagekivy/baseclass/trash.py diff --git a/src/bitmessagekivy/baseclass/trash.py b/src/bitmessagekivy/baseclass/trash.py new file mode 100644 index 00000000..eb62fdaa --- /dev/null +++ b/src/bitmessagekivy/baseclass/trash.py @@ -0,0 +1,33 @@ +# pylint: disable=unused-argument, consider-using-f-string, import-error, attribute-defined-outside-init +# pylint: disable=unnecessary-comprehension, no-member, no-name-in-module, too-few-public-methods + +""" + Trash screen +""" + +from kivy.properties import ( + ListProperty, + StringProperty +) +from kivy.uix.screenmanager import Screen +from kivy.app import App + +from pybitmessage.bitmessagekivy.baseclass.common import kivy_state_variables + + +class Trash(Screen): + """Trash Screen class for kivy Ui""" + + trash_messages = ListProperty() + has_refreshed = True + delete_index = None + table_name = StringProperty() + no_msg_found_str = "Yet no trashed message for this account!" + + def __init__(self, *args, **kwargs): + """Trash method, delete sent message and add in Trash""" + super(Trash, 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 13f5578c..86dc5936 100644 --- a/src/bitmessagekivy/main.kv +++ b/src/bitmessagekivy/main.kv @@ -231,6 +231,8 @@ MDNavigationLayout: id:id_inbox Sent: id:id_sent + Trash: + id:id_trash MDNavigationDrawer: id: nav_drawer diff --git a/src/bitmessagekivy/screens_data.json b/src/bitmessagekivy/screens_data.json index e788385b..8d21571a 100644 --- a/src/bitmessagekivy/screens_data.json +++ b/src/bitmessagekivy/screens_data.json @@ -41,5 +41,10 @@ "kv_string": "sent", "name_screen": "sent", "Import": "from pybitmessage.bitmessagekivy.baseclass.sent import Sent" + }, + "Trash": { + "kv_string": "trash", + "name_screen": "trash", + "Import": "from pybitmessage.bitmessagekivy.baseclass.trash import Trash" } }