Add Kivy inbox screen

This commit is contained in:
shekhar-cis 2022-10-14 15:52:00 +05:30
parent f6c7e50acf
commit 499779b1f2
Signed by untrusted user: shekhar-cis
GPG Key ID: F4F00AB04E83F9A7
4 changed files with 66 additions and 1 deletions

View File

@ -0,0 +1,58 @@
# pylint: disable=unused-import, too-many-public-methods, unused-variable, too-many-ancestors
# pylint: disable=no-name-in-module, too-few-public-methods, import-error, unused-argument, too-many-arguments
# pylint: disable=attribute-defined-outside-init, global-variable-not-assigned, too-many-instance-attributes
"""
Kivy UI for inbox screen
"""
from kivy.clock import Clock
from kivy.properties import (
ListProperty,
StringProperty
)
from kivy.app import App
from kivy.uix.screenmanager import Screen
from pybitmessage.bitmessagekivy.baseclass.common import kivy_state_variables, load_image_path
class Inbox(Screen):
"""Inbox Screen class for kivy Ui"""
queryreturn = ListProperty()
has_refreshed = True
account = StringProperty()
no_search_res_found = "No search result found"
label_str = "Yet no message for this account!"
def __init__(self, *args, **kwargs):
"""Initialize kivy variables"""
super(Inbox, self).__init__(*args, **kwargs)
self.kivy_running_app = App.get_running_app()
self.kivy_state = kivy_state_variables()
self.image_dir = load_image_path()
Clock.schedule_once(self.init_ui, 0)
def set_defaultAddress(self):
"""Set default address"""
if self.kivy_state.association == "":
if self.kivy_running_app.identity_list:
self.kivy_state.association = self.kivy_running_app.identity_list[0]
def init_ui(self, dt=0):
"""loadMessagelist() call at specific interval"""
def refresh_callback(self, *args):
"""Load inbox messages while wating-loader spins & called in inbox.kv"""
def refresh_on_scroll_down(interval):
"""Reset fields and load data on scrolling upside down"""
self.kivy_state.searching_text = ""
self.children[2].children[1].ids.search_field.text = ""
self.ids.ml.clear_widgets()
self.loadMessagelist(self.kivy_state.association)
self.has_refreshed = True
self.ids.refresh_layout.refresh_done()
self.tick = 0
Clock.schedule_once(refresh_on_scroll_down, 1)

View File

@ -154,7 +154,7 @@ class MailDetail(Screen): # pylint: disable=too-many-instance-attributes
self.parent.screens[2].ids.ml.clear_widgets()
self.parent.screens[2].loadSent(self.kivy_state.association)
elif self.kivy_state.detail_page_type == 'inbox':
App.get_running_app().root.ids.sc1.ids.inbox_search.ids.search_field.text = ''
App.get_running_app().root.ids.id_inbox.ids.inbox_search.ids.search_field.text = ''
trash(self.kivy_state.mail_id)
msg_count_objs.inbox_cnt.ids.badge_txt.text = str(
int(self.kivy_state.inbox_count) - 1)

View File

@ -220,6 +220,8 @@ MDNavigationLayout:
id:id_payment
Create:
id:id_create
Inbox:
id:id_inbox
MDNavigationDrawer:
id: nav_drawer

View File

@ -1,4 +1,9 @@
{
"Inbox": {
"kv_string": "inbox",
"name_screen": "inbox",
"Import": "from pybitmessage.bitmessagekivy.baseclass.inbox import Inbox"
},
"Login": {
"kv_string": "login",
"Import": "from pybitmessage.bitmessagekivy.baseclass.login import *"